codemirror-rails 3.24 → 4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codemirror/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/codemirror.js +3001 -1798
  4. data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +24 -4
  5. data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +47 -32
  6. data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +9 -2
  7. data/vendor/assets/javascripts/codemirror/addons/display/fullscreen.js +9 -2
  8. data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +9 -2
  9. data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +9 -2
  10. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +76 -37
  11. data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +59 -37
  12. data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +25 -17
  13. data/vendor/assets/javascripts/codemirror/addons/edit/matchbrackets.js +67 -46
  14. data/vendor/assets/javascripts/codemirror/addons/edit/matchtags.js +10 -3
  15. data/vendor/assets/javascripts/codemirror/addons/edit/trailingspace.js +23 -14
  16. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +12 -3
  17. data/vendor/assets/javascripts/codemirror/addons/fold/comment-fold.js +12 -0
  18. data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +28 -3
  19. data/vendor/assets/javascripts/codemirror/addons/fold/foldgutter.js +9 -2
  20. data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +12 -1
  21. data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +12 -0
  22. data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +9 -4
  23. data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +9 -2
  24. data/vendor/assets/javascripts/codemirror/addons/hint/css-hint.js +10 -3
  25. data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +11 -3
  26. data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +9 -4
  27. data/vendor/assets/javascripts/codemirror/addons/hint/python-hint.js +11 -3
  28. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +10 -4
  29. data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +9 -2
  30. data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +22 -34
  31. data/vendor/assets/javascripts/codemirror/addons/lint/coffeescript-lint.js +12 -1
  32. data/vendor/assets/javascripts/codemirror/addons/lint/css-lint.js +12 -1
  33. data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +9 -4
  34. data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +12 -1
  35. data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +12 -8
  36. data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +12 -1
  37. data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +18 -16
  38. data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +9 -2
  39. data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +12 -0
  40. data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +15 -10
  41. data/vendor/assets/javascripts/codemirror/addons/runmode/colorize.js +11 -3
  42. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode-standalone.js +0 -2
  43. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.js +12 -0
  44. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +4 -0
  45. data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +9 -2
  46. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +12 -3
  47. data/vendor/assets/javascripts/codemirror/addons/search/search.js +24 -16
  48. data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +21 -2
  49. data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +38 -17
  50. data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +16 -9
  51. data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +33 -5
  52. data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +27 -2
  53. data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +12 -5
  54. data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +505 -0
  55. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +138 -179
  56. data/vendor/assets/javascripts/codemirror/modes/apl.js +12 -0
  57. data/vendor/assets/javascripts/codemirror/modes/asterisk.js +12 -0
  58. data/vendor/assets/javascripts/codemirror/modes/clike.js +15 -4
  59. data/vendor/assets/javascripts/codemirror/modes/clojure.js +13 -0
  60. data/vendor/assets/javascripts/codemirror/modes/cobol.js +12 -0
  61. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +12 -0
  62. data/vendor/assets/javascripts/codemirror/modes/commonlisp.js +12 -0
  63. data/vendor/assets/javascripts/codemirror/modes/css.js +18 -27
  64. data/vendor/assets/javascripts/codemirror/modes/d.js +12 -2
  65. data/vendor/assets/javascripts/codemirror/modes/diff.js +12 -0
  66. data/vendor/assets/javascripts/codemirror/modes/dtd.js +12 -0
  67. data/vendor/assets/javascripts/codemirror/modes/ecl.js +12 -0
  68. data/vendor/assets/javascripts/codemirror/modes/eiffel.js +12 -0
  69. data/vendor/assets/javascripts/codemirror/modes/erlang.js +13 -1
  70. data/vendor/assets/javascripts/codemirror/modes/fortran.js +12 -0
  71. data/vendor/assets/javascripts/codemirror/modes/gas.js +12 -0
  72. data/vendor/assets/javascripts/codemirror/modes/gfm.js +12 -0
  73. data/vendor/assets/javascripts/codemirror/modes/gherkin.js +12 -0
  74. data/vendor/assets/javascripts/codemirror/modes/go.js +12 -1
  75. data/vendor/assets/javascripts/codemirror/modes/groovy.js +12 -0
  76. data/vendor/assets/javascripts/codemirror/modes/haml.js +12 -0
  77. data/vendor/assets/javascripts/codemirror/modes/haskell.js +12 -0
  78. data/vendor/assets/javascripts/codemirror/modes/haxe.js +18 -9
  79. data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +12 -0
  80. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +12 -0
  81. data/vendor/assets/javascripts/codemirror/modes/http.js +12 -0
  82. data/vendor/assets/javascripts/codemirror/modes/jade.js +12 -0
  83. data/vendor/assets/javascripts/codemirror/modes/javascript.js +23 -16
  84. data/vendor/assets/javascripts/codemirror/modes/jinja2.js +53 -118
  85. data/vendor/assets/javascripts/codemirror/modes/julia.js +12 -0
  86. data/vendor/assets/javascripts/codemirror/modes/livescript.js +17 -4
  87. data/vendor/assets/javascripts/codemirror/modes/lua.js +12 -0
  88. data/vendor/assets/javascripts/codemirror/modes/markdown.js +12 -0
  89. data/vendor/assets/javascripts/codemirror/modes/mirc.js +13 -0
  90. data/vendor/assets/javascripts/codemirror/modes/mllike.js +12 -1
  91. data/vendor/assets/javascripts/codemirror/modes/nginx.js +12 -0
  92. data/vendor/assets/javascripts/codemirror/modes/ntriples.js +13 -0
  93. data/vendor/assets/javascripts/codemirror/modes/octave.js +12 -0
  94. data/vendor/assets/javascripts/codemirror/modes/pascal.js +12 -0
  95. data/vendor/assets/javascripts/codemirror/modes/pegjs.js +12 -0
  96. data/vendor/assets/javascripts/codemirror/modes/perl.js +84 -73
  97. data/vendor/assets/javascripts/codemirror/modes/php.js +20 -101
  98. data/vendor/assets/javascripts/codemirror/modes/pig.js +12 -0
  99. data/vendor/assets/javascripts/codemirror/modes/properties.js +12 -0
  100. data/vendor/assets/javascripts/codemirror/modes/puppet.js +13 -0
  101. data/vendor/assets/javascripts/codemirror/modes/python.js +21 -11
  102. data/vendor/assets/javascripts/codemirror/modes/q.js +12 -0
  103. data/vendor/assets/javascripts/codemirror/modes/r.js +13 -3
  104. data/vendor/assets/javascripts/codemirror/modes/{rpm-spec.js → rpm.js} +34 -2
  105. data/vendor/assets/javascripts/codemirror/modes/rst.js +12 -0
  106. data/vendor/assets/javascripts/codemirror/modes/ruby.js +11 -0
  107. data/vendor/assets/javascripts/codemirror/modes/rust.js +12 -0
  108. data/vendor/assets/javascripts/codemirror/modes/sass.js +12 -0
  109. data/vendor/assets/javascripts/codemirror/modes/scheme.js +13 -0
  110. data/vendor/assets/javascripts/codemirror/modes/shell.js +12 -0
  111. data/vendor/assets/javascripts/codemirror/modes/sieve.js +11 -4
  112. data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +12 -0
  113. data/vendor/assets/javascripts/codemirror/modes/smarty.js +13 -0
  114. data/vendor/assets/javascripts/codemirror/modes/smartymixed.js +14 -2
  115. data/vendor/assets/javascripts/codemirror/modes/solr.js +12 -0
  116. data/vendor/assets/javascripts/codemirror/modes/sparql.js +12 -0
  117. data/vendor/assets/javascripts/codemirror/modes/sql.js +12 -0
  118. data/vendor/assets/javascripts/codemirror/modes/stex.js +12 -0
  119. data/vendor/assets/javascripts/codemirror/modes/tcl.js +13 -0
  120. data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +13 -0
  121. data/vendor/assets/javascripts/codemirror/modes/tiki.js +12 -0
  122. data/vendor/assets/javascripts/codemirror/modes/toml.js +12 -0
  123. data/vendor/assets/javascripts/codemirror/modes/turtle.js +12 -0
  124. data/vendor/assets/javascripts/codemirror/modes/vb.js +12 -0
  125. data/vendor/assets/javascripts/codemirror/modes/vbscript.js +13 -0
  126. data/vendor/assets/javascripts/codemirror/modes/velocity.js +12 -0
  127. data/vendor/assets/javascripts/codemirror/modes/verilog.js +89 -236
  128. data/vendor/assets/javascripts/codemirror/modes/xml.js +41 -60
  129. data/vendor/assets/javascripts/codemirror/modes/xquery.js +12 -0
  130. data/vendor/assets/javascripts/codemirror/modes/yaml.js +12 -0
  131. data/vendor/assets/javascripts/codemirror/modes/z80.js +12 -0
  132. data/vendor/assets/stylesheets/codemirror.css +15 -10
  133. data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +1 -0
  134. data/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css +4 -0
  135. data/vendor/assets/stylesheets/codemirror/themes/mdn-like.css +1 -1
  136. data/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css +1 -0
  137. data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +2 -0
  138. data/vendor/assets/stylesheets/codemirror/themes/solarized.css +17 -3
  139. metadata +20 -25
  140. data/vendor/assets/javascripts/codemirror/keymaps/extra.js +0 -43
  141. data/vendor/assets/javascripts/codemirror/modes/django.js +0 -55
  142. data/vendor/assets/javascripts/codemirror/modes/dylan.js +0 -284
  143. data/vendor/assets/javascripts/codemirror/modes/less.js +0 -347
  144. data/vendor/assets/javascripts/codemirror/modes/rpm-changes.js +0 -19
  145. data/vendor/assets/stylesheets/codemirror/modes/rpm-spec.css +0 -5
