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,42 +1,34 @@
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.
8
6
  *
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.
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.
13
17
  *
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
- * Fabian Jakobs <fabian AT ajax DOT org>
23
- * Shlomo Zalman Heigh <shlomozalmanheigh AT gmail DOT com>
24
- *
25
- * Alternatively, the contents of this file may be used under the terms of
26
- * either the GNU General Public License Version 2 or later (the "GPL"), or
27
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
- * in which case the provisions of the GPL or the LGPL are applicable instead
29
- * of those above. If you wish to allow use of your version of this file only
30
- * under the terms of either the GPL or the LGPL, and not to allow others to
31
- * use your version of this file under the terms of the MPL, indicate your
32
- * decision by deleting the provisions above and replace them with the notice
33
- * and other provisions required by the GPL or the LGPL. If you do not delete
34
- * the provisions above, a recipient may use your version of this file under
35
- * the terms of any one of the MPL, the GPL or the LGPL.
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.
36
28
  *
37
29
  * ***** END LICENSE BLOCK ***** */
38
30
 
39
- define('ace/mode/ruby', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ruby_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) {
31
+ define('ace/mode/ruby', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/ruby_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/folding/coffee'], function(require, exports, module) {
40
32
 
41
33
 
42
34
  var oop = require("../lib/oop");
@@ -45,56 +37,36 @@ var Tokenizer = require("../tokenizer").Tokenizer;
45
37
  var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
46
38
  var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
47
39
  var Range = require("../range").Range;
40
+ var FoldMode = require("./folding/coffee").FoldMode;
48
41
 
49
42
  var Mode = function() {
50
- this.$tokenizer = new Tokenizer(new RubyHighlightRules().getRules());
43
+ this.HighlightRules = RubyHighlightRules;
51
44
  this.$outdent = new MatchingBraceOutdent();
45
+ this.foldingRules = new FoldMode();
52
46
  };
53
47
  oop.inherits(Mode, TextMode);
54
48
 
55
49
  (function() {
56
50
 
57
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
58
- var outdent = true;
59
- var re = /^(\s*)#/;
60
51
 
61
- for (var i=startRow; i<= endRow; i++) {
62
- if (!re.test(doc.getLine(i))) {
63
- outdent = false;
64
- break;
65
- }
66
- }
67
-
68
- if (outdent) {
69
- var deleteRange = new Range(0, 0, 0, 0);
70
- for (var i=startRow; i<= endRow; i++)
71
- {
72
- var line = doc.getLine(i);
73
- var m = line.match(re);
74
- deleteRange.start.row = i;
75
- deleteRange.end.row = i;
76
- deleteRange.end.column = m[0].length;
77
- doc.replace(deleteRange, m[1]);
78
- }
79
- }
80
- else {
81
- doc.indentRows(startRow, endRow, "#");
82
- }
83
- };
52
+ this.lineCommentStart = "#";
84
53
 
85
54
  this.getNextLineIndent = function(state, line, tab) {
86
55
  var indent = this.$getIndent(line);
87
56
 
88
- var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
57
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
89
58
  var tokens = tokenizedLine.tokens;
90
59
 
91
60
  if (tokens.length && tokens[tokens.length-1].type == "comment") {
92
61
  return indent;
93
62
  }
94
-
63
+
95
64
  if (state == "start") {
96
65
  var match = line.match(/^.*[\{\(\[]\s*$/);
97
- if (match) {
66
+ var startingClassOrMethod = line.match(/^\s*(class|def)\s.*$/);
67
+ var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
68
+ var startingConditional = line.match(/^\s*(if|else)\s*/)
69
+ if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
98
70
  indent += tab;
99
71
  }
100
72
  }
@@ -103,30 +75,62 @@ oop.inherits(Mode, TextMode);
103
75
  };
104
76
 
105
77
  this.checkOutdent = function(state, line, input) {
106
- return this.$outdent.checkOutdent(line, input);
78
+ return /^\s+end$/.test(line + input) || /^\s+}$/.test(line + input) || /^\s+else$/.test(line + input);
107
79
  };
108
80
 
109
81
  this.autoOutdent = function(state, doc, row) {
110
- this.$outdent.autoOutdent(doc, row);
82
+ var indent = this.$getIndent(doc.getLine(row));
83
+ var tab = doc.getTabString();
84
+ if (indent.slice(-tab.length) == tab)
85
+ doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
111
86
  };
112
87
 
88
+ this.$id = "ace/mode/ruby";
113
89
  }).call(Mode.prototype);
114
90
 
115
91
  exports.Mode = Mode;
116
92
  });
117
93
 
118
- define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
94
+ define('ace/mode/ruby_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
119
95
 
120
96
 
121
97
  var oop = require("../lib/oop");
122
- var lang = require("../lib/lang");
123
98
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
99
+ var constantOtherSymbol = exports.constantOtherSymbol = {
100
+ token : "constant.other.symbol.ruby", // symbol
101
+ regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
102
+ };
103
+
104
+ var qString = exports.qString = {
105
+ token : "string", // single line
106
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
107
+ };
108
+
109
+ var qqString = exports.qqString = {
110
+ token : "string", // single line
111
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
112
+ };
113
+
114
+ var tString = exports.tString = {
115
+ token : "string", // backtick string
116
+ regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
117
+ };
118
+
119
+ var constantNumericHex = exports.constantNumericHex = {
120
+ token : "constant.numeric", // hex
121
+ regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
122
+ };
123
+
124
+ var constantNumericFloat = exports.constantNumericFloat = {
125
+ token : "constant.numeric", // float
126
+ regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
127
+ };
124
128
 
125
129
  var RubyHighlightRules = function() {
126
130
 
127
- var builtinFunctions = lang.arrayToMap(
128
- ("abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
129
- "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
131
+ var builtinFunctions = (
132
+ "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
133
+ "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
130
134
  "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
131
135
  "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
132
136
  "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
@@ -134,7 +138,7 @@ var RubyHighlightRules = function() {
134
138
  "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
135
139
  "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
136
140
  "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
137
- "gsub!|get_via_redirect|h|host!|https?|https!|include|Integer|lambda|link_to|" +
141
+ "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
138
142
  "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
139
143
  "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
140
144
  "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
@@ -152,29 +156,34 @@ var RubyHighlightRules = function() {
152
156
  "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
153
157
  "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
154
158
  "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
155
- "translate|localize|extract_locale_from_tld|t|l|caches_page|expire_page|caches_action|expire_action|" +
159
+ "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
156
160
  "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
157
- "has_many|has_one|belongs_to|has_and_belongs_to_many").split("|")
161
+ "has_many|has_one|belongs_to|has_and_belongs_to_many"
158
162
  );
159
163
 
160
- var keywords = lang.arrayToMap(
161
- ("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
162
- "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
163
- "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield").split("|")
164
+ var keywords = (
165
+ "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
166
+ "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
167
+ "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
164
168
  );
165
169
 
166
- var buildinConstants = lang.arrayToMap(
167
- ("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
168
- "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING").split("|")
170
+ var buildinConstants = (
171
+ "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
172
+ "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
169
173
  );
170
174
 
171
- var builtinVariables = lang.arrayToMap(
172
- ("\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
173
- "$!|root_url|flash|session|cookies|params|request|response|logger").split("|")
175
+ var builtinVariables = (
176
+ "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
177
+ "$!|root_url|flash|session|cookies|params|request|response|logger|self"
174
178
  );
175
179
 
176
- // regexp must not have capturing parentheses. Use (?:) instead.
177
- // regexps are ordered -> the first match is used
180
+ var keywordMapper = this.$keywords = this.createKeywordMapper({
181
+ "keyword": keywords,
182
+ "constant.language": buildinConstants,
183
+ "variable.language": builtinVariables,
184
+ "support.function": builtinFunctions,
185
+ "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
186
+ }, "identifier");
178
187
 
179
188
  this.$rules = {
180
189
  "start" : [
@@ -183,62 +192,96 @@ var RubyHighlightRules = function() {
183
192
  regex : "#.*$"
184
193
  }, {
185
194
  token : "comment", // multi line comment
186
- merge : true,
187
- regex : "^\=begin$",
195
+ regex : "^=begin(?:$|\\s.*$)",
188
196
  next : "comment"
189
197
  }, {
190
198
  token : "string.regexp",
191
199
  regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
192
- }, {
193
- token : "string", // single line
194
- regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
195
- }, {
196
- token : "string", // single line
197
- regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
198
- }, {
199
- token : "string", // backtick string
200
- regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
201
- }, {
200
+ },
201
+
202
+ qString,
203
+ qqString,
204
+ tString,
205
+
206
+ {
202
207
  token : "text", // namespaces aren't symbols
203
208
  regex : "::"
204
209
  }, {
205
- token : "variable.instancce", // instance variable
206
- regex : "@{1,2}(?:[a-zA-Z_]|\d)+"
207
- }, {
208
- token : "variable.class", // class name
209
- regex : "[A-Z](?:[a-zA-Z_]|\d)+"
210
- }, {
211
- token : "string", // symbol
212
- regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
213
- }, {
214
- token : "constant.numeric", // hex
215
- regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
216
- }, {
217
- token : "constant.numeric", // float
218
- regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
210
+ token : "variable.instance", // instance variable
211
+ regex : "@{1,2}[a-zA-Z_\\d]+"
219
212
  }, {
213
+ token : "support.class", // class name
214
+ regex : "[A-Z][a-zA-Z_\\d]+"
215
+ },
216
+
217
+ constantOtherSymbol,
218
+ constantNumericHex,
219
+ constantNumericFloat,
220
+
221
+ {
220
222
  token : "constant.language.boolean",
221
223
  regex : "(?:true|false)\\b"
222
224
  }, {
223
- token : function(value) {
224
- if (value == "self")
225
- return "variable.language";
226
- else if (keywords.hasOwnProperty(value))
227
- return "keyword";
228
- else if (buildinConstants.hasOwnProperty(value))
229
- return "constant.language";
230
- else if (builtinVariables.hasOwnProperty(value))
231
- return "variable.language";
232
- else if (builtinFunctions.hasOwnProperty(value))
233
- return "support.function";
234
- else if (value == "debugger")
235
- return "invalid.deprecated";
236
- else
237
- return "identifier";
238
- },
239
- // TODO: Unicode escape sequences
240
- // TODO: Unicode identifiers
225
+ token : keywordMapper,
241
226
  regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
227
+ }, {
228
+ token : "punctuation.separator.key-value",
229
+ regex : "=>"
230
+ }, {
231
+ stateName: "heredoc",
232
+ onMatch : function(value, currentState, stack) {
233
+ var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
234
+ var tokens = value.split(this.splitRegex);
235
+ stack.push(next, tokens[3]);
236
+ return [
237
+ {type:"constant", value: tokens[1]},
238
+ {type:"string", value: tokens[2]},
239
+ {type:"support.class", value: tokens[3]},
240
+ {type:"string", value: tokens[4]}
241
+ ];
242
+ },
243
+ regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
244
+ rules: {
245
+ heredoc: [{
246
+ onMatch: function(value, currentState, stack) {
247
+ if (value === stack[1]) {
248
+ stack.shift();
249
+ stack.shift();
250
+ this.next = stack[0] || "start";
251
+ return "support.class";
252
+ }
253
+ this.next = "";
254
+ return "string";
255
+ },
256
+ regex: ".*$",
257
+ next: "start"
258
+ }],
259
+ indentedHeredoc: [{
260
+ token: "string",
261
+ regex: "^ +"
262
+ }, {
263
+ onMatch: function(value, currentState, stack) {
264
+ if (value === stack[1]) {
265
+ stack.shift();
266
+ stack.shift();
267
+ this.next = stack[0] || "start";
268
+ return "support.class";
269
+ }
270
+ this.next = "";
271
+ return "string";
272
+ },
273
+ regex: ".*$",
274
+ next: "start"
275
+ }]
276
+ }
277
+ }, {
278
+ regex : "$",
279
+ token : "empty",
280
+ next : function(currentState, stack) {
281
+ if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
282
+ return stack[0];
283
+ return currentState;
284
+ }
242
285
  }, {
243
286
  token : "keyword.operator",
244
287
  regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
@@ -256,15 +299,16 @@ var RubyHighlightRules = function() {
256
299
  "comment" : [
257
300
  {
258
301
  token : "comment", // closing comment
259
- regex : "^\=end$",
302
+ regex : "^=end(?:$|\\s.*$)",
260
303
  next : "start"
261
304
  }, {
262
305
  token : "comment", // comment spanning whole line
263
- merge : true,
264
306
  regex : ".+"
265
307
  }
266
308
  ]
267
309
  };
310
+
311
+ this.normalizeRules();
268
312
  };
269
313
 
270
314
  oop.inherits(RubyHighlightRules, TextHighlightRules);
@@ -304,15 +348,97 @@ var MatchingBraceOutdent = function() {};
304
348
  };
305
349
 
306
350
  this.$getIndent = function(line) {
307
- var match = line.match(/^(\s+)/);
308
- if (match) {
309
- return match[1];
310
- }
311
-
312
- return "";
351
+ return line.match(/^\s*/)[0];
313
352
  };
314
353
 
315
354
  }).call(MatchingBraceOutdent.prototype);
316
355
 
317
356
  exports.MatchingBraceOutdent = MatchingBraceOutdent;
318
357
  });
358
+
359
+ define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
360
+
361
+
362
+ var oop = require("../../lib/oop");
363
+ var BaseFoldMode = require("./fold_mode").FoldMode;
364
+ var Range = require("../../range").Range;
365
+
366
+ var FoldMode = exports.FoldMode = function() {};
367
+ oop.inherits(FoldMode, BaseFoldMode);
368
+
369
+ (function() {
370
+
371
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
372
+ var range = this.indentationBlock(session, row);
373
+ if (range)
374
+ return range;
375
+
376
+ var re = /\S/;
377
+ var line = session.getLine(row);
378
+ var startLevel = line.search(re);
379
+ if (startLevel == -1 || line[startLevel] != "#")
380
+ return;
381
+
382
+ var startColumn = line.length;
383
+ var maxRow = session.getLength();
384
+ var startRow = row;
385
+ var endRow = row;
386
+
387
+ while (++row < maxRow) {
388
+ line = session.getLine(row);
389
+ var level = line.search(re);
390
+
391
+ if (level == -1)
392
+ continue;
393
+
394
+ if (line[level] != "#")
395
+ break;
396
+
397
+ endRow = row;
398
+ }
399
+
400
+ if (endRow > startRow) {
401
+ var endColumn = session.getLine(endRow).length;
402
+ return new Range(startRow, startColumn, endRow, endColumn);
403
+ }
404
+ };
405
+ this.getFoldWidget = function(session, foldStyle, row) {
406
+ var line = session.getLine(row);
407
+ var indent = line.search(/\S/);
408
+ var next = session.getLine(row + 1);
409
+ var prev = session.getLine(row - 1);
410
+ var prevIndent = prev.search(/\S/);
411
+ var nextIndent = next.search(/\S/);
412
+
413
+ if (indent == -1) {
414
+ session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
415
+ return "";
416
+ }
417
+ if (prevIndent == -1) {
418
+ if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
419
+ session.foldWidgets[row - 1] = "";
420
+ session.foldWidgets[row + 1] = "";
421
+ return "start";
422
+ }
423
+ } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
424
+ if (session.getLine(row - 2).search(/\S/) == -1) {
425
+ session.foldWidgets[row - 1] = "start";
426
+ session.foldWidgets[row + 1] = "";
427
+ return "";
428
+ }
429
+ }
430
+
431
+ if (prevIndent!= -1 && prevIndent < indent)
432
+ session.foldWidgets[row - 1] = "start";
433
+ else
434
+ session.foldWidgets[row - 1] = "";
435
+
436
+ if (indent < nextIndent)
437
+ return "start";
438
+ else
439
+ return "";
440
+ };
441
+
442
+ }).call(FoldMode.prototype);
443
+
444
+ });