codemirror-rails 3.02 → 3.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/LICENSE +1 -1
  4. data/codemirror-rails.gemspec +1 -0
  5. data/doc/CodeMirror-LICENSE +5 -1
  6. data/lib/codemirror/rails/version.rb +2 -2
  7. data/vendor/assets/javascripts/codemirror/{utils → addons/dialog}/dialog.js +4 -0
  8. data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +54 -0
  9. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +54 -0
  10. data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/closetag.js +9 -8
  11. data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/continuecomment.js +12 -4
  12. data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +25 -0
  13. data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/matchbrackets.js +30 -11
  14. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +31 -0
  15. data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +32 -0
  16. data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +11 -0
  17. data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +64 -0
  18. data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +582 -0
  19. data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/javascript-hint.js +15 -11
  20. data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/pig-hint.js +19 -19
  21. data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/python-hint.js +2 -2
  22. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +180 -0
  23. data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/xml-hint.js +5 -18
  24. data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +127 -0
  25. data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +14 -0
  26. data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +197 -0
  27. data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/loadmode.js +0 -0
  28. data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/multiplex.js +2 -2
  29. data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/overlay.js +2 -2
  30. data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/colorize.js +0 -0
  31. data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/runmode-standalone.js +2 -3
  32. data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/runmode.js +0 -0
  33. data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +89 -0
  34. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +60 -0
  35. data/vendor/assets/javascripts/codemirror/{utils → addons/search}/search.js +5 -5
  36. data/vendor/assets/javascripts/codemirror/{utils → addons/search}/searchcursor.js +37 -30
  37. data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +39 -0
  38. data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +34 -0
  39. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +721 -188
  40. data/vendor/assets/javascripts/codemirror/modes/asterisk.js +6 -6
  41. data/vendor/assets/javascripts/codemirror/modes/clike.js +14 -14
  42. data/vendor/assets/javascripts/codemirror/modes/clojure.js +23 -7
  43. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +2 -2
  44. data/vendor/assets/javascripts/codemirror/modes/css.js +337 -235
  45. data/vendor/assets/javascripts/codemirror/modes/ecl.js +12 -12
  46. data/vendor/assets/javascripts/codemirror/modes/erlang.js +1 -1
  47. data/vendor/assets/javascripts/codemirror/modes/gas.js +326 -0
  48. data/vendor/assets/javascripts/codemirror/modes/gfm.js +1 -0
  49. data/vendor/assets/javascripts/codemirror/modes/haskell.js +26 -26
  50. data/vendor/assets/javascripts/codemirror/modes/haxe.js +17 -17
  51. data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +6 -6
  52. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +43 -23
  53. data/vendor/assets/javascripts/codemirror/modes/javascript.js +78 -33
  54. data/vendor/assets/javascripts/codemirror/modes/jinja2.js +2 -2
  55. data/vendor/assets/javascripts/codemirror/modes/less.js +38 -38
  56. data/vendor/assets/javascripts/codemirror/modes/livescript.js +267 -0
  57. data/vendor/assets/javascripts/codemirror/modes/lua.js +7 -7
  58. data/vendor/assets/javascripts/codemirror/modes/markdown.js +108 -57
  59. data/vendor/assets/javascripts/codemirror/modes/mirc.js +177 -0
  60. data/vendor/assets/javascripts/codemirror/modes/ntriples.js +22 -22
  61. data/vendor/assets/javascripts/codemirror/modes/ocaml.js +1 -1
  62. data/vendor/assets/javascripts/codemirror/modes/perl.js +791 -791
  63. data/vendor/assets/javascripts/codemirror/modes/php.js +1 -1
  64. data/vendor/assets/javascripts/codemirror/modes/pig.js +163 -163
  65. data/vendor/assets/javascripts/codemirror/modes/python.js +31 -31
  66. data/vendor/assets/javascripts/codemirror/modes/q.js +124 -0
  67. data/vendor/assets/javascripts/codemirror/modes/rst.js +486 -250
  68. data/vendor/assets/javascripts/codemirror/modes/sass.js +3 -3
  69. data/vendor/assets/javascripts/codemirror/modes/scss_test.js +80 -0
  70. data/vendor/assets/javascripts/codemirror/modes/shell.js +2 -2
  71. data/vendor/assets/javascripts/codemirror/modes/sieve.js +10 -10
  72. data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +129 -129
  73. data/vendor/assets/javascripts/codemirror/modes/smarty.js +3 -3
  74. data/vendor/assets/javascripts/codemirror/modes/sparql.js +1 -1
  75. data/vendor/assets/javascripts/codemirror/modes/sql.js +23 -23
  76. data/vendor/assets/javascripts/codemirror/modes/stex.js +192 -121
  77. data/vendor/assets/javascripts/codemirror/modes/tcl.js +131 -0
  78. data/vendor/assets/javascripts/codemirror/modes/test.js +64 -0
  79. data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +345 -345
  80. data/vendor/assets/javascripts/codemirror/modes/tiki.js +297 -298
  81. data/vendor/assets/javascripts/codemirror/modes/turtle.js +145 -0
  82. data/vendor/assets/javascripts/codemirror/modes/vb.js +31 -32
  83. data/vendor/assets/javascripts/codemirror/modes/vbscript.js +4 -4
  84. data/vendor/assets/javascripts/codemirror/modes/xml.js +10 -6
  85. data/vendor/assets/javascripts/codemirror/modes/xquery.js +55 -55
  86. data/vendor/assets/javascripts/codemirror/modes/yaml.js +90 -90
  87. data/vendor/assets/javascripts/codemirror/modes/z80.js +82 -110
  88. data/vendor/assets/javascripts/codemirror.js +1914 -1115
  89. data/vendor/assets/stylesheets/codemirror/{utils → addons/dialog}/dialog.css +0 -0
  90. data/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css +38 -0
  91. data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +96 -0
  92. data/vendor/assets/stylesheets/codemirror/modes/tiki.css +2 -2
  93. data/vendor/assets/stylesheets/codemirror/themes/ambiance-mobile.css +0 -1
  94. data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +0 -1
  95. data/vendor/assets/stylesheets/codemirror/themes/eclipse.css +2 -2
  96. data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +5 -5
  97. data/vendor/assets/stylesheets/codemirror/themes/midnight.css +52 -0
  98. data/vendor/assets/stylesheets/codemirror/themes/xq-light.css +43 -0
  99. data/vendor/assets/stylesheets/codemirror.css +16 -10
  100. metadata +60 -52
  101. data/vendor/assets/javascripts/codemirror/modes/mysql.js +0 -203
  102. data/vendor/assets/javascripts/codemirror/modes/plsql.js +0 -216
  103. data/vendor/assets/javascripts/codemirror/utils/collapserange.js +0 -68
  104. data/vendor/assets/javascripts/codemirror/utils/continuelist.js +0 -28
  105. data/vendor/assets/javascripts/codemirror/utils/foldcode.js +0 -183
  106. data/vendor/assets/javascripts/codemirror/utils/formatting.js +0 -114
  107. data/vendor/assets/javascripts/codemirror/utils/match-highlighter.js +0 -46
  108. data/vendor/assets/javascripts/codemirror/utils/simple-hint.js +0 -102
  109. data/vendor/assets/stylesheets/codemirror/utils/simple-hint.css +0 -16
