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,41 +1,34 @@
1
1
  /* ***** BEGIN LICENSE BLOCK *****
2
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
8
- *
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
- * Rich Healey <richo AT psych0tik DOT net>
23
- *
24
- * Alternatively, the contents of this file may be used under the terms of
25
- * either the GNU General Public License Version 2 or later (the "GPL"), or
26
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
- * in which case the provisions of the GPL or the LGPL are applicable instead
28
- * of those above. If you wish to allow use of your version of this file only
29
- * under the terms of either the GPL or the LGPL, and not to allow others to
30
- * use your version of this file under the terms of the MPL, indicate your
31
- * decision by deleting the provisions above and replace them with the notice
32
- * and other provisions required by the GPL or the LGPL. If you do not delete
33
- * the provisions above, a recipient may use your version of this file under
34
- * the terms of any one of the MPL, the GPL or the LGPL.
35
- *
36
- * ***** END LICENSE BLOCK ***** */
37
-
38
- define('ace/mode/sh', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/sh_highlight_rules', 'ace/range'], function(require, exports, module) {
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/mode/sh', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/sh_highlight_rules', 'ace/range', 'ace/mode/folding/cstyle'], function(require, exports, module) {
39
32
 
40
33
 
41
34
  var oop = require("../lib/oop");
@@ -43,46 +36,23 @@ var TextMode = require("./text").Mode;
43
36
  var Tokenizer = require("../tokenizer").Tokenizer;
44
37
  var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
45
38
  var Range = require("../range").Range;
39
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
46
40
 
47
41
  var Mode = function() {
48
- this.$tokenizer = new Tokenizer(new ShHighlightRules().getRules());
42
+ this.HighlightRules = ShHighlightRules;
43
+ this.foldingRules = new CStyleFoldMode();
49
44
  };
50
45
  oop.inherits(Mode, TextMode);
51
46
 
52
47
  (function() {
53
48
 
54
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
55
- var outdent = true;
56
- var re = /^(\s*)#/;
57
-
58
- for (var i=startRow; i<= endRow; i++) {
59
- if (!re.test(doc.getLine(i))) {
60
- outdent = false;
61
- break;
62
- }
63
- }
64
-
65
- if (outdent) {
66
- var deleteRange = new Range(0, 0, 0, 0);
67
- for (var i=startRow; i<= endRow; i++)
68
- {
69
- var line = doc.getLine(i);
70
- var m = line.match(re);
71
- deleteRange.start.row = i;
72
- deleteRange.end.row = i;
73
- deleteRange.end.column = m[0].length;
74
- doc.replace(deleteRange, m[1]);
75
- }
76
- }
77
- else {
78
- doc.indentRows(startRow, endRow, "#");
79
- }
80
- };
49
+
50
+ this.lineCommentStart = "#";
81
51
 
82
52
  this.getNextLineIndent = function(state, line, tab) {
83
53
  var indent = this.$getIndent(line);
84
54
 
85
- var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
55
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
86
56
  var tokens = tokenizedLine.tokens;
87
57
 
88
58
  if (tokens.length && tokens[tokens.length-1].type == "comment") {
@@ -111,12 +81,10 @@ oop.inherits(Mode, TextMode);
111
81
  if (input !== "\r\n" && input !== "\r" && input !== "\n")
112
82
  return false;
113
83
 
114
- var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
84
+ var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
115
85
 
116
86
  if (!tokens)
117
87
  return false;
118
-
119
- // ignore trailing comments
120
88
  do {
121
89
  var last = tokens.pop();
122
90
  } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
@@ -128,8 +96,6 @@ oop.inherits(Mode, TextMode);
128
96
  };
129
97
 
130
98
  this.autoOutdent = function(state, doc, row) {
131
- // outdenting in sh is slightly different because it always applies
132
- // to the next line and only of a new line is inserted
133
99
 
134
100
  row += 1;
135
101
  var indent = this.$getIndent(doc.getLine(row));
@@ -138,41 +104,44 @@ oop.inherits(Mode, TextMode);
138
104
  doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
139
105
  };
140
106
 
107
+ this.$id = "ace/mode/sh";
141
108
  }).call(Mode.prototype);
142
109
 
143
110
  exports.Mode = Mode;
144
111
  });