@@ -1,3 +1,13 @@
1
+ (function(mod) {
2
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
3
+ mod(require("../../lib/codemirror"));
4
+ else if (typeof define == "function" && define.amd) // AMD
5
+ define(["../../lib/codemirror"], mod);
6
+ else // Plain browser env
7
+ mod(CodeMirror);
8
+ })(function(CodeMirror) {
9
+ "use strict";
10
+
1
11
  CodeMirror.defineMode("julia", function(_conf, parserConf) {
2
12
  var ERRORCLASS = 'error';
3
13
 
@@ -284,3 +294,5 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
284
294
 
285
295
 
286
296
  CodeMirror.defineMIME("text/x-julia", "julia");
297
+
298
+ });
@@ -2,6 +2,17 @@
2
2
  * Link to the project's GitHub page:
3
3
  * https://github.com/duralog/CodeMirror
4
4
  */
5
+
6
+ (function(mod) {
7
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
8
+ mod(require("../../lib/codemirror"));
9
+ else if (typeof define == "function" && define.amd) // AMD
10
+ define(["../../lib/codemirror"], mod);
11
+ else // Plain browser env
12
+ mod(CodeMirror);
13
+ })(function(CodeMirror) {
14
+ "use strict";
15
+
5
16
  (function() {
6
17
  CodeMirror.defineMode('livescript', function(){
7
18
  var tokenBase, external;
@@ -13,7 +24,7 @@
13
24
  for (i$ = 0, len$ = nr.length; i$ < len$; ++i$) {
14
25
  r = nr[i$];
15
26
  if (r.regex && (m = stream.match(r.regex))) {
16
- state.next = r.next || state.next;
27
+ state.next = r.next;
17
28
  return r.token;
18
29
  }
19
30
  }
@@ -192,7 +203,7 @@
192
203
  next: 'start'
193
204
  }, {
194
205
  token: 'text',
195
- regex: '',
206
+ regex: '.',
196
207
  next: 'start'
197
208
  }
198
209
  ],
@@ -254,14 +265,16 @@
254
265
  if (Array.isArray(r)) {
255
266
  for (var i = 0, len = r.length; i < len; ++i) {
256
267
  var rr = r[i];
257
- if (typeof rr.regex === 'string') {
268
+ if (rr.regex) {
258
269
  Rules[idx][i].regex = new RegExp('^' + rr.regex);
259
270
  }
260
271
  }
261
- } else if (typeof rr.regex === 'string') {
272
+ } else if (r.regex) {
262
273
  Rules[idx].regex = new RegExp('^' + r.regex);
263
274
  }
264
275
  }
265
276
  })();
266
277
 
267
278
  CodeMirror.defineMIME('text/x-livescript', 'livescript');
279
+
280
+ });
@@ -2,6 +2,16 @@
2
2
  // CodeMirror 1 mode.
3
3
  // highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
4
4
 
5
+ (function(mod) {
6
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
7
+ mod(require("../../lib/codemirror"));
8
+ else if (typeof define == "function" && define.amd) // AMD
9
+ define(["../../lib/codemirror"], mod);
10
+ else // Plain browser env
11
+ mod(CodeMirror);
12
+ })(function(CodeMirror) {
13
+ "use strict";
14
+
5
15
  CodeMirror.defineMode("lua", function(config, parserConfig) {
6
16
  var indentUnit = config.indentUnit;
7
17
 
@@ -142,3 +152,5 @@ CodeMirror.defineMode("lua", function(config, parserConfig) {
142
152
  });
143
153
 
144
154
  CodeMirror.defineMIME("text/x-lua", "lua");
155
+
156
+ });
@@ -1,3 +1,13 @@
1
+ (function(mod) {
2
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
3
+ mod(require("../../lib/codemirror", require("../xml/xml")));
4
+ else if (typeof define == "function" && define.amd) // AMD
5
+ define(["../../lib/codemirror", "../xml/xml"], mod);
6
+ else // Plain browser env
7
+ mod(CodeMirror);
8
+ })(function(CodeMirror) {
9
+ "use strict";
10
+
1
11
  CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
2
12
 
3
13
  var htmlFound = CodeMirror.modes.hasOwnProperty("xml");
@@ -746,3 +756,5 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
746
756
  }, "xml");
747
757
 
748
758
  CodeMirror.defineMIME("text/x-markdown", "markdown");
759
+
760
+ });
@@ -1,4 +1,15 @@
1
1
  //mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
2
+
3
+ (function(mod) {
4
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
5
+ mod(require("../../lib/codemirror"));
6
+ else if (typeof define == "function" && define.amd) // AMD
7
+ define(["../../lib/codemirror"], mod);
8
+ else // Plain browser env
9
+ mod(CodeMirror);
10
+ })(function(CodeMirror) {
11
+ "use strict";
12
+
2
13
  CodeMirror.defineMIME("text/mirc", "mirc");
3
14
  CodeMirror.defineMode("mirc", function() {
4
15
  function parseWords(str) {
@@ -175,3 +186,5 @@ CodeMirror.defineMode("mirc", function() {
175
186
  }
176
187
  };
177
188
  });
189
+
190
+ });
@@ -1,5 +1,14 @@
1
- CodeMirror.defineMode('mllike', function(_config, parserConfig) {
1
+ (function(mod) {
2
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
3
+ mod(require("../../lib/codemirror"));
4
+ else if (typeof define == "function" && define.amd) // AMD
5
+ define(["../../lib/codemirror"], mod);
6
+ else // Plain browser env
7
+ mod(CodeMirror);
8
+ })(function(CodeMirror) {
9
+ "use strict";
2
10
 
11
+ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
3
12
  var words = {
4
13
  'let': 'keyword',
5
14
  'rec': 'keyword',
@@ -189,3 +198,5 @@ CodeMirror.defineMIME('text/x-fsharp', {
189
198
  },
190
199
  slashComments: true
191
200
  });
201
+
202
+ });
@@ -1,3 +1,13 @@
1
+ (function(mod) {
2
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
3
+ mod(require("../../lib/codemirror"));
4
+ else if (typeof define == "function" && define.amd) // AMD
5
+ define(["../../lib/codemirror"], mod);
6
+ else // Plain browser env
7
+ mod(CodeMirror);
8
+ })(function(CodeMirror) {
9
+ "use strict";
10
+
1
11
  CodeMirror.defineMode("nginx", function(config) {
2
12
 
3
13
  function words(str) {
@@ -161,3 +171,5 @@ CodeMirror.defineMode("nginx", function(config) {
161
171
  });
162
172
 
163
173
  CodeMirror.defineMIME("text/nginx", "text/x-nginx-conf");
174
+
175
+ });
@@ -25,6 +25,17 @@
25
25
  -> ERROR
26
26
  }
27
27
  */
28
+
29
+ (function(mod) {
30
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
31
+ mod(require("../../lib/codemirror"));
32
+ else if (typeof define == "function" && define.amd) // AMD
33
+ define(["../../lib/codemirror"], mod);
34
+ else // Plain browser env
35
+ mod(CodeMirror);
36
+ })(function(CodeMirror) {
37
+ "use strict";
38
+
28
39
  CodeMirror.defineMode("ntriples", function() {
29
40
 
30
41
  var Location = {
@@ -168,3 +179,5 @@ CodeMirror.defineMode("ntriples", function() {
168
179
  });
169
180
 
170
181
  CodeMirror.defineMIME("text/n-triples", "ntriples");
182
+
183
+ });
@@ -1,3 +1,13 @@
1
+ (function(mod) {
2
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
3
+ mod(require("../../lib/codemirror"));
4
+ else if (typeof define == "function" && define.amd) // AMD
5
+ define(["../../lib/codemirror"], mod);
6
+ else // Plain browser env
7
+ mod(CodeMirror);
8
+ })(function(CodeMirror) {
9
+ "use strict";
10
+
1
11
  CodeMirror.defineMode("octave", function() {
2
12
  function wordRegexp(words) {
3
13
  return new RegExp("^((" + words.join(")|(") + "))\\b");
@@ -118,3 +128,5 @@ CodeMirror.defineMode("octave", function() {
118
128
  });
119
129
 
120
130
  CodeMirror.defineMIME("text/x-octave", "octave");
131
+
132
+ });
@@ -1,3 +1,13 @@
1
+ (function(mod) {
2
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
3
+ mod(require("../../lib/codemirror"));
4
+ else if (typeof define == "function" && define.amd) // AMD
5
+ define(["../../lib/codemirror"], mod);
6
+ else // Plain browser env
7
+ mod(CodeMirror);
8
+ })(function(CodeMirror) {
9
+ "use strict";
10
+
1
11
  CodeMirror.defineMode("pascal", function() {
2
12
  function words(str) {
3
13
  var obj = {}, words = str.split(" ");
@@ -92,3 +102,5 @@ CodeMirror.defineMode("pascal", function() {
92
102
  });
93
103
 
94
104
  CodeMirror.defineMIME("text/x-pascal", "pascal");
105
+
106
+ });
@@ -1,3 +1,13 @@
1
+ (function(mod) {
2
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
3
+ mod(require("../../lib/codemirror"), require("../javascript/javascript"));
4
+ else if (typeof define == "function" && define.amd) // AMD
5
+ define(["../../lib/codemirror", "../javascript/javascript"], mod);
6
+ else // Plain browser env
7
+ mod(CodeMirror);
8
+ })(function(CodeMirror) {
9
+ "use strict";
10
+
1
11
  CodeMirror.defineMode("pegjs", function (config) {
2
12
  var jsMode = CodeMirror.getMode(config, "javascript");
3
13
 
@@ -97,3 +107,5 @@ CodeMirror.defineMode("pegjs", function (config) {
97
107
  }
98
108
  };
99
109
  }, "javascript");
110
+
111
+ });
@@ -1,5 +1,16 @@
1
1
  // CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
2
2
  // This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
3
14
  CodeMirror.defineMode("perl",function(){
4
15
  // http://perldoc.perl.org
5
16
  var PERL={ // null - magic touch
@@ -509,7 +520,7 @@ CodeMirror.defineMode("perl",function(){
509
520
  return tokenSOMETHING(stream,state,'=cut');}
510
521
  var ch=stream.next();
511
522
  if(ch=='"'||ch=="'"){ // NOTE: ' or " or <<'SOMETHING'\n...\nSOMETHING\n or <<"SOMETHING"\n...\nSOMETHING\n
512
- if(stream.prefix(3)=="<<"+ch){
523
+ if(prefix(stream, 3)=="<<"+ch){
513
524
  var p=stream.pos;
514
525
  stream.eatWhile(/\w/);
515
526
  var n=stream.current().substr(1);
@@ -518,94 +529,94 @@ CodeMirror.defineMode("perl",function(){
518
529
  stream.pos=p;}
519
530
  return tokenChain(stream,state,[ch],"string");}
520
531
  if(ch=="q"){
521
- var c=stream.look(-2);
532
+ var c=look(stream, -2);
522
533
  if(!(c&&/\w/.test(c))){
523
- c=stream.look(0);
534
+ c=look(stream, 0);
524
535
  if(c=="x"){
525
- c=stream.look(1);
536
+ c=look(stream, 1);
526
537
  if(c=="("){
527
- stream.eatSuffix(2);
538
+ eatSuffix(stream, 2);
528
539
  return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
529
540
  if(c=="["){
530
- stream.eatSuffix(2);
541
+ eatSuffix(stream, 2);
531
542
  return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
532
543
  if(c=="{"){
533
- stream.eatSuffix(2);
544
+ eatSuffix(stream, 2);
534
545
  return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
535
546
  if(c=="<"){
536
- stream.eatSuffix(2);
547
+ eatSuffix(stream, 2);
537
548
  return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}
538
549
  if(/[\^'"!~\/]/.test(c)){
539
- stream.eatSuffix(1);
550
+ eatSuffix(stream, 1);
540
551
  return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}}
541
552
  else if(c=="q"){
542
- c=stream.look(1);
553
+ c=look(stream, 1);
543
554
  if(c=="("){
544
- stream.eatSuffix(2);
555
+ eatSuffix(stream, 2);
545
556
  return tokenChain(stream,state,[")"],"string");}
546
557
  if(c=="["){
547
- stream.eatSuffix(2);
558
+ eatSuffix(stream, 2);
548
559
  return tokenChain(stream,state,["]"],"string");}
549
560
  if(c=="{"){
550
- stream.eatSuffix(2);
561
+ eatSuffix(stream, 2);
551
562
  return tokenChain(stream,state,["}"],"string");}
552
563
  if(c=="<"){
553
- stream.eatSuffix(2);
564
+ eatSuffix(stream, 2);
554
565
  return tokenChain(stream,state,[">"],"string");}
555
566
  if(/[\^'"!~\/]/.test(c)){
556
- stream.eatSuffix(1);
567
+ eatSuffix(stream, 1);
557
568
  return tokenChain(stream,state,[stream.eat(c)],"string");}}
558
569
  else if(c=="w"){
559
- c=stream.look(1);
570
+ c=look(stream, 1);
560
571
  if(c=="("){
561
- stream.eatSuffix(2);
572
+ eatSuffix(stream, 2);
562
573
  return tokenChain(stream,state,[")"],"bracket");}
563
574
  if(c=="["){
564
- stream.eatSuffix(2);
575
+ eatSuffix(stream, 2);
565
576
  return tokenChain(stream,state,["]"],"bracket");}
566
577
  if(c=="{"){
567
- stream.eatSuffix(2);
578
+ eatSuffix(stream, 2);
568
579
  return tokenChain(stream,state,["}"],"bracket");}
569
580
  if(c=="<"){
570
- stream.eatSuffix(2);
581
+ eatSuffix(stream, 2);
571
582
  return tokenChain(stream,state,[">"],"bracket");}
572
583
  if(/[\^'"!~\/]/.test(c)){
573
- stream.eatSuffix(1);
584
+ eatSuffix(stream, 1);
574
585
  return tokenChain(stream,state,[stream.eat(c)],"bracket");}}
575
586
  else if(c=="r"){
576
- c=stream.look(1);
587
+ c=look(stream, 1);
577
588
  if(c=="("){
578
- stream.eatSuffix(2);
589
+ eatSuffix(stream, 2);
579
590
  return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
580
591
  if(c=="["){
581
- stream.eatSuffix(2);
592
+ eatSuffix(stream, 2);
582
593
  return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
583
594
  if(c=="{"){
584
- stream.eatSuffix(2);
595
+ eatSuffix(stream, 2);
585
596
  return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
586
597
  if(c=="<"){
587
- stream.eatSuffix(2);
598
+ eatSuffix(stream, 2);
588
599
  return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}
589
600
  if(/[\^'"!~\/]/.test(c)){
590
- stream.eatSuffix(1);
601
+ eatSuffix(stream, 1);
591
602
  return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}}
592
603
  else if(/[\^'"!~\/(\[{<]/.test(c)){
593
604
  if(c=="("){
594
- stream.eatSuffix(1);
605
+ eatSuffix(stream, 1);
595
606
  return tokenChain(stream,state,[")"],"string");}
596
607
  if(c=="["){
597
- stream.eatSuffix(1);
608
+ eatSuffix(stream, 1);
598
609
  return tokenChain(stream,state,["]"],"string");}
599
610
  if(c=="{"){
600
- stream.eatSuffix(1);
611
+ eatSuffix(stream, 1);
601
612
  return tokenChain(stream,state,["}"],"string");}
602
613
  if(c=="<"){
603
- stream.eatSuffix(1);
614
+ eatSuffix(stream, 1);
604
615
  return tokenChain(stream,state,[">"],"string");}
605
616
  if(/[\^'"!~\/]/.test(c)){
606
617
  return tokenChain(stream,state,[stream.eat(c)],"string");}}}}
607
618
  if(ch=="m"){
608
- var c=stream.look(-2);
619
+ var c=look(stream, -2);
609
620
  if(!(c&&/\w/.test(c))){
610
621
  c=stream.eat(/[(\[{<\^'"!~\/]/);
611
622
  if(c){
@@ -620,7 +631,7 @@ stream.eatSuffix(2);
620
631
  if(c=="<"){
621
632
  return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}}}}
622
633
  if(ch=="s"){
623
- var c=/[\/>\]})\w]/.test(stream.look(-2));
634
+ var c=/[\/>\]})\w]/.test(look(stream, -2));
624
635
  if(!c){
625
636
  c=stream.eat(/[(\[{<\^'"!~\/]/);
626
637
  if(c){
@@ -634,7 +645,7 @@ stream.eatSuffix(2);
634
645
  return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
635
646
  return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}
636
647
  if(ch=="y"){
637
- var c=/[\/>\]})\w]/.test(stream.look(-2));
648
+ var c=/[\/>\]})\w]/.test(look(stream, -2));
638
649
  if(!c){
639
650
  c=stream.eat(/[(\[{<\^'"!~\/]/);
640
651
  if(c){
@@ -648,7 +659,7 @@ stream.eatSuffix(2);
648
659
  return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
649
660
  return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}
650
661
  if(ch=="t"){
651
- var c=/[\/>\]})\w]/.test(stream.look(-2));
662
+ var c=/[\/>\]})\w]/.test(look(stream, -2));
652
663
  if(!c){
653
664
  c=stream.eat("r");if(c){
654
665
  c=stream.eat(/[(\[{<\^'"!~\/]/);
@@ -665,7 +676,7 @@ stream.eatSuffix(2);
665
676
  if(ch=="`"){
666
677
  return tokenChain(stream,state,[ch],"variable-2");}
667
678
  if(ch=="/"){
668
- if(!/~\s*$/.test(stream.prefix()))
679
+ if(!/~\s*$/.test(prefix(stream)))
669
680
  return "operator";
670
681
  else
671
682
  return tokenChain(stream,state,[ch],RXstyle,RXmodifiers);}
@@ -677,7 +688,7 @@ stream.eatSuffix(2);
677
688
  stream.pos=p;}
678
689
  if(/[$@%]/.test(ch)){
679
690
  var p=stream.pos;
680
- if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(stream.look(-2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){
691
+ if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(look(stream, -2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){
681
692
  var c=stream.current();
682
693
  if(PERL[c])
683
694
  return "variable-2";}
@@ -690,7 +701,7 @@ stream.eatSuffix(2);
690
701
  else
691
702
  return "variable";}}
692
703
  if(ch=="#"){
693
- if(stream.look(-2)!="$"){
704
+ if(look(stream, -2)!="$"){
694
705
  stream.skipToEnd();
695
706
  return "comment";}}
696
707
  if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){
@@ -702,23 +713,23 @@ stream.eatSuffix(2);
702
713
  stream.pos=p;}
703
714
  if(ch=="_"){
704
715
  if(stream.pos==1){
705
- if(stream.suffix(6)=="_END__"){
716
+ if(suffix(stream, 6)=="_END__"){
706
717
  return tokenChain(stream,state,['\0'],"comment");}
707
- else if(stream.suffix(7)=="_DATA__"){
718
+ else if(suffix(stream, 7)=="_DATA__"){
708
719
  return tokenChain(stream,state,['\0'],"variable-2");}
709
- else if(stream.suffix(7)=="_C__"){
720
+ else if(suffix(stream, 7)=="_C__"){
710
721
  return tokenChain(stream,state,['\0'],"string");}}}
711
722
  if(/\w/.test(ch)){
712
723
  var p=stream.pos;
713
- if(stream.look(-2)=="{"&&(stream.look(0)=="}"||stream.eatWhile(/\w/)&&stream.look(0)=="}"))
724
+ if(look(stream, -2)=="{"&&(look(stream, 0)=="}"||stream.eatWhile(/\w/)&&look(stream, 0)=="}"))
714
725
  return "string";
715
726
  else
716
727
  stream.pos=p;}
717
728
  if(/[A-Z]/.test(ch)){
718
- var l=stream.look(-2);
729
+ var l=look(stream, -2);
719
730
  var p=stream.pos;
720
731
  stream.eatWhile(/[A-Z_]/);
721
- if(/[\da-z]/.test(stream.look(0))){
732
+ if(/[\da-z]/.test(look(stream, 0))){
722
733
  stream.pos=p;}
723
734
  else{
724
735
  var c=PERL[stream.current()];
@@ -742,7 +753,7 @@ stream.eatSuffix(2);
742
753
  else
743
754
  return "meta";}}
744
755
  if(/[a-zA-Z_]/.test(ch)){
745
- var l=stream.look(-2);
756
+ var l=look(stream, -2);
746
757
  stream.eatWhile(/\w/);
747
758
  var c=PERL[stream.current()];
748
759
  if(!c)
@@ -780,37 +791,37 @@ stream.eatSuffix(2);
780
791
  CodeMirror.defineMIME("text/x-perl", "perl");
781
792
 
782
793
  // it's like "peek", but need for look-ahead or look-behind if index < 0
783
- CodeMirror.StringStream.prototype.look=function(c){
784
- return this.string.charAt(this.pos+(c||0));};
794
+ function look(stream, c){
795
+ return stream.string.charAt(stream.pos+(c||0));
796
+ }
785
797
 
786
798
  // return a part of prefix of current stream from current position
787
- CodeMirror.StringStream.prototype.prefix=function(c){
788
- if(c){
789
- var x=this.pos-c;
790
- return this.string.substr((x>=0?x:0),c);}
791
- else{
792
- return this.string.substr(0,this.pos-1);}};
799
+ function prefix(stream, c){
800
+ if(c){
801
+ var x=stream.pos-c;
802
+ return stream.string.substr((x>=0?x:0),c);}
803
+ else{
804
+ return stream.string.substr(0,stream.pos-1);
805
+ }
806
+ }
793
807
 
794
808
  // return a part of suffix of current stream from current position
795
- CodeMirror.StringStream.prototype.suffix=function(c){
796
- var y=this.string.length;
797
- var x=y-this.pos+1;
798
- return this.string.substr(this.pos,(c&&c<y?c:x));};
799
-
800
- // return a part of suffix of current stream from current position and change current position
801
- CodeMirror.StringStream.prototype.nsuffix=function(c){
802
- var p=this.pos;
803
- var l=c||(this.string.length-this.pos+1);
804
- this.pos+=l;
805
- return this.string.substr(p,l);};
809
+ function suffix(stream, c){
810
+ var y=stream.string.length;
811
+ var x=y-stream.pos+1;
812
+ return stream.string.substr(stream.pos,(c&&c<y?c:x));
813
+ }
806
814
 
807
815
  // eating and vomiting a part of stream from current position
808
- CodeMirror.StringStream.prototype.eatSuffix=function(c){
809
- var x=this.pos+c;
810
- var y;
811
- if(x<=0)
812
- this.pos=0;
813
- else if(x>=(y=this.string.length-1))
814
- this.pos=y;
815
- else
816
- this.pos=x;};
816
+ function eatSuffix(stream, c){
817
+ var x=stream.pos+c;
818
+ var y;
819
+ if(x<=0)
820
+ stream.pos=0;
821
+ else if(x>=(y=stream.string.length-1))
822
+ stream.pos=y;
823
+ else
824
+ stream.pos=x;
825
+ }
826
+
827
+ });