codemirror-rails 5.7 → 5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +54 -33
- data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +20 -7
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +77 -23
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +3 -6
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +3 -3
- data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +9 -6
- data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +3 -1
- data/vendor/assets/javascripts/codemirror/modes/clike.js +140 -15
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +0 -11
- data/vendor/assets/javascripts/codemirror/modes/css.js +2 -0
- data/vendor/assets/javascripts/codemirror/modes/cypher.js +3 -3
- data/vendor/assets/javascripts/codemirror/modes/dart.js +81 -1
- data/vendor/assets/javascripts/codemirror/modes/haxe.js +13 -4
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +20 -5
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +58 -47
- data/vendor/assets/javascripts/codemirror/modes/nsis.js +63 -0
- data/vendor/assets/javascripts/codemirror/modes/rpm.js +17 -9
- data/vendor/assets/stylesheets/codemirror/themes/abcdef.css +1 -1
- data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +1 -1
- data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +1 -1
- data/vendor/assets/stylesheets/codemirror/themes/bespin.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/hopscotch.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/isotope.css +34 -0
- data/vendor/assets/stylesheets/codemirror/themes/liquibyte.css +14 -14
- data/vendor/assets/stylesheets/codemirror/themes/railscasts.css +34 -0
- metadata +6 -2
- data/vendor/assets/javascripts/codemirror/modes/kotlin.js +0 -284
@@ -3,7 +3,7 @@
|
|
3
3
|
Name: Base16 Default Dark
|
4
4
|
Author: Chris Kempson (http://chriskempson.com)
|
5
5
|
|
6
|
-
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-
|
6
|
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
7
7
|
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
8
8
|
|
9
9
|
*/
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Name: Base16 Default Light
|
4
4
|
Author: Chris Kempson (http://chriskempson.com)
|
5
5
|
|
6
|
-
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-
|
6
|
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
7
7
|
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
8
8
|
|
9
9
|
*/
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Name: Bespin
|
4
|
+
Author: Mozilla / Jan T. Sott
|
5
|
+
|
6
|
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
7
|
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
8
|
+
|
9
|
+
*/
|
10
|
+
|
11
|
+
.cm-s-bespin.CodeMirror {background: #28211c; color: #9d9b97;}
|
12
|
+
.cm-s-bespin div.CodeMirror-selected {background: #36312e !important;}
|
13
|
+
.cm-s-bespin .CodeMirror-gutters {background: #28211c; border-right: 0px;}
|
14
|
+
.cm-s-bespin .CodeMirror-linenumber {color: #666666;}
|
15
|
+
.cm-s-bespin .CodeMirror-cursor {border-left: 1px solid #797977 !important;}
|
16
|
+
|
17
|
+
.cm-s-bespin span.cm-comment {color: #937121;}
|
18
|
+
.cm-s-bespin span.cm-atom {color: #9b859d;}
|
19
|
+
.cm-s-bespin span.cm-number {color: #9b859d;}
|
20
|
+
|
21
|
+
.cm-s-bespin span.cm-property, .cm-s-bespin span.cm-attribute {color: #54be0d;}
|
22
|
+
.cm-s-bespin span.cm-keyword {color: #cf6a4c;}
|
23
|
+
.cm-s-bespin span.cm-string {color: #f9ee98;}
|
24
|
+
|
25
|
+
.cm-s-bespin span.cm-variable {color: #54be0d;}
|
26
|
+
.cm-s-bespin span.cm-variable-2 {color: #5ea6ea;}
|
27
|
+
.cm-s-bespin span.cm-def {color: #cf7d34;}
|
28
|
+
.cm-s-bespin span.cm-error {background: #cf6a4c; color: #797977;}
|
29
|
+
.cm-s-bespin span.cm-bracket {color: #9d9b97;}
|
30
|
+
.cm-s-bespin span.cm-tag {color: #cf6a4c;}
|
31
|
+
.cm-s-bespin span.cm-link {color: #9b859d;}
|
32
|
+
|
33
|
+
.cm-s-bespin .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
34
|
+
.cm-s-bespin .CodeMirror-activeline-background { background: #404040; }
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Name: Hopscotch
|
4
|
+
Author: Jan T. Sott
|
5
|
+
|
6
|
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
7
|
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
8
|
+
|
9
|
+
*/
|
10
|
+
|
11
|
+
.cm-s-hopscotch.CodeMirror {background: #322931; color: #d5d3d5;}
|
12
|
+
.cm-s-hopscotch div.CodeMirror-selected {background: #433b42 !important;}
|
13
|
+
.cm-s-hopscotch .CodeMirror-gutters {background: #322931; border-right: 0px;}
|
14
|
+
.cm-s-hopscotch .CodeMirror-linenumber {color: #797379;}
|
15
|
+
.cm-s-hopscotch .CodeMirror-cursor {border-left: 1px solid #989498 !important;}
|
16
|
+
|
17
|
+
.cm-s-hopscotch span.cm-comment {color: #b33508;}
|
18
|
+
.cm-s-hopscotch span.cm-atom {color: #c85e7c;}
|
19
|
+
.cm-s-hopscotch span.cm-number {color: #c85e7c;}
|
20
|
+
|
21
|
+
.cm-s-hopscotch span.cm-property, .cm-s-hopscotch span.cm-attribute {color: #8fc13e;}
|
22
|
+
.cm-s-hopscotch span.cm-keyword {color: #dd464c;}
|
23
|
+
.cm-s-hopscotch span.cm-string {color: #fdcc59;}
|
24
|
+
|
25
|
+
.cm-s-hopscotch span.cm-variable {color: #8fc13e;}
|
26
|
+
.cm-s-hopscotch span.cm-variable-2 {color: #1290bf;}
|
27
|
+
.cm-s-hopscotch span.cm-def {color: #fd8b19;}
|
28
|
+
.cm-s-hopscotch span.cm-error {background: #dd464c; color: #989498;}
|
29
|
+
.cm-s-hopscotch span.cm-bracket {color: #d5d3d5;}
|
30
|
+
.cm-s-hopscotch span.cm-tag {color: #dd464c;}
|
31
|
+
.cm-s-hopscotch span.cm-link {color: #c85e7c;}
|
32
|
+
|
33
|
+
.cm-s-hopscotch .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
34
|
+
.cm-s-hopscotch .CodeMirror-activeline-background { background: #302020; }
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Name: Isotope
|
4
|
+
Author: David Desandro / Jan T. Sott
|
5
|
+
|
6
|
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
7
|
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
8
|
+
|
9
|
+
*/
|
10
|
+
|
11
|
+
.cm-s-isotope.CodeMirror {background: #000000; color: #e0e0e0;}
|
12
|
+
.cm-s-isotope div.CodeMirror-selected {background: #404040 !important;}
|
13
|
+
.cm-s-isotope .CodeMirror-gutters {background: #000000; border-right: 0px;}
|
14
|
+
.cm-s-isotope .CodeMirror-linenumber {color: #808080;}
|
15
|
+
.cm-s-isotope .CodeMirror-cursor {border-left: 1px solid #c0c0c0 !important;}
|
16
|
+
|
17
|
+
.cm-s-isotope span.cm-comment {color: #3300ff;}
|
18
|
+
.cm-s-isotope span.cm-atom {color: #cc00ff;}
|
19
|
+
.cm-s-isotope span.cm-number {color: #cc00ff;}
|
20
|
+
|
21
|
+
.cm-s-isotope span.cm-property, .cm-s-isotope span.cm-attribute {color: #33ff00;}
|
22
|
+
.cm-s-isotope span.cm-keyword {color: #ff0000;}
|
23
|
+
.cm-s-isotope span.cm-string {color: #ff0099;}
|
24
|
+
|
25
|
+
.cm-s-isotope span.cm-variable {color: #33ff00;}
|
26
|
+
.cm-s-isotope span.cm-variable-2 {color: #0066ff;}
|
27
|
+
.cm-s-isotope span.cm-def {color: #ff9900;}
|
28
|
+
.cm-s-isotope span.cm-error {background: #ff0000; color: #c0c0c0;}
|
29
|
+
.cm-s-isotope span.cm-bracket {color: #e0e0e0;}
|
30
|
+
.cm-s-isotope span.cm-tag {color: #ff0000;}
|
31
|
+
.cm-s-isotope span.cm-link {color: #cc00ff;}
|
32
|
+
|
33
|
+
.cm-s-isotope .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
34
|
+
.cm-s-isotope .CodeMirror-activeline-background { background: #202020; }
|
@@ -4,17 +4,17 @@
|
|
4
4
|
line-height: 1.2em;
|
5
5
|
font-size: 1em;
|
6
6
|
}
|
7
|
-
.CodeMirror-focused .cm-matchhighlight {
|
7
|
+
.cm-s-liquibyte .CodeMirror-focused .cm-matchhighlight {
|
8
8
|
text-decoration: underline;
|
9
9
|
text-decoration-color: #0f0;
|
10
10
|
text-decoration-style: wavy;
|
11
11
|
}
|
12
|
-
.cm-trailingspace {
|
12
|
+
.cm-s-liquibyte .cm-trailingspace {
|
13
13
|
text-decoration: line-through;
|
14
14
|
text-decoration-color: #f00;
|
15
15
|
text-decoration-style: dotted;
|
16
16
|
}
|
17
|
-
.cm-tab {
|
17
|
+
.cm-s-liquibyte .cm-tab {
|
18
18
|
text-decoration: line-through;
|
19
19
|
text-decoration-color: #404040;
|
20
20
|
text-decoration-style: dotted;
|
@@ -54,42 +54,42 @@
|
|
54
54
|
.cm-s-liquibyte .CodeMirror-activeline-background { background-color: rgba(0, 255, 0, 0.15); }
|
55
55
|
|
56
56
|
/* Default styles for common addons */
|
57
|
-
|
58
|
-
|
57
|
+
.cm-s-liquibyte .CodeMirror span.CodeMirror-matchingbracket { color: #0f0; font-weight: bold; }
|
58
|
+
.cm-s-liquibyte .CodeMirror span.CodeMirror-nonmatchingbracket { color: #f00; font-weight: bold; }
|
59
59
|
.CodeMirror-matchingtag { background-color: rgba(150, 255, 0, .3); }
|
60
60
|
/* Scrollbars */
|
61
61
|
/* Simple */
|
62
|
-
div.CodeMirror-simplescroll-horizontal div:hover, div.CodeMirror-simplescroll-vertical div:hover {
|
62
|
+
.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div:hover, div.CodeMirror-simplescroll-vertical div:hover {
|
63
63
|
background-color: rgba(80, 80, 80, .7);
|
64
64
|
}
|
65
|
-
div.CodeMirror-simplescroll-horizontal div, div.CodeMirror-simplescroll-vertical div {
|
65
|
+
.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div, div.CodeMirror-simplescroll-vertical div {
|
66
66
|
background-color: rgba(80, 80, 80, .3);
|
67
67
|
border: 1px solid #404040;
|
68
68
|
border-radius: 5px;
|
69
69
|
}
|
70
|
-
div.CodeMirror-simplescroll-vertical div {
|
70
|
+
.cm-s-liquibyte div.CodeMirror-simplescroll-vertical div {
|
71
71
|
border-top: 1px solid #404040;
|
72
72
|
border-bottom: 1px solid #404040;
|
73
73
|
}
|
74
|
-
div.CodeMirror-simplescroll-horizontal div {
|
74
|
+
.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div {
|
75
75
|
border-left: 1px solid #404040;
|
76
76
|
border-right: 1px solid #404040;
|
77
77
|
}
|
78
|
-
div.CodeMirror-simplescroll-vertical {
|
78
|
+
.cm-s-liquibyte div.CodeMirror-simplescroll-vertical {
|
79
79
|
background-color: #262626;
|
80
80
|
}
|
81
|
-
div.CodeMirror-simplescroll-horizontal {
|
81
|
+
.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal {
|
82
82
|
background-color: #262626;
|
83
83
|
border-top: 1px solid #404040;
|
84
84
|
}
|
85
85
|
/* Overlay */
|
86
|
-
div.CodeMirror-overlayscroll-horizontal div, div.CodeMirror-overlayscroll-vertical div {
|
86
|
+
.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div, div.CodeMirror-overlayscroll-vertical div {
|
87
87
|
background-color: #404040;
|
88
88
|
border-radius: 5px;
|
89
89
|
}
|
90
|
-
div.CodeMirror-overlayscroll-vertical div {
|
90
|
+
.cm-s-liquibyte div.CodeMirror-overlayscroll-vertical div {
|
91
91
|
border: 1px solid #404040;
|
92
92
|
}
|
93
|
-
div.CodeMirror-overlayscroll-horizontal div {
|
93
|
+
.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div {
|
94
94
|
border: 1px solid #404040;
|
95
95
|
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Name: Railscasts
|
4
|
+
Author: Ryan Bates (http://railscasts.com)
|
5
|
+
|
6
|
+
CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
|
7
|
+
Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
|
8
|
+
|
9
|
+
*/
|
10
|
+
|
11
|
+
.cm-s-railscasts.CodeMirror {background: #2b2b2b; color: #f4f1ed;}
|
12
|
+
.cm-s-railscasts div.CodeMirror-selected {background: #272935 !important;}
|
13
|
+
.cm-s-railscasts .CodeMirror-gutters {background: #2b2b2b; border-right: 0px;}
|
14
|
+
.cm-s-railscasts .CodeMirror-linenumber {color: #5a647e;}
|
15
|
+
.cm-s-railscasts .CodeMirror-cursor {border-left: 1px solid #d4cfc9 !important;}
|
16
|
+
|
17
|
+
.cm-s-railscasts span.cm-comment {color: #bc9458;}
|
18
|
+
.cm-s-railscasts span.cm-atom {color: #b6b3eb;}
|
19
|
+
.cm-s-railscasts span.cm-number {color: #b6b3eb;}
|
20
|
+
|
21
|
+
.cm-s-railscasts span.cm-property, .cm-s-railscasts span.cm-attribute {color: #a5c261;}
|
22
|
+
.cm-s-railscasts span.cm-keyword {color: #da4939;}
|
23
|
+
.cm-s-railscasts span.cm-string {color: #ffc66d;}
|
24
|
+
|
25
|
+
.cm-s-railscasts span.cm-variable {color: #a5c261;}
|
26
|
+
.cm-s-railscasts span.cm-variable-2 {color: #6d9cbe;}
|
27
|
+
.cm-s-railscasts span.cm-def {color: #cc7833;}
|
28
|
+
.cm-s-railscasts span.cm-error {background: #da4939; color: #d4cfc9;}
|
29
|
+
.cm-s-railscasts span.cm-bracket {color: #f4f1ed;}
|
30
|
+
.cm-s-railscasts span.cm-tag {color: #da4939;}
|
31
|
+
.cm-s-railscasts span.cm-link {color: #b6b3eb;}
|
32
|
+
|
33
|
+
.cm-s-railscasts .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
|
34
|
+
.cm-s-railscasts .CodeMirror-activeline-background { background: #303040; }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codemirror-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '5.
|
4
|
+
version: '5.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Fixler
|
@@ -314,7 +314,6 @@ files:
|
|
314
314
|
- vendor/assets/javascripts/codemirror/modes/javascript.js
|
315
315
|
- vendor/assets/javascripts/codemirror/modes/jinja2.js
|
316
316
|
- vendor/assets/javascripts/codemirror/modes/julia.js
|
317
|
-
- vendor/assets/javascripts/codemirror/modes/kotlin.js
|
318
317
|
- vendor/assets/javascripts/codemirror/modes/livescript.js
|
319
318
|
- vendor/assets/javascripts/codemirror/modes/lua.js
|
320
319
|
- vendor/assets/javascripts/codemirror/modes/markdown.js
|
@@ -325,6 +324,7 @@ files:
|
|
325
324
|
- vendor/assets/javascripts/codemirror/modes/mscgen.js
|
326
325
|
- vendor/assets/javascripts/codemirror/modes/mumps.js
|
327
326
|
- vendor/assets/javascripts/codemirror/modes/nginx.js
|
327
|
+
- vendor/assets/javascripts/codemirror/modes/nsis.js
|
328
328
|
- vendor/assets/javascripts/codemirror/modes/ntriples.js
|
329
329
|
- vendor/assets/javascripts/codemirror/modes/octave.js
|
330
330
|
- vendor/assets/javascripts/codemirror/modes/oz.js
|
@@ -397,6 +397,7 @@ files:
|
|
397
397
|
- vendor/assets/stylesheets/codemirror/themes/ambiance.css
|
398
398
|
- vendor/assets/stylesheets/codemirror/themes/base16-dark.css
|
399
399
|
- vendor/assets/stylesheets/codemirror/themes/base16-light.css
|
400
|
+
- vendor/assets/stylesheets/codemirror/themes/bespin.css
|
400
401
|
- vendor/assets/stylesheets/codemirror/themes/blackboard.css
|
401
402
|
- vendor/assets/stylesheets/codemirror/themes/cobalt.css
|
402
403
|
- vendor/assets/stylesheets/codemirror/themes/colorforth.css
|
@@ -404,7 +405,9 @@ files:
|
|
404
405
|
- vendor/assets/stylesheets/codemirror/themes/eclipse.css
|
405
406
|
- vendor/assets/stylesheets/codemirror/themes/elegant.css
|
406
407
|
- vendor/assets/stylesheets/codemirror/themes/erlang-dark.css
|
408
|
+
- vendor/assets/stylesheets/codemirror/themes/hopscotch.css
|
407
409
|
- vendor/assets/stylesheets/codemirror/themes/icecoder.css
|
410
|
+
- vendor/assets/stylesheets/codemirror/themes/isotope.css
|
408
411
|
- vendor/assets/stylesheets/codemirror/themes/lesser-dark.css
|
409
412
|
- vendor/assets/stylesheets/codemirror/themes/liquibyte.css
|
410
413
|
- vendor/assets/stylesheets/codemirror/themes/material.css
|
@@ -418,6 +421,7 @@ files:
|
|
418
421
|
- vendor/assets/stylesheets/codemirror/themes/paraiso-dark.css
|
419
422
|
- vendor/assets/stylesheets/codemirror/themes/paraiso-light.css
|
420
423
|
- vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css
|
424
|
+
- vendor/assets/stylesheets/codemirror/themes/railscasts.css
|
421
425
|
- vendor/assets/stylesheets/codemirror/themes/rubyblue.css
|
422
426
|
- vendor/assets/stylesheets/codemirror/themes/seti.css
|
423
427
|
- vendor/assets/stylesheets/codemirror/themes/solarized.css
|
@@ -1,284 +0,0 @@
|
|
1
|
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
-
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
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
|
-
|
14
|
-
CodeMirror.defineMode("kotlin", function (config, parserConfig) {
|
15
|
-
function words(str) {
|
16
|
-
var obj = {}, words = str.split(" ");
|
17
|
-
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
18
|
-
return obj;
|
19
|
-
}
|
20
|
-
|
21
|
-
var multiLineStrings = parserConfig.multiLineStrings;
|
22
|
-
|
23
|
-
var keywords = words(
|
24
|
-
"package continue return object while break class data trait interface throw super" +
|
25
|
-
" when type this else This try val var fun for is in if do as true false null get set");
|
26
|
-
var softKeywords = words("import" +
|
27
|
-
" where by get set abstract enum open annotation override private public internal" +
|
28
|
-
" protected catch out vararg inline finally final ref");
|
29
|
-
var blockKeywords = words("catch class do else finally for if where try while enum");
|
30
|
-
var atoms = words("null true false this");
|
31
|
-
|
32
|
-
var curPunc;
|
33
|
-
|
34
|
-
function tokenBase(stream, state) {
|
35
|
-
var ch = stream.next();
|
36
|
-
if (ch == '"' || ch == "'") {
|
37
|
-
return startString(ch, stream, state);
|
38
|
-
}
|
39
|
-
// Wildcard import w/o trailing semicolon (import smth.*)
|
40
|
-
if (ch == "." && stream.eat("*")) {
|
41
|
-
return "word";
|
42
|
-
}
|
43
|
-
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
44
|
-
curPunc = ch;
|
45
|
-
return null;
|
46
|
-
}
|
47
|
-
if (/\d/.test(ch)) {
|
48
|
-
if (stream.eat(/eE/)) {
|
49
|
-
stream.eat(/\+\-/);
|
50
|
-
stream.eatWhile(/\d/);
|
51
|
-
}
|
52
|
-
return "number";
|
53
|
-
}
|
54
|
-
if (ch == "/") {
|
55
|
-
if (stream.eat("*")) {
|
56
|
-
state.tokenize.push(tokenComment);
|
57
|
-
return tokenComment(stream, state);
|
58
|
-
}
|
59
|
-
if (stream.eat("/")) {
|
60
|
-
stream.skipToEnd();
|
61
|
-
return "comment";
|
62
|
-
}
|
63
|
-
if (expectExpression(state.lastToken)) {
|
64
|
-
return startString(ch, stream, state);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
// Commented
|
68
|
-
if (ch == "-" && stream.eat(">")) {
|
69
|
-
curPunc = "->";
|
70
|
-
return null;
|
71
|
-
}
|
72
|
-
if (/[\-+*&%=<>!?|\/~]/.test(ch)) {
|
73
|
-
stream.eatWhile(/[\-+*&%=<>|~]/);
|
74
|
-
return "operator";
|
75
|
-
}
|
76
|
-
stream.eatWhile(/[\w\$_]/);
|
77
|
-
|
78
|
-
var cur = stream.current();
|
79
|
-
if (atoms.propertyIsEnumerable(cur)) {
|
80
|
-
return "atom";
|
81
|
-
}
|
82
|
-
if (softKeywords.propertyIsEnumerable(cur)) {
|
83
|
-
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
84
|
-
return "softKeyword";
|
85
|
-
}
|
86
|
-
|
87
|
-
if (keywords.propertyIsEnumerable(cur)) {
|
88
|
-
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
89
|
-
return "keyword";
|
90
|
-
}
|
91
|
-
return "word";
|
92
|
-
}
|
93
|
-
|
94
|
-
tokenBase.isBase = true;
|
95
|
-
|
96
|
-
function startString(quote, stream, state) {
|
97
|
-
var tripleQuoted = false;
|
98
|
-
if (quote != "/" && stream.eat(quote)) {
|
99
|
-
if (stream.eat(quote)) tripleQuoted = true;
|
100
|
-
else return "string";
|
101
|
-
}
|
102
|
-
function t(stream, state) {
|
103
|
-
var escaped = false, next, end = !tripleQuoted;
|
104
|
-
|
105
|
-
while ((next = stream.next()) != null) {
|
106
|
-
if (next == quote && !escaped) {
|
107
|
-
if (!tripleQuoted) {
|
108
|
-
break;
|
109
|
-
}
|
110
|
-
if (stream.match(quote + quote)) {
|
111
|
-
end = true;
|
112
|
-
break;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
|
117
|
-
state.tokenize.push(tokenBaseUntilBrace());
|
118
|
-
return "string";
|
119
|
-
}
|
120
|
-
|
121
|
-
if (next == "$" && !escaped && !stream.eat(" ")) {
|
122
|
-
state.tokenize.push(tokenBaseUntilSpace());
|
123
|
-
return "string";
|
124
|
-
}
|
125
|
-
escaped = !escaped && next == "\\";
|
126
|
-
}
|
127
|
-
if (multiLineStrings)
|
128
|
-
state.tokenize.push(t);
|
129
|
-
if (end) state.tokenize.pop();
|
130
|
-
return "string";
|
131
|
-
}
|
132
|
-
|
133
|
-
state.tokenize.push(t);
|
134
|
-
return t(stream, state);
|
135
|
-
}
|
136
|
-
|
137
|
-
function tokenBaseUntilBrace() {
|
138
|
-
var depth = 1;
|
139
|
-
|
140
|
-
function t(stream, state) {
|
141
|
-
if (stream.peek() == "}") {
|
142
|
-
depth--;
|
143
|
-
if (depth == 0) {
|
144
|
-
state.tokenize.pop();
|
145
|
-
return state.tokenize[state.tokenize.length - 1](stream, state);
|
146
|
-
}
|
147
|
-
} else if (stream.peek() == "{") {
|
148
|
-
depth++;
|
149
|
-
}
|
150
|
-
return tokenBase(stream, state);
|
151
|
-
}
|
152
|
-
|
153
|
-
t.isBase = true;
|
154
|
-
return t;
|
155
|
-
}
|
156
|
-
|
157
|
-
function tokenBaseUntilSpace() {
|
158
|
-
function t(stream, state) {
|
159
|
-
if (stream.eat(/[\w]/)) {
|
160
|
-
var isWord = stream.eatWhile(/[\w]/);
|
161
|
-
if (isWord) {
|
162
|
-
state.tokenize.pop();
|
163
|
-
return "word";
|
164
|
-
}
|
165
|
-
}
|
166
|
-
state.tokenize.pop();
|
167
|
-
return "string";
|
168
|
-
}
|
169
|
-
|
170
|
-
t.isBase = true;
|
171
|
-
return t;
|
172
|
-
}
|
173
|
-
|
174
|
-
function tokenComment(stream, state) {
|
175
|
-
var maybeEnd = false, ch;
|
176
|
-
while (ch = stream.next()) {
|
177
|
-
if (ch == "/" && maybeEnd) {
|
178
|
-
state.tokenize.pop();
|
179
|
-
break;
|
180
|
-
}
|
181
|
-
maybeEnd = (ch == "*");
|
182
|
-
}
|
183
|
-
return "comment";
|
184
|
-
}
|
185
|
-
|
186
|
-
function expectExpression(last) {
|
187
|
-
return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
|
188
|
-
last == "newstatement" || last == "keyword" || last == "proplabel";
|
189
|
-
}
|
190
|
-
|
191
|
-
function Context(indented, column, type, align, prev) {
|
192
|
-
this.indented = indented;
|
193
|
-
this.column = column;
|
194
|
-
this.type = type;
|
195
|
-
this.align = align;
|
196
|
-
this.prev = prev;
|
197
|
-
}
|
198
|
-
|
199
|
-
function pushContext(state, col, type) {
|
200
|
-
return state.context = new Context(state.indented, col, type, null, state.context);
|
201
|
-
}
|
202
|
-
|
203
|
-
function popContext(state) {
|
204
|
-
var t = state.context.type;
|
205
|
-
if (t == ")" || t == "]" || t == "}")
|
206
|
-
state.indented = state.context.indented;
|
207
|
-
return state.context = state.context.prev;
|
208
|
-
}
|
209
|
-
|
210
|
-
// Interface
|
211
|
-
|
212
|
-
return {
|
213
|
-
startState: function (basecolumn) {
|
214
|
-
return {
|
215
|
-
tokenize: [tokenBase],
|
216
|
-
context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
|
217
|
-
indented: 0,
|
218
|
-
startOfLine: true,
|
219
|
-
lastToken: null
|
220
|
-
};
|
221
|
-
},
|
222
|
-
|
223
|
-
token: function (stream, state) {
|
224
|
-
var ctx = state.context;
|
225
|
-
if (stream.sol()) {
|
226
|
-
if (ctx.align == null) ctx.align = false;
|
227
|
-
state.indented = stream.indentation();
|
228
|
-
state.startOfLine = true;
|
229
|
-
// Automatic semicolon insertion
|
230
|
-
if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
|
231
|
-
popContext(state);
|
232
|
-
ctx = state.context;
|
233
|
-
}
|
234
|
-
}
|
235
|
-
if (stream.eatSpace()) return null;
|
236
|
-
curPunc = null;
|
237
|
-
var style = state.tokenize[state.tokenize.length - 1](stream, state);
|
238
|
-
if (style == "comment") return style;
|
239
|
-
if (ctx.align == null) ctx.align = true;
|
240
|
-
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
241
|
-
// Handle indentation for {x -> \n ... }
|
242
|
-
else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
|
243
|
-
popContext(state);
|
244
|
-
state.context.align = false;
|
245
|
-
}
|
246
|
-
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
247
|
-
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
248
|
-
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
249
|
-
else if (curPunc == "}") {
|
250
|
-
while (ctx.type == "statement") ctx = popContext(state);
|
251
|
-
if (ctx.type == "}") ctx = popContext(state);
|
252
|
-
while (ctx.type == "statement") ctx = popContext(state);
|
253
|
-
}
|
254
|
-
else if (curPunc == ctx.type) popContext(state);
|
255
|
-
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
256
|
-
pushContext(state, stream.column(), "statement");
|
257
|
-
state.startOfLine = false;
|
258
|
-
state.lastToken = curPunc || style;
|
259
|
-
return style;
|
260
|
-
},
|
261
|
-
|
262
|
-
indent: function (state, textAfter) {
|
263
|
-
if (!state.tokenize[state.tokenize.length - 1].isBase) return 0;
|
264
|
-
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
|
265
|
-
if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
|
266
|
-
var closing = firstChar == ctx.type;
|
267
|
-
if (ctx.type == "statement") {
|
268
|
-
return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
|
269
|
-
}
|
270
|
-
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
271
|
-
else return ctx.indented + (closing ? 0 : config.indentUnit);
|
272
|
-
},
|
273
|
-
|
274
|
-
closeBrackets: {triples: "'\""},
|
275
|
-
electricChars: "{}",
|
276
|
-
blockCommentStart: "/*",
|
277
|
-
blockCommentEnd: "*/",
|
278
|
-
lineComment: "//"
|
279
|
-
};
|
280
|
-
});
|
281
|
-
|
282
|
-
CodeMirror.defineMIME("text/x-kotlin", "kotlin");
|
283
|
-
|
284
|
-
});
|