145
- define('ace/mode/sh_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
112
+
113
+ define('ace/mode/sh_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
146
114
 
147
115
 
148
116
  var oop = require("../lib/oop");
149
- var lang = require("../lib/lang");
150
117
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
151
118
 
152
- var ShHighlightRules = function() {
153
-
154
- var reservedKeywords = lang.arrayToMap(
155
- ('!|{|}|case|do|done|elif|else|'+
119
+ var reservedKeywords = exports.reservedKeywords = (
120
+ '!|{|}|case|do|done|elif|else|'+
156
121
  'esac|fi|for|if|in|then|until|while|'+
157
122
  '&|;|export|local|read|typeset|unset|'+
158
123
  'elif|select|set'
159
- ).split('|')
160
124
  );
161
125
 
162
- var languageConstructs = lang.arrayToMap(
163
- ('[|]|alias|bg|bind|break|builtin|'+
164
- 'cd|command|compgen|complete|continue|'+
165
- 'dirs|disown|echo|enable|eval|exec|'+
166
- 'exit|fc|fg|getopts|hash|help|history|'+
167
- 'jobs|kill|let|logout|popd|printf|pushd|'+
168
- 'pwd|return|set|shift|shopt|source|'+
169
- 'suspend|test|times|trap|type|ulimit|'+
170
- 'umask|unalias|wait'
171
- ).split('|')
172
- );
126
+ var languageConstructs = exports.languageConstructs = (
127
+ '[|]|alias|bg|bind|break|builtin|'+
128
+ 'cd|command|compgen|complete|continue|'+
129
+ 'dirs|disown|echo|enable|eval|exec|'+
130
+ 'exit|fc|fg|getopts|hash|help|history|'+
131
+ 'jobs|kill|let|logout|popd|printf|pushd|'+
132
+ 'pwd|return|set|shift|shopt|source|'+
133
+ 'suspend|test|times|trap|type|ulimit|'+
134
+ 'umask|unalias|wait'
135
+ );
136
+
137
+ var ShHighlightRules = function() {
138
+ var keywordMapper = this.createKeywordMapper({
139
+ "keyword": reservedKeywords,
140
+ "support.function.builtin": languageConstructs,
141
+ "invalid.deprecated": "debugger"
142
+ }, "identifier");
173
143
 
174
144
  var integer = "(?:(?:[1-9]\\d*)|(?:0))";
175
- // var integer = "(?:" + decimalInteger + ")";
176
145
 
177
146
  var fraction = "(?:\\.\\d+)";
178
147
  var intPart = "(?:\\d+)";
@@ -189,12 +158,28 @@ var ShHighlightRules = function() {
189
158
  var func = "(?:" + variableName + "\\s*\\(\\))";
190
159
 
191
160
  this.$rules = {
192
- "start" : [ {
193
- token : "comment",
194
- regex : "#.*$"
161
+ "start" : [{
162
+ token : "constant",
163
+ regex : /\\./
195
164
  }, {
196
- token : "string", // " string
197
- regex : '"(?:[^\\\\]|\\\\.)*?"'
165
+ token : ["text", "comment"],
166
+ regex : /(^|\s)(#.*)$/
167
+ }, {
168
+ token : "string",
169
+ regex : '"',
170
+ push : [{
171
+ token : "constant.language.escape",
172
+ regex : /\\(?:[$abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
173
+ }, {
174
+ token : "constant",
175
+ regex : /\$\w+/
176
+ }, {
177
+ token : "string",
178
+ regex : '"',
179
+ next: "pop"
180
+ }, {
181
+ defaultToken: "string"
182
+ }]
198
183
  }, {
199
184
  token : "variable.language",
200
185
  regex : builtinVariable
@@ -203,13 +188,13 @@ var ShHighlightRules = function() {
203
188
  regex : variable
204
189
  }, {
205
190
  token : "support.function",
206
- regex : func,
191
+ regex : func
207
192
  }, {
208
193
  token : "support.function",
209
194
  regex : fileDescriptor
210
195
  }, {
211
196
  token : "string", // ' string
212
- regex : "'(?:[^\\\\]|\\\\.)*?'"
197
+ start : "'", end : "'"
213
198
  }, {
214
199
  token : "constant.numeric", // float
215
200
  regex : floatNumber
@@ -217,16 +202,7 @@ var ShHighlightRules = function() {
217
202
  token : "constant.numeric", // integer
218
203
  regex : integer + "\\b"
219
204
  }, {
220
- token : function(value) {
221
- if (reservedKeywords.hasOwnProperty(value))
222
- return "keyword";
223
- else if (languageConstructs.hasOwnProperty(value))
224
- return "constant.language";
225
- else if (value == "debugger")
226
- return "invalid.deprecated";
227
- else
228
- return "identifier";
229
- },
205
+ token : keywordMapper,
230
206
  regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
231
207
  }, {
232
208
  token : "keyword.operator",
@@ -237,14 +213,108 @@ var ShHighlightRules = function() {
237
213
  }, {
238
214
  token : "paren.rparen",
239
215
  regex : "[\\]\\)\\}]"
240
- }, {
241
- token : "text",
242
- regex : "\\s+"
243
216
  } ]
244
217
  };
218
+
219
+ this.normalizeRules();
245
220
  };
246
221
 
247
222
  oop.inherits(ShHighlightRules, TextHighlightRules);
248
223
 
249
224
  exports.ShHighlightRules = ShHighlightRules;
250
225
  });
226
+
227
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
228
+
229
+
230
+ var oop = require("../../lib/oop");
231
+ var Range = require("../../range").Range;
232
+ var BaseFoldMode = require("./fold_mode").FoldMode;
233
+
234
+ var FoldMode = exports.FoldMode = function(commentRegex) {
235
+ if (commentRegex) {
236
+ this.foldingStartMarker = new RegExp(
237
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
238
+ );
239
+ this.foldingStopMarker = new RegExp(
240
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
241
+ );
242
+ }
243
+ };
244
+ oop.inherits(FoldMode, BaseFoldMode);
245
+
246
+ (function() {
247
+
248
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
249
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
250
+
251
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
252
+ var line = session.getLine(row);
253
+ var match = line.match(this.foldingStartMarker);
254
+ if (match) {
255
+ var i = match.index;
256
+
257
+ if (match[1])
258
+ return this.openingBracketBlock(session, match[1], row, i);
259
+
260
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
261
+
262
+ if (range && !range.isMultiLine()) {
263
+ if (forceMultiline) {
264
+ range = this.getSectionRange(session, row);
265
+ } else if (foldStyle != "all")
266
+ range = null;
267
+ }
268
+
269
+ return range;
270
+ }
271
+
272
+ if (foldStyle === "markbegin")
273
+ return;
274
+
275
+ var match = line.match(this.foldingStopMarker);
276
+ if (match) {
277
+ var i = match.index + match[0].length;
278
+
279
+ if (match[1])
280
+ return this.closingBracketBlock(session, match[1], row, i);
281
+
282
+ return session.getCommentFoldRange(row, i, -1);
283
+ }
284
+ };
285
+
286
+ this.getSectionRange = function(session, row) {
287
+ var line = session.getLine(row);
288
+ var startIndent = line.search(/\S/);
289
+ var startRow = row;
290
+ var startColumn = line.length;
291
+ row = row + 1;
292
+ var endRow = row;
293
+ var maxRow = session.getLength();
294
+ while (++row < maxRow) {
295
+ line = session.getLine(row);
296
+ var indent = line.search(/\S/);
297
+ if (indent === -1)
298
+ continue;
299
+ if (startIndent > indent)
300
+ break;
301
+ var subRange = this.getFoldWidgetRange(session, "all", row);
302
+
303
+ if (subRange) {
304
+ if (subRange.start.row <= startRow) {
305
+ break;
306
+ } else if (subRange.isMultiLine()) {
307
+ row = subRange.end.row;
308
+ } else if (startIndent == indent) {
309
+ break;
310
+ }
311
+ }
312
+ endRow = row;
313
+ }
314
+
315
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
316
+ };
317
+
318
+ }).call(FoldMode.prototype);
319
+
320
+ });
@@ -0,0 +1,1154 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/mode/sjs', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/sjs_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
32
+
33
+ var oop = require("../lib/oop");
34
+ var JSMode = require("./javascript").Mode;
35
+ var Tokenizer = require("../tokenizer").Tokenizer;
36
+ var SJSHighlightRules = require("./sjs_highlight_rules").SJSHighlightRules;
37
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
38
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
39
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
40
+
41
+ var Mode = function() {
42
+ var highlighter = new SJSHighlightRules();
43
+
44
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
45
+ this.$outdent = new MatchingBraceOutdent();
46
+ this.$behaviour = new CstyleBehaviour();
47
+ this.$keywordList = highlighter.$keywordList;
48
+ this.foldingRules = new CStyleFoldMode();
49
+ };
50
+ oop.inherits(Mode, JSMode);
51
+ (function() {
52
+ this.createWorker = function(session) {
53
+ return null;
54
+ }
55
+ this.$id = "ace/mode/sjs";
56
+ }).call(Mode.prototype);
57
+
58
+ exports.Mode = Mode;
59
+ });
60
+
61
+ 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) {
62
+
63
+
64
+ var oop = require("../lib/oop");
65
+ var TextMode = require("./text").Mode;
66
+ var Tokenizer = require("../tokenizer").Tokenizer;
67
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
68
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
69
+ var Range = require("../range").Range;
70
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
71
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
72
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
73
+
74
+ var Mode = function() {
75
+ this.HighlightRules = JavaScriptHighlightRules;
76
+
77
+ this.$outdent = new MatchingBraceOutdent();
78
+ this.$behaviour = new CstyleBehaviour();
79
+ this.foldingRules = new CStyleFoldMode();
80
+ };
81
+ oop.inherits(Mode, TextMode);
82
+
83
+ (function() {
84
+
85
+ this.lineCommentStart = "//";
86
+ this.blockComment = {start: "/*", end: "*/"};
87
+
88
+ this.getNextLineIndent = function(state, line, tab) {
89
+ var indent = this.$getIndent(line);
90
+
91
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
92
+ var tokens = tokenizedLine.tokens;
93
+ var endState = tokenizedLine.state;
94
+
95
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
96
+ return indent;
97
+ }
98
+
99
+ if (state == "start" || state == "no_regex") {
100
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
101
+ if (match) {
102
+ indent += tab;
103
+ }
104
+ } else if (state == "doc-start") {
105
+ if (endState == "start" || endState == "no_regex") {
106
+ return "";
107
+ }
108
+ var match = line.match(/^\s*(\/?)\*/);
109
+ if (match) {
110
+ if (match[1]) {
111
+ indent += " ";
112
+ }
113
+ indent += "* ";
114
+ }
115
+ }
116
+
117
+ return indent;
118
+ };
119
+
120
+ this.checkOutdent = function(state, line, input) {
121
+ return this.$outdent.checkOutdent(line, input);
122
+ };
123
+
124
+ this.autoOutdent = function(state, doc, row) {
125
+ this.$outdent.autoOutdent(doc, row);
126
+ };
127
+
128
+ this.createWorker = function(session) {
129
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
130
+ worker.attachToDocument(session.getDocument());
131
+
132
+ worker.on("jslint", function(results) {
133
+ session.setAnnotations(results.data);
134
+ });
135
+
136
+ worker.on("terminate", function() {
137
+ session.clearAnnotations();
138
+ });
139
+
140
+ return worker;
141
+ };
142
+
143
+ this.$id = "ace/mode/javascript";
144
+ }).call(Mode.prototype);
145
+
146
+ exports.Mode = Mode;
147
+ });
148
+
149
+ 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) {
150
+
151
+
152
+ var oop = require("../lib/oop");
153
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
154
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
155
+
156
+ var JavaScriptHighlightRules = function() {
157
+ var keywordMapper = this.createKeywordMapper({
158
+ "variable.language":
159
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
160
+ "Namespace|QName|XML|XMLList|" + // E4X
161
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
162
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
163
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
164
+ "SyntaxError|TypeError|URIError|" +
165
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
166
+ "isNaN|parseFloat|parseInt|" +
167
+ "JSON|Math|" + // Other
168
+ "this|arguments|prototype|window|document" , // Pseudo
169
+ "keyword":
170
+ "const|yield|import|get|set|" +
171
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
172
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
173
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
174
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
175
+ "storage.type":
176
+ "const|let|var|function",
177
+ "constant.language":
178
+ "null|Infinity|NaN|undefined",
179
+ "support.function":
180
+ "alert",
181
+ "constant.language.boolean": "true|false"
182
+ }, "identifier");
183
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
184
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
185
+
186
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
187
+ "u[0-9a-fA-F]{4}|" + // unicode
188
+ "[0-2][0-7]{0,2}|" + // oct
189
+ "3[0-6][0-7]?|" + // oct
190
+ "37[0-7]?|" + // oct
191
+ "[4-7][0-7]?|" + //oct
192
+ ".)";
193
+
194
+ this.$rules = {
195
+ "no_regex" : [
196
+ {
197
+ token : "comment",
198
+ regex : "\\/\\/",
199
+ next : "line_comment"
200
+ },
201
+ DocCommentHighlightRules.getStartRule("doc-start"),
202
+ {
203
+ token : "comment", // multi line comment
204
+ regex : /\/\*/,
205
+ next : "comment"
206
+ }, {
207
+ token : "string",
208
+ regex : "'(?=.)",
209
+ next : "qstring"
210
+ }, {
211
+ token : "string",
212
+ regex : '"(?=.)',
213
+ next : "qqstring"
214
+ }, {
215
+ token : "constant.numeric", // hex
216
+ regex : /0[xX][0-9a-fA-F]+\b/
217
+ }, {
218
+ token : "constant.numeric", // float
219
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
220
+ }, {
221
+ token : [
222
+ "storage.type", "punctuation.operator", "support.function",
223
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
224
+ ],
225
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
226
+ next: "function_arguments"
227
+ }, {
228
+ token : [
229
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
230
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
231
+ ],
232
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
233
+ next: "function_arguments"
234
+ }, {
235
+ token : [
236
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
237
+ "text", "paren.lparen"
238
+ ],
239
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
240
+ next: "function_arguments"
241
+ }, {
242
+ token : [
243
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
244
+ "keyword.operator", "text",
245
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
246
+ ],
247
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
248
+ next: "function_arguments"
249
+ }, {
250
+ token : [
251
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
252
+ ],
253
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
254
+ next: "function_arguments"
255
+ }, {
256
+ token : [
257
+ "entity.name.function", "text", "punctuation.operator",
258
+ "text", "storage.type", "text", "paren.lparen"
259
+ ],
260
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
261
+ next: "function_arguments"
262
+ }, {
263
+ token : [
264
+ "text", "text", "storage.type", "text", "paren.lparen"
265
+ ],
266
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
267
+ next: "function_arguments"
268
+ }, {
269
+ token : "keyword",
270
+ regex : "(?:" + kwBeforeRe + ")\\b",
271
+ next : "start"
272
+ }, {
273
+ token : ["punctuation.operator", "support.function"],
274
+ 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(?=\()/
275
+ }, {
276
+ token : ["punctuation.operator", "support.function.dom"],
277
+ 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(?=\()/
278
+ }, {
279
+ token : ["punctuation.operator", "support.constant"],
280
+ 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/
281
+ }, {
282
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
283
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
284
+ }, {
285
+ token : keywordMapper,
286
+ regex : identifierRe
287
+ }, {
288
+ token : "keyword.operator",
289
+ regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
290
+ next : "start"
291
+ }, {
292
+ token : "punctuation.operator",
293
+ regex : /\?|\:|\,|\;|\./,
294
+ next : "start"
295
+ }, {
296
+ token : "paren.lparen",
297
+ regex : /[\[({]/,
298
+ next : "start"
299
+ }, {
300
+ token : "paren.rparen",
301
+ regex : /[\])}]/
302
+ }, {
303
+ token : "keyword.operator",
304
+ regex : /\/=?/,
305
+ next : "start"
306
+ }, {
307
+ token: "comment",
308
+ regex: /^#!.*$/
309
+ }
310
+ ],
311
+ "start": [
312
+ DocCommentHighlightRules.getStartRule("doc-start"),
313
+ {
314
+ token : "comment", // multi line comment
315
+ regex : "\\/\\*",
316
+ next : "comment_regex_allowed"
317
+ }, {
318
+ token : "comment",
319
+ regex : "\\/\\/",
320
+ next : "line_comment_regex_allowed"
321
+ }, {
322
+ token: "string.regexp",
323
+ regex: "\\/",
324
+ next: "regex"
325
+ }, {
326
+ token : "text",
327
+ regex : "\\s+|^$",
328
+ next : "start"
329
+ }, {
330
+ token: "empty",
331
+ regex: "",
332
+ next: "no_regex"
333
+ }
334
+ ],
335
+ "regex": [
336
+ {
337
+ token: "regexp.keyword.operator",
338
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
339
+ }, {
340
+ token: "string.regexp",
341
+ regex: "/[sxngimy]*",
342
+ next: "no_regex"
343
+ }, {
344
+ token : "invalid",
345
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
346
+ }, {
347
+ token : "constant.language.escape",
348
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
349
+ }, {
350
+ token : "constant.language.delimiter",
351
+ regex: /\|/
352
+ }, {
353
+ token: "constant.language.escape",
354
+ regex: /\[\^?/,
355
+ next: "regex_character_class"
356
+ }, {
357
+ token: "empty",
358
+ regex: "$",
359
+ next: "no_regex"
360
+ }, {
361
+ defaultToken: "string.regexp"
362
+ }
363
+ ],
364
+ "regex_character_class": [
365
+ {
366
+ token: "regexp.keyword.operator",
367
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
368
+ }, {
369
+ token: "constant.language.escape",
370
+ regex: "]",
371
+ next: "regex"
372
+ }, {
373
+ token: "constant.language.escape",
374
+ regex: "-"
375
+ }, {
376
+ token: "empty",
377
+ regex: "$",
378
+ next: "no_regex"
379
+ }, {
380
+ defaultToken: "string.regexp.charachterclass"
381
+ }
382
+ ],
383
+ "function_arguments": [
384
+ {
385
+ token: "variable.parameter",
386
+ regex: identifierRe
387
+ }, {
388
+ token: "punctuation.operator",
389
+ regex: "[, ]+"
390
+ }, {
391
+ token: "punctuation.operator",
392
+ regex: "$"
393
+ }, {
394
+ token: "empty",
395
+ regex: "",
396
+ next: "no_regex"
397
+ }
398
+ ],
399
+ "comment_regex_allowed" : [
400
+ {token : "comment", regex : "\\*\\/", next : "start"},
401
+ {defaultToken : "comment"}
402
+ ],
403
+ "comment" : [
404
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
405
+ {defaultToken : "comment"}
406
+ ],
407
+ "line_comment_regex_allowed" : [
408
+ {token : "comment", regex : "$|^", next : "start"},
409
+ {defaultToken : "comment"}
410
+ ],
411
+ "line_comment" : [
412
+ {token : "comment", regex : "$|^", next : "no_regex"},
413
+ {defaultToken : "comment"}
414
+ ],
415
+ "qqstring" : [
416
+ {
417
+ token : "constant.language.escape",
418
+ regex : escapedRe
419
+ }, {
420
+ token : "string",
421
+ regex : "\\\\$",
422
+ next : "qqstring"
423
+ }, {
424
+ token : "string",
425
+ regex : '"|$',
426
+ next : "no_regex"
427
+ }, {
428
+ defaultToken: "string"
429
+ }
430
+ ],
431
+ "qstring" : [
432
+ {
433
+ token : "constant.language.escape",
434
+ regex : escapedRe
435
+ }, {
436
+ token : "string",
437
+ regex : "\\\\$",
438
+ next : "qstring"
439
+ }, {
440
+ token : "string",
441
+ regex : "'|$",
442
+ next : "no_regex"
443
+ }, {
444
+ defaultToken: "string"
445
+ }
446
+ ]
447
+ };
448
+
449
+ this.embedRules(DocCommentHighlightRules, "doc-",
450
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
451
+ };
452
+
453
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
454
+
455
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
456
+ });
457
+
458
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
459
+
460
+
461
+ var oop = require("../lib/oop");
462
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
463
+
464
+ var DocCommentHighlightRules = function() {
465
+
466
+ this.$rules = {
467
+ "start" : [ {
468
+ token : "comment.doc.tag",
469
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
470
+ }, {
471
+ token : "comment.doc.tag",
472
+ regex : "\\bTODO\\b"
473
+ }, {
474
+ defaultToken : "comment.doc"
475
+ }]
476
+ };
477
+ };
478
+
479
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
480
+
481
+ DocCommentHighlightRules.getStartRule = function(start) {
482
+ return {
483
+ token : "comment.doc", // doc comment
484
+ regex : "\\/\\*(?=\\*)",
485
+ next : start
486
+ };
487
+ };
488
+
489
+ DocCommentHighlightRules.getEndRule = function (start) {
490
+ return {
491
+ token : "comment.doc", // closing comment
492
+ regex : "\\*\\/",
493
+ next : start
494
+ };
495
+ };
496
+
497
+
498
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
499
+
500
+ });
501
+
502
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
503
+
504
+
505
+ var Range = require("../range").Range;
506
+
507
+ var MatchingBraceOutdent = function() {};
508
+
509
+ (function() {
510
+
511
+ this.checkOutdent = function(line, input) {
512
+ if (! /^\s+$/.test(line))
513
+ return false;
514
+
515
+ return /^\s*\}/.test(input);
516
+ };
517
+
518
+ this.autoOutdent = function(doc, row) {
519
+ var line = doc.getLine(row);
520
+ var match = line.match(/^(\s*\})/);
521
+
522
+ if (!match) return 0;
523
+
524
+ var column = match[1].length;
525
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
526
+
527
+ if (!openBracePos || openBracePos.row == row) return 0;
528
+
529
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
530
+ doc.replace(new Range(row, 0, row, column-1), indent);
531
+ };
532
+
533
+ this.$getIndent = function(line) {
534
+ return line.match(/^\s*/)[0];
535
+ };
536
+
537
+ }).call(MatchingBraceOutdent.prototype);
538
+
539
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
540
+ });
541
+
542
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
543
+
544
+
545
+ var oop = require("../../lib/oop");
546
+ var Behaviour = require("../behaviour").Behaviour;
547
+ var TokenIterator = require("../../token_iterator").TokenIterator;
548
+ var lang = require("../../lib/lang");
549
+
550
+ var SAFE_INSERT_IN_TOKENS =
551
+ ["text", "paren.rparen", "punctuation.operator"];
552
+ var SAFE_INSERT_BEFORE_TOKENS =
553
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
554
+
555
+
556
+ var autoInsertedBrackets = 0;
557
+ var autoInsertedRow = -1;
558
+ var autoInsertedLineEnd = "";
559
+ var maybeInsertedBrackets = 0;
560
+ var maybeInsertedRow = -1;
561
+ var maybeInsertedLineStart = "";
562
+ var maybeInsertedLineEnd = "";
563
+
564
+ var CstyleBehaviour = function () {
565
+
566
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
567
+ var cursor = editor.getCursorPosition();
568
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
569
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
570
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
571
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
572
+ return false;
573
+ }
574
+ iterator.stepForward();
575
+ return iterator.getCurrentTokenRow() !== cursor.row ||
576
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
577
+ };
578
+
579
+ CstyleBehaviour.$matchTokenType = function(token, types) {
580
+ return types.indexOf(token.type || token) > -1;
581
+ };
582
+
583
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
584
+ var cursor = editor.getCursorPosition();
585
+ var line = session.doc.getLine(cursor.row);
586
+ if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
587
+ autoInsertedBrackets = 0;
588
+ autoInsertedRow = cursor.row;
589
+ autoInsertedLineEnd = bracket + line.substr(cursor.column);
590
+ autoInsertedBrackets++;
591
+ };
592
+
593
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
594
+ var cursor = editor.getCursorPosition();
595
+ var line = session.doc.getLine(cursor.row);
596
+ if (!this.isMaybeInsertedClosing(cursor, line))
597
+ maybeInsertedBrackets = 0;
598
+ maybeInsertedRow = cursor.row;
599
+ maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
600
+ maybeInsertedLineEnd = line.substr(cursor.column);
601
+ maybeInsertedBrackets++;
602
+ };
603
+
604
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
605
+ return autoInsertedBrackets > 0 &&
606
+ cursor.row === autoInsertedRow &&
607
+ bracket === autoInsertedLineEnd[0] &&
608
+ line.substr(cursor.column) === autoInsertedLineEnd;
609
+ };
610
+
611
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
612
+ return maybeInsertedBrackets > 0 &&
613
+ cursor.row === maybeInsertedRow &&
614
+ line.substr(cursor.column) === maybeInsertedLineEnd &&
615
+ line.substr(0, cursor.column) == maybeInsertedLineStart;
616
+ };
617
+
618
+ CstyleBehaviour.popAutoInsertedClosing = function() {
619
+ autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
620
+ autoInsertedBrackets--;
621
+ };
622
+
623
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
624
+ maybeInsertedBrackets = 0;
625
+ maybeInsertedRow = -1;
626
+ };
627
+
628
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
629
+ var cursor = editor.getCursorPosition();
630
+ var line = session.doc.getLine(cursor.row);
631
+ if (text == '{') {
632
+ var selection = editor.getSelectionRange();
633
+ var selected = session.doc.getTextRange(selection);
634
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
635
+ return {
636
+ text: '{' + selected + '}',
637
+ selection: false
638
+ };
639
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
640
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
641
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
642
+ return {
643
+ text: '{}',
644
+ selection: [1, 1]
645
+ };
646
+ } else {
647
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
648
+ return {
649
+ text: '{',
650
+ selection: [1, 1]
651
+ };
652
+ }
653
+ }
654
+ } else if (text == '}') {
655
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
656
+ if (rightChar == '}') {
657
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
658
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
659
+ CstyleBehaviour.popAutoInsertedClosing();
660
+ return {
661
+ text: '',
662
+ selection: [1, 1]
663
+ };
664
+ }
665
+ }
666
+ } else if (text == "\n" || text == "\r\n") {
667
+ var closing = "";
668
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
669
+ closing = lang.stringRepeat("}", maybeInsertedBrackets);
670
+ CstyleBehaviour.clearMaybeInsertedClosing();
671
+ }
672
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
673
+ if (rightChar === '}') {
674
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
675
+ if (!openBracePos)
676
+ return null;
677
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
678
+ } else if (closing) {
679
+ var next_indent = this.$getIndent(line);
680
+ } else {
681
+ return;
682
+ }
683
+ var indent = next_indent + session.getTabString();
684
+
685
+ return {
686
+ text: '\n' + indent + '\n' + next_indent + closing,
687
+ selection: [1, indent.length, 1, indent.length]
688
+ };
689
+ } else {
690
+ CstyleBehaviour.clearMaybeInsertedClosing();
691
+ }
692
+ });
693
+
694
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
695
+ var selected = session.doc.getTextRange(range);
696
+ if (!range.isMultiLine() && selected == '{') {
697
+ var line = session.doc.getLine(range.start.row);
698
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
699
+ if (rightChar == '}') {
700
+ range.end.column++;
701
+ return range;
702
+ } else {
703
+ maybeInsertedBrackets--;
704
+ }
705
+ }
706
+ });
707
+
708
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
709
+ if (text == '(') {
710
+ var selection = editor.getSelectionRange();
711
+ var selected = session.doc.getTextRange(selection);
712
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
713
+ return {
714
+ text: '(' + selected + ')',
715
+ selection: false
716
+ };
717
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
718
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
719
+ return {
720
+ text: '()',
721
+ selection: [1, 1]
722
+ };
723
+ }
724
+ } else if (text == ')') {
725
+ var cursor = editor.getCursorPosition();
726
+ var line = session.doc.getLine(cursor.row);
727
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
728
+ if (rightChar == ')') {
729
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
730
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
731
+ CstyleBehaviour.popAutoInsertedClosing();
732
+ return {
733
+ text: '',
734
+ selection: [1, 1]
735
+ };
736
+ }
737
+ }
738
+ }
739
+ });
740
+
741
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
742
+ var selected = session.doc.getTextRange(range);
743
+ if (!range.isMultiLine() && selected == '(') {
744
+ var line = session.doc.getLine(range.start.row);
745
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
746
+ if (rightChar == ')') {
747
+ range.end.column++;
748
+ return range;
749
+ }
750
+ }
751
+ });
752
+
753
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
754
+ if (text == '[') {
755
+ var selection = editor.getSelectionRange();
756
+ var selected = session.doc.getTextRange(selection);
757
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
758
+ return {
759
+ text: '[' + selected + ']',
760
+ selection: false
761
+ };
762
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
763
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
764
+ return {
765
+ text: '[]',
766
+ selection: [1, 1]
767
+ };
768
+ }
769
+ } else if (text == ']') {
770
+ var cursor = editor.getCursorPosition();
771
+ var line = session.doc.getLine(cursor.row);
772
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
773
+ if (rightChar == ']') {
774
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
775
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
776
+ CstyleBehaviour.popAutoInsertedClosing();
777
+ return {
778
+ text: '',
779
+ selection: [1, 1]
780
+ };
781
+ }
782
+ }
783
+ }
784
+ });
785
+
786
+ this.add("brackets", "deletion", function (state, action, editor, session, range) {
787
+ var selected = session.doc.getTextRange(range);
788
+ if (!range.isMultiLine() && selected == '[') {
789
+ var line = session.doc.getLine(range.start.row);
790
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
791
+ if (rightChar == ']') {
792
+ range.end.column++;
793
+ return range;
794
+ }
795
+ }
796
+ });
797
+
798
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
799
+ if (text == '"' || text == "'") {
800
+ var quote = text;
801
+ var selection = editor.getSelectionRange();
802
+ var selected = session.doc.getTextRange(selection);
803
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
804
+ return {
805
+ text: quote + selected + quote,
806
+ selection: false
807
+ };
808
+ } else {
809
+ var cursor = editor.getCursorPosition();
810
+ var line = session.doc.getLine(cursor.row);
811
+ var leftChar = line.substring(cursor.column-1, cursor.column);
812
+ if (leftChar == '\\') {
813
+ return null;
814
+ }
815
+ var tokens = session.getTokens(selection.start.row);
816
+ var col = 0, token;
817
+ var quotepos = -1; // Track whether we're inside an open quote.
818
+
819
+ for (var x = 0; x < tokens.length; x++) {
820
+ token = tokens[x];
821
+ if (token.type == "string") {
822
+ quotepos = -1;
823
+ } else if (quotepos < 0) {
824
+ quotepos = token.value.indexOf(quote);
825
+ }
826
+ if ((token.value.length + col) > selection.start.column) {
827
+ break;
828
+ }
829
+ col += tokens[x].value.length;
830
+ }
831
+ 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)))) {
832
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
833
+ return;
834
+ return {
835
+ text: quote + quote,
836
+ selection: [1,1]
837
+ };
838
+ } else if (token && token.type === "string") {
839
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
840
+ if (rightChar == quote) {
841
+ return {
842
+ text: '',
843
+ selection: [1, 1]
844
+ };
845
+ }
846
+ }
847
+ }
848
+ }
849
+ });
850
+
851
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
852
+ var selected = session.doc.getTextRange(range);
853
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
854
+ var line = session.doc.getLine(range.start.row);
855
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
856
+ if (rightChar == selected) {
857
+ range.end.column++;
858
+ return range;
859
+ }
860
+ }
861
+ });
862
+
863
+ };
864
+
865
+ oop.inherits(CstyleBehaviour, Behaviour);
866
+
867
+ exports.CstyleBehaviour = CstyleBehaviour;
868
+ });
869
+
870
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
871
+
872
+
873
+ var oop = require("../../lib/oop");
874
+ var Range = require("../../range").Range;
875
+ var BaseFoldMode = require("./fold_mode").FoldMode;
876
+
877
+ var FoldMode = exports.FoldMode = function(commentRegex) {
878
+ if (commentRegex) {
879
+ this.foldingStartMarker = new RegExp(
880
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
881
+ );
882
+ this.foldingStopMarker = new RegExp(
883
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
884
+ );
885
+ }
886
+ };
887
+ oop.inherits(FoldMode, BaseFoldMode);
888
+
889
+ (function() {
890
+
891
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
892
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
893
+
894
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
895
+ var line = session.getLine(row);
896
+ var match = line.match(this.foldingStartMarker);
897
+ if (match) {
898
+ var i = match.index;
899
+
900
+ if (match[1])
901
+ return this.openingBracketBlock(session, match[1], row, i);
902
+
903
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
904
+
905
+ if (range && !range.isMultiLine()) {
906
+ if (forceMultiline) {
907
+ range = this.getSectionRange(session, row);
908
+ } else if (foldStyle != "all")
909
+ range = null;
910
+ }
911
+
912
+ return range;
913
+ }
914
+
915
+ if (foldStyle === "markbegin")
916
+ return;
917
+
918
+ var match = line.match(this.foldingStopMarker);
919
+ if (match) {
920
+ var i = match.index + match[0].length;
921
+
922
+ if (match[1])
923
+ return this.closingBracketBlock(session, match[1], row, i);
924
+
925
+ return session.getCommentFoldRange(row, i, -1);
926
+ }
927
+ };
928
+
929
+ this.getSectionRange = function(session, row) {
930
+ var line = session.getLine(row);
931
+ var startIndent = line.search(/\S/);
932
+ var startRow = row;
933
+ var startColumn = line.length;
934
+ row = row + 1;
935
+ var endRow = row;
936
+ var maxRow = session.getLength();
937
+ while (++row < maxRow) {
938
+ line = session.getLine(row);
939
+ var indent = line.search(/\S/);
940
+ if (indent === -1)
941
+ continue;
942
+ if (startIndent > indent)
943
+ break;
944
+ var subRange = this.getFoldWidgetRange(session, "all", row);
945
+
946
+ if (subRange) {
947
+ if (subRange.start.row <= startRow) {
948
+ break;
949
+ } else if (subRange.isMultiLine()) {
950
+ row = subRange.end.row;
951
+ } else if (startIndent == indent) {
952
+ break;
953
+ }
954
+ }
955
+ endRow = row;
956
+ }
957
+
958
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
959
+ };
960
+
961
+ }).call(FoldMode.prototype);
962
+
963
+ });
964
+
965
+ define('ace/mode/sjs_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
966
+
967
+
968
+ var oop = require("../lib/oop");
969
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
970
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
971
+
972
+ var SJSHighlightRules = function() {
973
+ var parent = new JavaScriptHighlightRules();
974
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
975
+ "u[0-9a-fA-F]{4}|" + // unicode
976
+ "[0-2][0-7]{0,2}|" + // oct
977
+ "3[0-6][0-7]?|" + // oct
978
+ "37[0-7]?|" + // oct
979
+ "[4-7][0-7]?|" + //oct
980
+ ".)";
981
+
982
+ var contextAware = function(f) {
983
+ f.isContextAware = true;
984
+ return f;
985
+ };
986
+
987
+ var ctxBegin = function(opts) {
988
+ return {
989
+ token: opts.token,
990
+ regex: opts.regex,
991
+ next: contextAware(function(currentState, stack) {
992
+ if (stack.length === 0)
993
+ stack.unshift(currentState);
994
+ stack.unshift(opts.next);
995
+ return opts.next;
996
+ }),
997
+ };
998
+ };
999
+
1000
+ var ctxEnd = function(opts) {
1001
+ return {
1002
+ token: opts.token,
1003
+ regex: opts.regex,
1004
+ next: contextAware(function(currentState, stack) {
1005
+ stack.shift();
1006
+ return stack[0] || "start";
1007
+ }),
1008
+ };
1009
+ };
1010
+
1011
+ this.$rules = parent.$rules;
1012
+ this.$rules.no_regex = [
1013
+ {
1014
+ token: "keyword",
1015
+ regex: "(waitfor|or|and|collapse|spawn|retract)\\b"
1016
+ },
1017
+ {
1018
+ token: "keyword.operator",
1019
+ regex: "(->|=>|\\.\\.)"
1020
+ },
1021
+ {
1022
+ token: "variable.language",
1023
+ regex: "(hold|default)\\b"
1024
+ },
1025
+ ctxBegin({
1026
+ token: "string",
1027
+ regex: "`",
1028
+ next: "bstring"
1029
+ }),
1030
+ ctxBegin({
1031
+ token: "string",
1032
+ regex: '"',
1033
+ next: "qqstring"
1034
+ }),
1035
+ ctxBegin({
1036
+ token: "string",
1037
+ regex: '"',
1038
+ next: "qqstring"
1039
+ }),
1040
+ {
1041
+ token: ["paren.lparen", "text", "paren.rparen"],
1042
+ regex: "(\\{)(\\s*)(\\|)",
1043
+ next: "block_arguments",
1044
+ }
1045
+
1046
+ ].concat(this.$rules.no_regex);
1047
+
1048
+ this.$rules.block_arguments = [
1049
+ {
1050
+ token: "paren.rparen",
1051
+ regex: "\\|",
1052
+ next: "no_regex",
1053
+ }
1054
+ ].concat(this.$rules.function_arguments);
1055
+
1056
+ this.$rules.bstring = [
1057
+ {
1058
+ token : "constant.language.escape",
1059
+ regex : escapedRe
1060
+ },
1061
+ {
1062
+ token : "string",
1063
+ regex : "\\\\$",
1064
+ next: "bstring"
1065
+ },
1066
+ ctxBegin({
1067
+ token : "paren.lparen",
1068
+ regex : "\\$\\{",
1069
+ next: "string_interp"
1070
+ }),
1071
+ ctxBegin({
1072
+ token : "paren.lparen",
1073
+ regex : "\\$",
1074
+ next: "bstring_interp_single"
1075
+ }),
1076
+ ctxEnd({
1077
+ token : "string",
1078
+ regex : "`",
1079
+ }),
1080
+ {
1081
+ defaultToken: "string"
1082
+ }
1083
+ ];
1084
+
1085
+ this.$rules.qqstring = [
1086
+ {
1087
+ token : "constant.language.escape",
1088
+ regex : escapedRe
1089
+ },
1090
+ {
1091
+ token : "string",
1092
+ regex : "\\\\$",
1093
+ next: "qqstring",
1094
+ },
1095
+ ctxBegin({
1096
+ token : "paren.lparen",
1097
+ regex : "#\\{",
1098
+ next: "string_interp"
1099
+ }),
1100
+ ctxEnd({
1101
+ token : "string",
1102
+ regex : '"',
1103
+ }),
1104
+ {
1105
+ defaultToken: "string"
1106
+ }
1107
+ ];
1108
+ var embeddableRules = [];
1109
+ for (var i=0; i<this.$rules.no_regex.length; i++) {
1110
+ var rule = this.$rules.no_regex[i];
1111
+ var token = String(rule.token);
1112
+ if(token.indexOf('paren') == -1 && (!rule.next || rule.next.isContextAware)) {
1113
+ embeddableRules.push(rule);
1114
+ }
1115
+ };
1116
+
1117
+ this.$rules.string_interp = [
1118
+ ctxEnd({
1119
+ token: "paren.rparen",
1120
+ regex: "\\}"
1121
+ }),
1122
+ ctxBegin({
1123
+ token: "paren.lparen",
1124
+ regex: '{',
1125
+ next: "string_interp"
1126
+ })
1127
+ ].concat(embeddableRules);
1128
+ this.$rules.bstring_interp_single = [
1129
+ {
1130
+ token: ["identifier", "paren.lparen"],
1131
+ regex: '(\\w+)(\\()',
1132
+ next: 'bstring_interp_single_call'
1133
+ },
1134
+ ctxEnd({
1135
+ token : "identifier",
1136
+ regex : "\\w*",
1137
+ })
1138
+ ];
1139
+ this.$rules.bstring_interp_single_call = [
1140
+ ctxBegin({
1141
+ token: "paren.lparen",
1142
+ regex: "\\(",
1143
+ next: "bstring_interp_single_call"
1144
+ }),
1145
+ ctxEnd({
1146
+ token: "paren.rparen",
1147
+ regex: "\\)"
1148
+ })
1149
+ ].concat(embeddableRules);
1150
+ }
1151
+ oop.inherits(SJSHighlightRules, TextHighlightRules);
1152
+
1153
+ exports.SJSHighlightRules = SJSHighlightRules;
1154
+ });