codemirror-rails 5.2 → 5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +34 -27
- data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +1 -2
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +1 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +14 -23
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +12 -3
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +6 -6
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +1 -1
- data/vendor/assets/javascripts/codemirror/addons/search/searchcursor.js +2 -2
- data/vendor/assets/javascripts/codemirror/addons/tern/worker.js +1 -1
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +64 -67
- data/vendor/assets/javascripts/codemirror/modes/apl.js +1 -2
- data/vendor/assets/javascripts/codemirror/modes/asn.1.js +204 -0
- data/vendor/assets/javascripts/codemirror/modes/asterisk.js +2 -4
- data/vendor/assets/javascripts/codemirror/modes/clike.js +98 -36
- data/vendor/assets/javascripts/codemirror/modes/css.js +1 -16
- data/vendor/assets/javascripts/codemirror/modes/cypher.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/dylan.js +18 -26
- data/vendor/assets/javascripts/codemirror/modes/ecl.js +1 -2
- data/vendor/assets/javascripts/codemirror/modes/eiffel.js +0 -2
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/julia.js +0 -2
- data/vendor/assets/javascripts/codemirror/modes/livescript.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/mathematica.js +175 -0
- data/vendor/assets/javascripts/codemirror/modes/php.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/pig.js +15 -25
- data/vendor/assets/javascripts/codemirror/modes/sql.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +36 -47
- data/vendor/assets/javascripts/codemirror/modes/tiki.js +8 -19
- data/vendor/assets/javascripts/codemirror/modes/ttcn-cfg.js +214 -0
- data/vendor/assets/javascripts/codemirror/modes/ttcn.js +283 -0
- data/vendor/assets/javascripts/codemirror/modes/xquery.js +30 -40
- data/vendor/assets/stylesheets/codemirror/addons/dialog/dialog.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/monokai.css +1 -0
- data/vendor/assets/stylesheets/codemirror/themes/ttcn.css +66 -0
- metadata +8 -7
- data/vendor/assets/javascripts/codemirror/addons/mode/multiplex_test.js +0 -33
- data/vendor/assets/javascripts/codemirror/modes/less_test.js +0 -54
- data/vendor/assets/javascripts/codemirror/modes/scss_test.js +0 -110
- data/vendor/assets/javascripts/codemirror/modes/test.js +0 -67
@@ -102,7 +102,7 @@ CodeMirror.defineMode("apl", function() {
|
|
102
102
|
};
|
103
103
|
},
|
104
104
|
token: function(stream, state) {
|
105
|
-
var ch, funcName
|
105
|
+
var ch, funcName;
|
106
106
|
if (stream.eatSpace()) {
|
107
107
|
return null;
|
108
108
|
}
|
@@ -163,7 +163,6 @@ CodeMirror.defineMode("apl", function() {
|
|
163
163
|
return "function jot-dot";
|
164
164
|
}
|
165
165
|
stream.eatWhile(/[\w\$_]/);
|
166
|
-
word = stream.current();
|
167
166
|
state.prev = true;
|
168
167
|
return "keyword";
|
169
168
|
}
|
@@ -0,0 +1,204 @@
|
|
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("asn.1", function(config, parserConfig) {
|
15
|
+
var indentUnit = config.indentUnit,
|
16
|
+
keywords = parserConfig.keywords || {},
|
17
|
+
cmipVerbs = parserConfig.cmipVerbs || {},
|
18
|
+
compareTypes = parserConfig.compareTypes || {},
|
19
|
+
status = parserConfig.status || {},
|
20
|
+
tags = parserConfig.tags || {},
|
21
|
+
storage = parserConfig.storage || {},
|
22
|
+
modifier = parserConfig.modifier || {},
|
23
|
+
accessTypes = parserConfig.accessTypes|| {},
|
24
|
+
multiLineStrings = parserConfig.multiLineStrings,
|
25
|
+
indentStatements = parserConfig.indentStatements !== false;
|
26
|
+
var isOperatorChar = /[\|\^]/;
|
27
|
+
var curPunc;
|
28
|
+
|
29
|
+
function tokenBase(stream, state) {
|
30
|
+
var ch = stream.next();
|
31
|
+
if (ch == '"' || ch == "'") {
|
32
|
+
state.tokenize = tokenString(ch);
|
33
|
+
return state.tokenize(stream, state);
|
34
|
+
}
|
35
|
+
if (/[\[\]\(\){}:=,;]/.test(ch)) {
|
36
|
+
curPunc = ch;
|
37
|
+
return "punctuation";
|
38
|
+
}
|
39
|
+
if (ch == "-"){
|
40
|
+
if (stream.eat("-")) {
|
41
|
+
stream.skipToEnd();
|
42
|
+
return "comment";
|
43
|
+
}
|
44
|
+
}
|
45
|
+
if (/\d/.test(ch)) {
|
46
|
+
stream.eatWhile(/[\w\.]/);
|
47
|
+
return "number";
|
48
|
+
}
|
49
|
+
if (isOperatorChar.test(ch)) {
|
50
|
+
stream.eatWhile(isOperatorChar);
|
51
|
+
return "operator";
|
52
|
+
}
|
53
|
+
|
54
|
+
stream.eatWhile(/[\w\-]/);
|
55
|
+
var cur = stream.current();
|
56
|
+
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
57
|
+
if (cmipVerbs.propertyIsEnumerable(cur)) return "variable cmipVerbs";
|
58
|
+
if (compareTypes.propertyIsEnumerable(cur)) return "atom compareTypes";
|
59
|
+
if (status.propertyIsEnumerable(cur)) return "comment status";
|
60
|
+
if (tags.propertyIsEnumerable(cur)) return "variable-3 tags";
|
61
|
+
if (storage.propertyIsEnumerable(cur)) return "builtin storage";
|
62
|
+
if (modifier.propertyIsEnumerable(cur)) return "string-2 modifier";
|
63
|
+
if (accessTypes.propertyIsEnumerable(cur)) return "atom accessTypes";
|
64
|
+
|
65
|
+
return "variable";
|
66
|
+
}
|
67
|
+
|
68
|
+
function tokenString(quote) {
|
69
|
+
return function(stream, state) {
|
70
|
+
var escaped = false, next, end = false;
|
71
|
+
while ((next = stream.next()) != null) {
|
72
|
+
if (next == quote && !escaped){
|
73
|
+
var afterNext = stream.peek();
|
74
|
+
//look if the character if the quote is like the B in '10100010'B
|
75
|
+
if (afterNext){
|
76
|
+
afterNext = afterNext.toLowerCase();
|
77
|
+
if(afterNext == "b" || afterNext == "h" || afterNext == "o")
|
78
|
+
stream.next();
|
79
|
+
}
|
80
|
+
end = true; break;
|
81
|
+
}
|
82
|
+
escaped = !escaped && next == "\\";
|
83
|
+
}
|
84
|
+
if (end || !(escaped || multiLineStrings))
|
85
|
+
state.tokenize = null;
|
86
|
+
return "string";
|
87
|
+
};
|
88
|
+
}
|
89
|
+
|
90
|
+
function Context(indented, column, type, align, prev) {
|
91
|
+
this.indented = indented;
|
92
|
+
this.column = column;
|
93
|
+
this.type = type;
|
94
|
+
this.align = align;
|
95
|
+
this.prev = prev;
|
96
|
+
}
|
97
|
+
function pushContext(state, col, type) {
|
98
|
+
var indent = state.indented;
|
99
|
+
if (state.context && state.context.type == "statement")
|
100
|
+
indent = state.context.indented;
|
101
|
+
return state.context = new Context(indent, col, type, null, state.context);
|
102
|
+
}
|
103
|
+
function popContext(state) {
|
104
|
+
var t = state.context.type;
|
105
|
+
if (t == ")" || t == "]" || t == "}")
|
106
|
+
state.indented = state.context.indented;
|
107
|
+
return state.context = state.context.prev;
|
108
|
+
}
|
109
|
+
|
110
|
+
//Interface
|
111
|
+
return {
|
112
|
+
startState: function(basecolumn) {
|
113
|
+
return {
|
114
|
+
tokenize: null,
|
115
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
116
|
+
indented: 0,
|
117
|
+
startOfLine: true
|
118
|
+
};
|
119
|
+
},
|
120
|
+
|
121
|
+
token: function(stream, state) {
|
122
|
+
var ctx = state.context;
|
123
|
+
if (stream.sol()) {
|
124
|
+
if (ctx.align == null) ctx.align = false;
|
125
|
+
state.indented = stream.indentation();
|
126
|
+
state.startOfLine = true;
|
127
|
+
}
|
128
|
+
if (stream.eatSpace()) return null;
|
129
|
+
curPunc = null;
|
130
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
131
|
+
if (style == "comment") return style;
|
132
|
+
if (ctx.align == null) ctx.align = true;
|
133
|
+
|
134
|
+
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
|
135
|
+
&& ctx.type == "statement"){
|
136
|
+
popContext(state);
|
137
|
+
}
|
138
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
139
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
140
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
141
|
+
else if (curPunc == "}") {
|
142
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
143
|
+
if (ctx.type == "}") ctx = popContext(state);
|
144
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
145
|
+
}
|
146
|
+
else if (curPunc == ctx.type) popContext(state);
|
147
|
+
else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
|
148
|
+
&& curPunc != ';') || (ctx.type == "statement"
|
149
|
+
&& curPunc == "newstatement")))
|
150
|
+
pushContext(state, stream.column(), "statement");
|
151
|
+
|
152
|
+
state.startOfLine = false;
|
153
|
+
return style;
|
154
|
+
},
|
155
|
+
|
156
|
+
electricChars: "{}",
|
157
|
+
lineComment: "--",
|
158
|
+
fold: "brace"
|
159
|
+
};
|
160
|
+
});
|
161
|
+
|
162
|
+
function words(str) {
|
163
|
+
var obj = {}, words = str.split(" ");
|
164
|
+
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
165
|
+
return obj;
|
166
|
+
}
|
167
|
+
|
168
|
+
CodeMirror.defineMIME("text/x-ttcn-asn", {
|
169
|
+
name: "asn.1",
|
170
|
+
keywords: words("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION" +
|
171
|
+
" REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED" +
|
172
|
+
" WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN" +
|
173
|
+
" IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS" +
|
174
|
+
" MINACCESS MAXACCESS REVISION STATUS DESCRIPTION" +
|
175
|
+
" SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName" +
|
176
|
+
" ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY" +
|
177
|
+
" IMPLIED EXPORTS"),
|
178
|
+
cmipVerbs: words("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"),
|
179
|
+
compareTypes: words("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY" +
|
180
|
+
" MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY" +
|
181
|
+
" OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL" +
|
182
|
+
" SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL" +
|
183
|
+
" TEXTUAL-CONVENTION"),
|
184
|
+
status: words("current deprecated mandatory obsolete"),
|
185
|
+
tags: words("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS" +
|
186
|
+
" UNIVERSAL"),
|
187
|
+
storage: words("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING" +
|
188
|
+
" UTCTime InterfaceIndex IANAifType CMIP-Attribute" +
|
189
|
+
" REAL PACKAGE PACKAGES IpAddress PhysAddress" +
|
190
|
+
" NetworkAddress BITS BMPString TimeStamp TimeTicks" +
|
191
|
+
" TruthValue RowStatus DisplayString GeneralString" +
|
192
|
+
" GraphicString IA5String NumericString" +
|
193
|
+
" PrintableString SnmpAdminAtring TeletexString" +
|
194
|
+
" UTF8String VideotexString VisibleString StringStore" +
|
195
|
+
" ISO646String T61String UniversalString Unsigned32" +
|
196
|
+
" Integer32 Gauge Gauge32 Counter Counter32 Counter64"),
|
197
|
+
modifier: words("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS" +
|
198
|
+
" GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS" +
|
199
|
+
" DEFINED"),
|
200
|
+
accessTypes: words("not-accessible accessible-for-notify read-only" +
|
201
|
+
" read-create read-write"),
|
202
|
+
multiLineStrings: true
|
203
|
+
});
|
204
|
+
});
|
@@ -65,8 +65,7 @@ CodeMirror.defineMode("asterisk", function() {
|
|
65
65
|
|
66
66
|
function basicToken(stream,state){
|
67
67
|
var cur = '';
|
68
|
-
var ch
|
69
|
-
ch = stream.next();
|
68
|
+
var ch = stream.next();
|
70
69
|
// comment
|
71
70
|
if(ch == ";") {
|
72
71
|
stream.skipToEnd();
|
@@ -136,7 +135,6 @@ CodeMirror.defineMode("asterisk", function() {
|
|
136
135
|
token: function(stream, state) {
|
137
136
|
|
138
137
|
var cur = '';
|
139
|
-
var ch = '';
|
140
138
|
if(stream.eatSpace()) return null;
|
141
139
|
// extension started
|
142
140
|
if(state.extenStart){
|
@@ -170,7 +168,7 @@ CodeMirror.defineMode("asterisk", function() {
|
|
170
168
|
} else if(state.extenPriority) {
|
171
169
|
state.extenPriority = false;
|
172
170
|
state.extenApplication = true;
|
173
|
-
|
171
|
+
stream.next(); // get comma
|
174
172
|
if(state.extenSame) return null;
|
175
173
|
stream.eatWhile(/[^,]/);
|
176
174
|
return "number";
|
@@ -16,15 +16,18 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
16
16
|
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
|
17
17
|
dontAlignCalls = parserConfig.dontAlignCalls,
|
18
18
|
keywords = parserConfig.keywords || {},
|
19
|
+
types = parserConfig.types || {},
|
19
20
|
builtin = parserConfig.builtin || {},
|
20
21
|
blockKeywords = parserConfig.blockKeywords || {},
|
22
|
+
defKeywords = parserConfig.defKeywords || {},
|
21
23
|
atoms = parserConfig.atoms || {},
|
22
24
|
hooks = parserConfig.hooks || {},
|
23
25
|
multiLineStrings = parserConfig.multiLineStrings,
|
24
|
-
indentStatements = parserConfig.indentStatements !== false
|
26
|
+
indentStatements = parserConfig.indentStatements !== false,
|
27
|
+
indentSwitch = parserConfig.indentSwitch !== false;
|
25
28
|
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
26
29
|
|
27
|
-
var curPunc;
|
30
|
+
var curPunc, isDefKeyword;
|
28
31
|
|
29
32
|
function tokenBase(stream, state) {
|
30
33
|
var ch = stream.next();
|
@@ -62,8 +65,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
62
65
|
var cur = stream.current();
|
63
66
|
if (keywords.propertyIsEnumerable(cur)) {
|
64
67
|
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
68
|
+
if (defKeywords.propertyIsEnumerable(cur)) isDefKeyword = true;
|
65
69
|
return "keyword";
|
66
70
|
}
|
71
|
+
if (types.propertyIsEnumerable(cur)) return "variable-3";
|
67
72
|
if (builtin.propertyIsEnumerable(cur)) {
|
68
73
|
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
69
74
|
return "builtin";
|
@@ -104,9 +109,12 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
104
109
|
this.align = align;
|
105
110
|
this.prev = prev;
|
106
111
|
}
|
112
|
+
function isStatement(context) {
|
113
|
+
return context.type == "statement" || context.type == "switchstatement";
|
114
|
+
}
|
107
115
|
function pushContext(state, col, type) {
|
108
116
|
var indent = state.indented;
|
109
|
-
if (state.context && state.context
|
117
|
+
if (state.context && isStatement(state.context))
|
110
118
|
indent = state.context.indented;
|
111
119
|
return state.context = new Context(indent, col, type, null, state.context);
|
112
120
|
}
|
@@ -117,6 +125,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
117
125
|
return state.context = state.context.prev;
|
118
126
|
}
|
119
127
|
|
128
|
+
function typeBefore(stream, state) {
|
129
|
+
if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
|
130
|
+
if (/\S[>*\]]\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true;
|
131
|
+
}
|
132
|
+
|
120
133
|
// Interface
|
121
134
|
|
122
135
|
return {
|
@@ -125,7 +138,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
125
138
|
tokenize: null,
|
126
139
|
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
127
140
|
indented: 0,
|
128
|
-
startOfLine: true
|
141
|
+
startOfLine: true,
|
142
|
+
prevToken: null
|
129
143
|
};
|
130
144
|
},
|
131
145
|
|
@@ -137,41 +151,59 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
137
151
|
state.startOfLine = true;
|
138
152
|
}
|
139
153
|
if (stream.eatSpace()) return null;
|
140
|
-
curPunc = null;
|
154
|
+
curPunc = isDefKeyword = null;
|
141
155
|
var style = (state.tokenize || tokenBase)(stream, state);
|
142
156
|
if (style == "comment" || style == "meta") return style;
|
143
157
|
if (ctx.align == null) ctx.align = true;
|
144
158
|
|
145
|
-
if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx
|
159
|
+
if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && isStatement(ctx)) popContext(state);
|
146
160
|
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
147
161
|
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
148
162
|
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
149
163
|
else if (curPunc == "}") {
|
150
|
-
while (ctx
|
164
|
+
while (isStatement(ctx)) ctx = popContext(state);
|
151
165
|
if (ctx.type == "}") ctx = popContext(state);
|
152
|
-
while (ctx
|
166
|
+
while (isStatement(ctx)) ctx = popContext(state);
|
153
167
|
}
|
154
168
|
else if (curPunc == ctx.type) popContext(state);
|
155
169
|
else if (indentStatements &&
|
156
170
|
(((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
|
157
|
-
(ctx
|
158
|
-
|
171
|
+
(isStatement(ctx) && curPunc == "newstatement"))) {
|
172
|
+
var type = "statement"
|
173
|
+
if (curPunc == "newstatement" && indentSwitch && stream.current() == "switch")
|
174
|
+
type = "switchstatement"
|
175
|
+
pushContext(state, stream.column(), type);
|
176
|
+
}
|
177
|
+
|
178
|
+
if (style == "variable" &&
|
179
|
+
((state.prevToken == "def" ||
|
180
|
+
(parserConfig.typeFirstDefinitions && typeBefore(stream, state) &&
|
181
|
+
stream.match(/^\s*\(/, false)))))
|
182
|
+
style = "def";
|
183
|
+
|
159
184
|
state.startOfLine = false;
|
185
|
+
state.prevToken = isDefKeyword ? "def" : style;
|
160
186
|
return style;
|
161
187
|
},
|
162
188
|
|
163
189
|
indent: function(state, textAfter) {
|
164
190
|
if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
|
165
191
|
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
166
|
-
if (ctx
|
192
|
+
if (isStatement(ctx) && firstChar == "}") ctx = ctx.prev;
|
167
193
|
var closing = firstChar == ctx.type;
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
194
|
+
var switchBlock = ctx.prev && ctx.prev.type == "switchstatement";
|
195
|
+
if (isStatement(ctx))
|
196
|
+
return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
|
197
|
+
if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
|
198
|
+
return ctx.column + (closing ? 0 : 1);
|
199
|
+
if (ctx.type == ")" && !closing)
|
200
|
+
return ctx.indented + statementIndentUnit;
|
201
|
+
|
202
|
+
return ctx.indented + (closing ? 0 : indentUnit) +
|
203
|
+
(!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
|
172
204
|
},
|
173
205
|
|
174
|
-
|
206
|
+
electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{|\})$/ : /^\s*[{}]$/,
|
175
207
|
blockCommentStart: "/*",
|
176
208
|
blockCommentEnd: "*/",
|
177
209
|
lineComment: "//",
|
@@ -184,9 +216,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
184
216
|
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
185
217
|
return obj;
|
186
218
|
}
|
187
|
-
var cKeywords = "auto if break
|
188
|
-
"
|
189
|
-
"goto while enum
|
219
|
+
var cKeywords = "auto if break case register continue return default do sizeof " +
|
220
|
+
"static else struct switch extern typedef float union for " +
|
221
|
+
"goto while enum const volatile true false";
|
222
|
+
var cTypes = "int long char short double float unsigned signed void size_t ptrdiff_t";
|
190
223
|
|
191
224
|
function cppHook(stream, state) {
|
192
225
|
if (!state.startOfLine) return false;
|
@@ -206,6 +239,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
206
239
|
return "meta";
|
207
240
|
}
|
208
241
|
|
242
|
+
function pointerHook(_stream, state) {
|
243
|
+
if (state.prevToken == "variable-3") return "variable-3";
|
244
|
+
return false;
|
245
|
+
}
|
246
|
+
|
209
247
|
function cpp11StringHook(stream, state) {
|
210
248
|
stream.backUp(1);
|
211
249
|
// Raw strings.
|
@@ -263,6 +301,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
263
301
|
words.push(prop);
|
264
302
|
}
|
265
303
|
add(mode.keywords);
|
304
|
+
add(mode.types);
|
266
305
|
add(mode.builtin);
|
267
306
|
add(mode.atoms);
|
268
307
|
if (words.length) {
|
@@ -277,9 +316,14 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
277
316
|
def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
|
278
317
|
name: "clike",
|
279
318
|
keywords: words(cKeywords),
|
319
|
+
types: words(cTypes + " bool _Complex _Bool float_t double_t intptr_t intmax_t " +
|
320
|
+
"int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t " +
|
321
|
+
"uint32_t uint64_t"),
|
280
322
|
blockKeywords: words("case do else for if switch while struct"),
|
323
|
+
defKeywords: words("struct"),
|
324
|
+
typeFirstDefinitions: true,
|
281
325
|
atoms: words("null"),
|
282
|
-
hooks: {"#": cppHook},
|
326
|
+
hooks: {"#": cppHook, "*": pointerHook},
|
283
327
|
modeProps: {fold: ["brace", "include"]}
|
284
328
|
});
|
285
329
|
|
@@ -290,10 +334,14 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
290
334
|
"this using const_cast inline public throw virtual delete mutable protected " +
|
291
335
|
"wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final " +
|
292
336
|
"static_assert override"),
|
337
|
+
types: words(cTypes + "bool wchar_t"),
|
293
338
|
blockKeywords: words("catch class do else finally for if struct switch try while"),
|
339
|
+
defKeywords: words("class namespace struct enum union"),
|
340
|
+
typeFirstDefinitions: true,
|
294
341
|
atoms: words("true false null"),
|
295
342
|
hooks: {
|
296
343
|
"#": cppHook,
|
344
|
+
"*": pointerHook,
|
297
345
|
"u": cpp11StringHook,
|
298
346
|
"U": cpp11StringHook,
|
299
347
|
"L": cpp11StringHook,
|
@@ -304,12 +352,16 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
304
352
|
|
305
353
|
def("text/x-java", {
|
306
354
|
name: "clike",
|
307
|
-
keywords: words("abstract assert
|
308
|
-
"do
|
309
|
-
"instanceof
|
310
|
-
"return
|
311
|
-
"try
|
355
|
+
keywords: words("abstract assert break case catch class const continue default " +
|
356
|
+
"do else enum extends final finally float for goto if implements import " +
|
357
|
+
"instanceof interface native new package private protected public " +
|
358
|
+
"return static strictfp super switch synchronized this throw throws transient " +
|
359
|
+
"try volatile while"),
|
360
|
+
types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " +
|
361
|
+
"Integer Long Number Object Short String StringBuffer StringBuilder Void"),
|
312
362
|
blockKeywords: words("catch class do else finally for if switch try while"),
|
363
|
+
defKeywords: words("class interface package enum"),
|
364
|
+
typeFirstDefinitions: true,
|
313
365
|
atoms: words("true false null"),
|
314
366
|
hooks: {
|
315
367
|
"@": function(stream) {
|
@@ -322,18 +374,20 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
322
374
|
|
323
375
|
def("text/x-csharp", {
|
324
376
|
name: "clike",
|
325
|
-
keywords: words("abstract as base break case catch checked class const continue" +
|
377
|
+
keywords: words("abstract as async await base break case catch checked class const continue" +
|
326
378
|
" default delegate do else enum event explicit extern finally fixed for" +
|
327
379
|
" foreach goto if implicit in interface internal is lock namespace new" +
|
328
380
|
" operator out override params private protected public readonly ref return sealed" +
|
329
381
|
" sizeof stackalloc static struct switch this throw try typeof unchecked" +
|
330
382
|
" unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
|
331
383
|
" global group into join let orderby partial remove select set value var yield"),
|
384
|
+
types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" +
|
385
|
+
" Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" +
|
386
|
+
" UInt64 bool byte char decimal double short int long object" +
|
387
|
+
" sbyte float string ushort uint ulong"),
|
332
388
|
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
333
|
-
|
334
|
-
|
335
|
-
" UInt64 bool byte char decimal double short int long object" +
|
336
|
-
" sbyte float string ushort uint ulong"),
|
389
|
+
defKeywords: words("class interface namespace struct var"),
|
390
|
+
typeFirstDefinitions: true,
|
337
391
|
atoms: words("true false null"),
|
338
392
|
hooks: {
|
339
393
|
"@": function(stream, state) {
|
@@ -366,18 +420,21 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
366
420
|
/* scala */
|
367
421
|
"abstract case catch class def do else extends false final finally for forSome if " +
|
368
422
|
"implicit import lazy match new null object override package private protected return " +
|
369
|
-
"sealed super this throw trait try
|
423
|
+
"sealed super this throw trait try type val var while with yield _ : = => <- <: " +
|
370
424
|
"<% >: # @ " +
|
371
425
|
|
372
426
|
/* package scala */
|
373
427
|
"assert assume require print println printf readLine readBoolean readByte readShort " +
|
374
428
|
"readChar readInt readLong readFloat readDouble " +
|
375
429
|
|
430
|
+
":: #:: "
|
431
|
+
),
|
432
|
+
types: words(
|
376
433
|
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
|
377
434
|
"Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
|
378
435
|
"Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
|
379
436
|
"Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
|
380
|
-
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector
|
437
|
+
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
|
381
438
|
|
382
439
|
/* package java.lang */
|
383
440
|
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
|
@@ -387,8 +444,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
387
444
|
),
|
388
445
|
multiLineStrings: true,
|
389
446
|
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
|
447
|
+
defKeywords: words("class def object package trait type val var"),
|
390
448
|
atoms: words("true false null"),
|
391
449
|
indentStatements: false,
|
450
|
+
indentSwitch: false,
|
392
451
|
hooks: {
|
393
452
|
"@": function(stream) {
|
394
453
|
stream.eatWhile(/[\w\$_]/);
|
@@ -409,15 +468,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
409
468
|
|
410
469
|
def(["x-shader/x-vertex", "x-shader/x-fragment"], {
|
411
470
|
name: "clike",
|
412
|
-
keywords: words("
|
413
|
-
"vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
|
414
|
-
"mat2 mat3 mat4 " +
|
415
|
-
"sampler1D sampler2D sampler3D samplerCube " +
|
471
|
+
keywords: words("sampler1D sampler2D sampler3D samplerCube " +
|
416
472
|
"sampler1DShadow sampler2DShadow " +
|
417
473
|
"const attribute uniform varying " +
|
418
474
|
"break continue discard return " +
|
419
475
|
"for while do if else struct " +
|
420
476
|
"in out inout"),
|
477
|
+
types: words("float int bool void " +
|
478
|
+
"vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
|
479
|
+
"mat2 mat3 mat4"),
|
421
480
|
blockKeywords: words("for while do if else struct"),
|
422
481
|
builtin: words("radians degrees sin cos tan asin acos atan " +
|
423
482
|
"pow exp log exp2 sqrt inversesqrt " +
|
@@ -461,6 +520,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
461
520
|
"gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " +
|
462
521
|
"gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " +
|
463
522
|
"gl_MaxDrawBuffers"),
|
523
|
+
indentSwitch: false,
|
464
524
|
hooks: {"#": cppHook},
|
465
525
|
modeProps: {fold: ["brace", "include"]}
|
466
526
|
});
|
@@ -470,6 +530,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
470
530
|
keywords: words(cKeywords + "as atomic async call command component components configuration event generic " +
|
471
531
|
"implementation includes interface module new norace nx_struct nx_union post provides " +
|
472
532
|
"signal task uses abstract extends"),
|
533
|
+
types: words(cTypes),
|
473
534
|
blockKeywords: words("case do else for if switch while struct"),
|
474
535
|
atoms: words("null"),
|
475
536
|
hooks: {"#": cppHook},
|
@@ -480,6 +541,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
480
541
|
name: "clike",
|
481
542
|
keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " +
|
482
543
|
"inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
|
544
|
+
types: words(cTypes),
|
483
545
|
atoms: words("YES NO NULL NILL ON OFF"),
|
484
546
|
hooks: {
|
485
547
|
"@": function(stream) {
|