@@ -284,7 +284,7 @@ CodeMirror.defineMode("sass", function(config) {
284
284
  // If we haven't returned by now, we move 1 character
285
285
  // and return an error
286
286
  stream.next();
287
- return 'error';
287
+ return null;
288
288
  };
289
289
 
290
290
  var tokenLexer = function(stream, state) {
@@ -302,7 +302,7 @@ CodeMirror.defineMode("sass", function(config) {
302
302
  indent(state);
303
303
  }
304
304
 
305
- if (style !== "error"){
305
+ if (style !== null){
306
306
  var startOfToken = stream.pos - current.length;
307
307
  var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount);
308
308
 
@@ -329,7 +329,7 @@ CodeMirror.defineMode("sass", function(config) {
329
329
  tokenizer: tokenBase,
330
330
  scopes: [{offset: 0, type: 'sass'}],
331
331
  definedVars: [],
332
- definedMixins: [],
332
+ definedMixins: []
333
333
  };
334
334
  },
335
335
  token: function(stream, state) {
@@ -0,0 +1,80 @@
1
+ (function() {
2
+ var mode = CodeMirror.getMode({tabSize: 4}, "text/x-scss");
3
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); }
4
+
5
+ MT('url_with_quotation',
6
+ "[tag foo] { [property background][operator :][string-2 url]([string test.jpg]) }");
7
+
8
+ MT('url_with_double_quotes',
9
+ "[tag foo] { [property background][operator :][string-2 url]([string \"test.jpg\"]) }");
10
+
11
+ MT('url_with_single_quotes',
12
+ "[tag foo] { [property background][operator :][string-2 url]([string \'test.jpg\']) }");
13
+
14
+ MT('string',
15
+ "[def @import] [string \"compass/css3\"]");
16
+
17
+ MT('important_keyword',
18
+ "[tag foo] { [property background][operator :][string-2 url]([string \'test.jpg\']) [keyword !important] }");
19
+
20
+ MT('variable',
21
+ "[variable-2 $blue][operator :][atom #333]");
22
+
23
+ MT('variable_as_attribute',
24
+ "[tag foo] { [property color][operator :][variable-2 $blue] }");
25
+
26
+ MT('numbers',
27
+ "[tag foo] { [property padding][operator :][number 10px] [number 10] [number 10em] [number 8in] }");
28
+
29
+ MT('number_percentage',
30
+ "[tag foo] { [property width][operator :][number 80%] }");
31
+
32
+ MT('selector',
33
+ "[builtin #hello][qualifier .world]{}");
34
+
35
+ MT('singleline_comment',
36
+ "[comment // this is a comment]");
37
+
38
+ MT('multiline_comment',
39
+ "[comment /*foobar*/]");
40
+
41
+ MT('attribute_with_hyphen',
42
+ "[tag foo] { [property font-size][operator :][number 10px] }");
43
+
44
+ MT('string_after_attribute',
45
+ "[tag foo] { [property content][operator :][string \"::\"] }");
46
+
47
+ MT('directives',
48
+ "[def @include] [qualifier .mixin]");
49
+
50
+ MT('basic_structure',
51
+ "[tag p] { [property background][operator :][keyword red]; }");
52
+
53
+ MT('nested_structure',
54
+ "[tag p] { [tag a] { [property color][operator :][keyword red]; } }");
55
+
56
+ MT('mixin',
57
+ "[def @mixin] [tag table-base] {}");
58
+
59
+ MT('number_without_semicolon',
60
+ "[tag p] {[property width][operator :][number 12]}",
61
+ "[tag a] {[property color][operator :][keyword red];}");
62
+
63
+ MT('atom_in_nested_block',
64
+ "[tag p] { [tag a] { [property color][operator :][atom #000]; } }");
65
+
66
+ MT('interpolation_in_property',
67
+ "[tag foo] { [operator #{][variable-2 $hello][operator }:][atom #000]; }");
68
+
69
+ MT('interpolation_in_selector',
70
+ "[tag foo][operator #{][variable-2 $hello][operator }] { [property color][operator :][atom #000]; }");
71
+
72
+ MT('interpolation_error',
73
+ "[tag foo][operator #{][error foo][operator }] { [property color][operator :][atom #000]; }");
74
+
75
+ MT("divide_operator",
76
+ "[tag foo] { [property width][operator :][number 4] [operator /] [number 2] }");
77
+
78
+ MT('nested_structure_with_id_selector',
79
+ "[tag p] { [builtin #hello] { [property color][operator :][keyword red]; } }");
80
+ })();
@@ -57,7 +57,7 @@ CodeMirror.defineMode('shell', function() {
57
57
  return 'number';
58
58
  }
59
59
  }
60
- stream.eatWhile(/\w/);
60
+ stream.eatWhile(/[\w-]/);
61
61
  var cur = stream.current();
62
62
  if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
63
63
  return words.hasOwnProperty(cur) ? words[cur] : null;
@@ -114,5 +114,5 @@ CodeMirror.defineMode('shell', function() {
114
114
  }
115
115
  };
116
116
  });
117
-
117
+
118
118
  CodeMirror.defineMIME('text/x-sh', 'shell');
@@ -31,7 +31,7 @@ CodeMirror.defineMode("sieve", function(config) {
31
31
  state.tokenize = tokenString(ch);
32
32
  return state.tokenize(stream, state);
33
33
  }
34
-
34
+
35
35
  if (ch == "(") {
36
36
  state._indent.push("(");
37
37
  // add virtual angel wings so that editor behaves...
@@ -44,24 +44,24 @@ CodeMirror.defineMode("sieve", function(config) {
44
44
  state._indent.push("{");
45
45
  return null;
46
46
  }
47
-
47
+
48
48
  if (ch == ")") {
49
49
  state._indent.pop();
50
- state._indent.pop();
50
+ state._indent.pop();
51
51
  }
52
52
 
53
53
  if (ch === "}") {
54
54
  state._indent.pop();
55
55
  return null;
56
56
  }
57
-
57
+
58
58
  if (ch == ",")
59
59
  return null;
60
-
60
+
61
61
  if (ch == ";")
62
62
  return null;
63
-
64
-
63
+
64
+
65
65
  if (/[{}\(\),;]/.test(ch))
66
66
  return null;
67
67
 
@@ -97,7 +97,7 @@ CodeMirror.defineMode("sieve", function(config) {
97
97
 
98
98
  if (atoms.propertyIsEnumerable(cur))
99
99
  return "atom";
100
-
100
+
101
101
  return null;
102
102
  }
103
103
 
@@ -169,10 +169,10 @@ CodeMirror.defineMode("sieve", function(config) {
169
169
  var length = state._indent.length;
170
170
  if (_textAfter && (_textAfter[0] == "}"))
171
171
  length--;
172
-
172
+
173
173
  if (length <0)
174
174
  length = 0;
175
-
175
+
176
176
  return length * indentUnit;
177
177
  },
178
178
 
@@ -1,139 +1,139 @@
1
1
  CodeMirror.defineMode('smalltalk', function(config) {
2
2
 
3
- var specialChars = /[+\-/\\*~<>=@%|&?!.:;^]/;
4
- var keywords = /true|false|nil|self|super|thisContext/;
5
-
6
- var Context = function(tokenizer, parent) {
7
- this.next = tokenizer;
8
- this.parent = parent;
9
- };
10
-
11
- var Token = function(name, context, eos) {
12
- this.name = name;
13
- this.context = context;
14
- this.eos = eos;
15
- };
16
-
17
- var State = function() {
18
- this.context = new Context(next, null);
19
- this.expectVariable = true;
20
- this.indentation = 0;
21
- this.userIndentationDelta = 0;
22
- };
23
-
24
- State.prototype.userIndent = function(indentation) {
25
- this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0;
26
- };
27
-
28
- var next = function(stream, context, state) {
29
- var token = new Token(null, context, false);
30
- var aChar = stream.next();
31
-
32
- if (aChar === '"') {
33
- token = nextComment(stream, new Context(nextComment, context));
34
-
35
- } else if (aChar === '\'') {
36
- token = nextString(stream, new Context(nextString, context));
37
-
38
- } else if (aChar === '#') {
39
- stream.eatWhile(/[^ .]/);
40
- token.name = 'string-2';
41
-
42
- } else if (aChar === '$') {
43
- stream.eatWhile(/[^ ]/);
44
- token.name = 'string-2';
45
-
46
- } else if (aChar === '|' && state.expectVariable) {
47
- token.context = new Context(nextTemporaries, context);
48
-
49
- } else if (/[\[\]{}()]/.test(aChar)) {
50
- token.name = 'bracket';
51
- token.eos = /[\[{(]/.test(aChar);
52
-
53
- if (aChar === '[') {
54
- state.indentation++;
55
- } else if (aChar === ']') {
56
- state.indentation = Math.max(0, state.indentation - 1);
57
- }
58
-
59
- } else if (specialChars.test(aChar)) {
60
- stream.eatWhile(specialChars);
61
- token.name = 'operator';
62
- token.eos = aChar !== ';'; // ; cascaded message expression
63
-
64
- } else if (/\d/.test(aChar)) {
65
- stream.eatWhile(/[\w\d]/);
66
- token.name = 'number';
67
-
68
- } else if (/[\w_]/.test(aChar)) {
69
- stream.eatWhile(/[\w\d_]/);
70
- token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
71
-
72
- } else {
73
- token.eos = state.expectVariable;
74
- }
75
-
76
- return token;
77
- };
78
-
79
- var nextComment = function(stream, context) {
80
- stream.eatWhile(/[^"]/);
81
- return new Token('comment', stream.eat('"') ? context.parent : context, true);
82
- };
83
-
84
- var nextString = function(stream, context) {
85
- stream.eatWhile(/[^']/);
86
- return new Token('string', stream.eat('\'') ? context.parent : context, false);
87
- };
88
-
89
- var nextTemporaries = function(stream, context) {
90
- var token = new Token(null, context, false);
91
- var aChar = stream.next();
92
-
93
- if (aChar === '|') {
94
- token.context = context.parent;
95
- token.eos = true;
96
-
97
- } else {
98
- stream.eatWhile(/[^|]/);
99
- token.name = 'variable';
100
- }
101
-
102
- return token;
103
- };
104
-
105
- return {
106
- startState: function() {
107
- return new State;
108
- },
109
-
110
- token: function(stream, state) {
111
- state.userIndent(stream.indentation());
112
-
113
- if (stream.eatSpace()) {
114
- return null;
115
- }
3
+ var specialChars = /[+\-\/\\*~<>=@%|&?!.:;^]/;
4
+ var keywords = /true|false|nil|self|super|thisContext/;
5
+
6
+ var Context = function(tokenizer, parent) {
7
+ this.next = tokenizer;
8
+ this.parent = parent;
9
+ };
10
+
11
+ var Token = function(name, context, eos) {
12
+ this.name = name;
13
+ this.context = context;
14
+ this.eos = eos;
15
+ };
16
+
17
+ var State = function() {
18
+ this.context = new Context(next, null);
19
+ this.expectVariable = true;
20
+ this.indentation = 0;
21
+ this.userIndentationDelta = 0;
22
+ };
23
+
24
+ State.prototype.userIndent = function(indentation) {
25
+ this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0;
26
+ };
27
+
28
+ var next = function(stream, context, state) {
29
+ var token = new Token(null, context, false);
30
+ var aChar = stream.next();
31
+
32
+ if (aChar === '"') {
33
+ token = nextComment(stream, new Context(nextComment, context));
34
+
35
+ } else if (aChar === '\'') {
36
+ token = nextString(stream, new Context(nextString, context));
37
+
38
+ } else if (aChar === '#') {
39
+ stream.eatWhile(/[^ .]/);
40
+ token.name = 'string-2';
41
+
42
+ } else if (aChar === '$') {
43
+ stream.eatWhile(/[^ ]/);
44
+ token.name = 'string-2';
45
+
46
+ } else if (aChar === '|' && state.expectVariable) {
47
+ token.context = new Context(nextTemporaries, context);
48
+
49
+ } else if (/[\[\]{}()]/.test(aChar)) {
50
+ token.name = 'bracket';
51
+ token.eos = /[\[{(]/.test(aChar);
52
+
53
+ if (aChar === '[') {
54
+ state.indentation++;
55
+ } else if (aChar === ']') {
56
+ state.indentation = Math.max(0, state.indentation - 1);
57
+ }
58
+
59
+ } else if (specialChars.test(aChar)) {
60
+ stream.eatWhile(specialChars);
61
+ token.name = 'operator';
62
+ token.eos = aChar !== ';'; // ; cascaded message expression
63
+
64
+ } else if (/\d/.test(aChar)) {
65
+ stream.eatWhile(/[\w\d]/);
66
+ token.name = 'number';
67
+
68
+ } else if (/[\w_]/.test(aChar)) {
69
+ stream.eatWhile(/[\w\d_]/);
70
+ token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
71
+
72
+ } else {
73
+ token.eos = state.expectVariable;
74
+ }
75
+
76
+ return token;
77
+ };
78
+
79
+ var nextComment = function(stream, context) {
80
+ stream.eatWhile(/[^"]/);
81
+ return new Token('comment', stream.eat('"') ? context.parent : context, true);
82
+ };
83
+
84
+ var nextString = function(stream, context) {
85
+ stream.eatWhile(/[^']/);
86
+ return new Token('string', stream.eat('\'') ? context.parent : context, false);
87
+ };
88
+
89
+ var nextTemporaries = function(stream, context) {
90
+ var token = new Token(null, context, false);
91
+ var aChar = stream.next();
92
+
93
+ if (aChar === '|') {
94
+ token.context = context.parent;
95
+ token.eos = true;
96
+
97
+ } else {
98
+ stream.eatWhile(/[^|]/);
99
+ token.name = 'variable';
100
+ }
101
+
102
+ return token;
103
+ };
104
+
105
+ return {
106
+ startState: function() {
107
+ return new State;
108
+ },
109
+
110
+ token: function(stream, state) {
111
+ state.userIndent(stream.indentation());
112
+
113
+ if (stream.eatSpace()) {
114
+ return null;
115
+ }
116
116
 
117
- var token = state.context.next(stream, state.context, state);
118
- state.context = token.context;
119
- state.expectVariable = token.eos;
117
+ var token = state.context.next(stream, state.context, state);
118
+ state.context = token.context;
119
+ state.expectVariable = token.eos;
120
120
 
121
- state.lastToken = token;
122
- return token.name;
123
- },
121
+ state.lastToken = token;
122
+ return token.name;
123
+ },
124
124
 
125
- blankLine: function(state) {
126
- state.userIndent(0);
127
- },
125
+ blankLine: function(state) {
126
+ state.userIndent(0);
127
+ },
128
128
 
129
- indent: function(state, textAfter) {
130
- var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
131
- return (state.indentation + i) * config.indentUnit;
132
- },
129
+ indent: function(state, textAfter) {
130
+ var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
131
+ return (state.indentation + i) * config.indentUnit;
132
+ },
133
133
 
134
- electricChars: ']'
135
- };
134
+ electricChars: ']'
135
+ };
136
136
 
137
137
  });
138
138
 
139
- CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
139
+ CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
@@ -88,7 +88,7 @@ CodeMirror.defineMode("smarty", function(config) {
88
88
 
89
89
  var str = "";
90
90
  if (ch != "/") {
91
- str += ch;
91
+ str += ch;
92
92
  }
93
93
  var c = "";
94
94
  while ((c = stream.eat(regs.validIdentifier))) {
@@ -101,7 +101,7 @@ CodeMirror.defineMode("smarty", function(config) {
101
101
  }
102
102
  }
103
103
  if (/\s/.test(ch)) {
104
- return null;
104
+ return null;
105
105
  }
106
106
  return ret("tag", "tag");
107
107
  }
@@ -145,4 +145,4 @@ CodeMirror.defineMode("smarty", function(config) {
145
145
  };
146
146
  });
147
147
 
148
- CodeMirror.defineMIME("text/x-smarty", "smarty");
148
+ CodeMirror.defineMIME("text/x-smarty", "smarty");
@@ -117,7 +117,7 @@ CodeMirror.defineMode("sparql", function(config) {
117
117
  state.context.col = stream.column();
118
118
  }
119
119
  }
120
-
120
+
121
121
  return style;
122
122
  },
123
123
 
@@ -4,12 +4,12 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
4
4
  var client = parserConfig.client || {},
5
5
  atoms = parserConfig.atoms || {"false": true, "true": true, "null": true},
6
6
  builtin = parserConfig.builtin || {},
7
- keywords = parserConfig.keywords,
7
+ keywords = parserConfig.keywords || {},
8
8
  operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/,
9
9
  support = parserConfig.support || {},
10
10
  hooks = parserConfig.hooks || {},
11
11
  dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true};
12
-
12
+
13
13
  function tokenBase(stream, state) {
14
14
  var ch = stream.next();
15
15
 
@@ -20,11 +20,11 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
20
20
  }
21
21
 
22
22
  if ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/))
23
- || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/)) {
23
+ || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/)) {
24
24
  // hex
25
25
  return "number";
26
26
  } else if (((ch == "b" || ch == "B") && stream.match(/^'[01]+'/))
27
- || (ch == "0" && stream.match(/^b[01]+/))) {
27
+ || (ch == "0" && stream.match(/^b[01]+/))) {
28
28
  // bitstring
29
29
  return "number";
30
30
  } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) {
@@ -43,7 +43,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
43
43
  return null;
44
44
  } else if (ch == "#" || (ch == "-" && stream.eat("-") && stream.eat(" "))) {
45
45
  // 1-line comments
46
- stream.skipToEnd();
46
+ stream.skipToEnd();
47
47
  return "comment";
48
48
  } else if (ch == "/" && stream.eat("*")) {
49
49
  // multi-line comments
@@ -85,11 +85,11 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
85
85
  return function(stream, state) {
86
86
  var escaped = false, ch;
87
87
  while ((ch = stream.next()) != null) {
88
- if (ch == quote && !escaped) {
89
- state.tokenize = tokenBase;
90
- break;
91
- }
92
- escaped = !escaped && ch == "\\";
88
+ if (ch == quote && !escaped) {
89
+ state.tokenize = tokenBase;
90
+ break;
91
+ }
92
+ escaped = !escaped && ch == "\\";
93
93
  }
94
94
  return "string";
95
95
  };
@@ -97,14 +97,14 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
97
97
  function tokenComment(stream, state) {
98
98
  while (true) {
99
99
  if (stream.skipTo("*")) {
100
- stream.next();
101
- if (stream.eat("/")) {
102
- state.tokenize = tokenBase;
103
- break;
104
- }
100
+ stream.next();
101
+ if (stream.eat("/")) {
102
+ state.tokenize = tokenBase;
103
+ break;
104
+ }
105
105
  } else {
106
- stream.skipToEnd();
107
- break;
106
+ stream.skipToEnd();
107
+ break;
108
108
  }
109
109
  }
110
110
  return "comment";
@@ -131,8 +131,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
131
131
 
132
132
  token: function(stream, state) {
133
133
  if (stream.sol()) {
134
- if (state.context && state.context.align == null)
135
- state.context.align = false;
134
+ if (state.context && state.context.align == null)
135
+ state.context.align = false;
136
136
  }
137
137
  if (stream.eatSpace()) return null;
138
138
 
@@ -140,7 +140,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
140
140
  if (style == "comment") return style;
141
141
 
142
142
  if (state.context && state.context.align == null)
143
- state.context.align = true;
143
+ state.context.align = true;
144
144
 
145
145
  var tok = stream.current();
146
146
  if (tok == "(")
@@ -163,7 +163,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
163
163
 
164
164
  (function() {
165
165
  "use strict";
166
-
166
+
167
167
  // `identifier`
168
168
  function hookIdentifier(stream) {
169
169
  var escaped = false, ch;
@@ -226,7 +226,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
226
226
  CodeMirror.defineMIME("text/x-mysql", {
227
227
  name: "sql",
228
228
  client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
229
- keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
229
+ keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
230
230
  builtin: set("bool boolean bit blob decimal double enum float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
231
231
  atoms: set("false true null unknown"),
232
232
  operatorChars: /^[*+\-%<>!=&|^]/,
@@ -242,7 +242,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
242
242
  CodeMirror.defineMIME("text/x-mariadb", {
243
243
  name: "sql",
244
244
  client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
245
- keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
245
+ keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
246
246
  builtin: set("bool boolean bit blob decimal double enum float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
247
247
  atoms: set("false true null unknown"),
248
248
  operatorChars: /^[*+\-%<>!=&|^]/,