codemirror-rails 5.2 → 5.3
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 +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
@@ -257,7 +257,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
|
257
257
|
}
|
258
258
|
|
259
259
|
// these keywords are used by all SQL dialects (however, a mode can still overwrite it)
|
260
|
-
var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where ";
|
260
|
+
var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where ";
|
261
261
|
|
262
262
|
// turn a space-separated list into an array
|
263
263
|
function set(str) {
|
@@ -293,7 +293,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
|
293
293
|
CodeMirror.defineMIME("text/x-mysql", {
|
294
294
|
name: "sql",
|
295
295
|
client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
|
296
|
-
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 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 diagnostics 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 get global grant grants group
|
296
|
+
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 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 diagnostics 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 get global grant grants group group_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"),
|
297
297
|
builtin: set("bool boolean bit blob decimal double 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"),
|
298
298
|
atoms: set("false true null unknown"),
|
299
299
|
operatorChars: /^[*+\-%<>!=&|^]/,
|
@@ -71,16 +71,6 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
71
71
|
return f(stream, state);
|
72
72
|
}
|
73
73
|
|
74
|
-
// Used as scratch variables to communicate multiple values without
|
75
|
-
// consing up tons of objects.
|
76
|
-
var type, content;
|
77
|
-
|
78
|
-
function ret(tp, style, cont) {
|
79
|
-
type = tp;
|
80
|
-
content = cont;
|
81
|
-
return style;
|
82
|
-
}
|
83
|
-
|
84
74
|
function jsTokenBase(stream, state) {
|
85
75
|
var sol = stream.sol(), ch;
|
86
76
|
|
@@ -95,16 +85,16 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
95
85
|
return chain(stream, state, twTokenCode);
|
96
86
|
}
|
97
87
|
if (stream.match(reBlockQuote)) {
|
98
|
-
return
|
88
|
+
return 'quote';
|
99
89
|
}
|
100
90
|
if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) {
|
101
|
-
return
|
91
|
+
return 'comment';
|
102
92
|
}
|
103
93
|
if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) {
|
104
|
-
return
|
94
|
+
return 'comment';
|
105
95
|
}
|
106
96
|
if (stream.match(reHR)) {
|
107
|
-
return
|
97
|
+
return 'hr';
|
108
98
|
}
|
109
99
|
} // sol
|
110
100
|
ch = stream.next();
|
@@ -112,30 +102,30 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
112
102
|
if (sol && /[\/\*!#;:>|]/.test(ch)) {
|
113
103
|
if (ch == "!") { // tw header
|
114
104
|
stream.skipToEnd();
|
115
|
-
return
|
105
|
+
return "header";
|
116
106
|
}
|
117
107
|
if (ch == "*") { // tw list
|
118
108
|
stream.eatWhile('*');
|
119
|
-
return
|
109
|
+
return "comment";
|
120
110
|
}
|
121
111
|
if (ch == "#") { // tw numbered list
|
122
112
|
stream.eatWhile('#');
|
123
|
-
return
|
113
|
+
return "comment";
|
124
114
|
}
|
125
115
|
if (ch == ";") { // definition list, term
|
126
116
|
stream.eatWhile(';');
|
127
|
-
return
|
117
|
+
return "comment";
|
128
118
|
}
|
129
119
|
if (ch == ":") { // definition list, description
|
130
120
|
stream.eatWhile(':');
|
131
|
-
return
|
121
|
+
return "comment";
|
132
122
|
}
|
133
123
|
if (ch == ">") { // single line quote
|
134
124
|
stream.eatWhile(">");
|
135
|
-
return
|
125
|
+
return "quote";
|
136
126
|
}
|
137
127
|
if (ch == '|') {
|
138
|
-
return
|
128
|
+
return 'header';
|
139
129
|
}
|
140
130
|
}
|
141
131
|
|
@@ -146,29 +136,29 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
146
136
|
// rudimentary html:// file:// link matching. TW knows much more ...
|
147
137
|
if (/[hf]/i.test(ch)) {
|
148
138
|
if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) {
|
149
|
-
return
|
139
|
+
return "link";
|
150
140
|
}
|
151
141
|
}
|
152
142
|
// just a little string indicator, don't want to have the whole string covered
|
153
143
|
if (ch == '"') {
|
154
|
-
return
|
144
|
+
return 'string';
|
155
145
|
}
|
156
146
|
if (ch == '~') { // _no_ CamelCase indicator should be bold
|
157
|
-
return
|
147
|
+
return 'brace';
|
158
148
|
}
|
159
149
|
if (/[\[\]]/.test(ch)) { // check for [[..]]
|
160
150
|
if (stream.peek() == ch) {
|
161
151
|
stream.next();
|
162
|
-
return
|
152
|
+
return 'brace';
|
163
153
|
}
|
164
154
|
}
|
165
155
|
if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting
|
166
156
|
stream.eatWhile(isSpaceName);
|
167
|
-
return
|
157
|
+
return "link";
|
168
158
|
}
|
169
159
|
if (/\d/.test(ch)) { // numbers
|
170
160
|
stream.eatWhile(/\d/);
|
171
|
-
return
|
161
|
+
return "number";
|
172
162
|
}
|
173
163
|
if (ch == "/") { // tw invisible comment
|
174
164
|
if (stream.eat("%")) {
|
@@ -191,7 +181,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
191
181
|
return chain(stream, state, twTokenStrike);
|
192
182
|
// mdash
|
193
183
|
if (stream.peek() == ' ')
|
194
|
-
return
|
184
|
+
return 'brace';
|
195
185
|
}
|
196
186
|
}
|
197
187
|
if (ch == "'") { // tw bold
|
@@ -205,7 +195,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
205
195
|
}
|
206
196
|
}
|
207
197
|
else {
|
208
|
-
return
|
198
|
+
return null;
|
209
199
|
}
|
210
200
|
|
211
201
|
// core macro handling
|
@@ -213,8 +203,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
213
203
|
var word = stream.current(),
|
214
204
|
known = textwords.propertyIsEnumerable(word) && textwords[word];
|
215
205
|
|
216
|
-
return known ?
|
217
|
-
|
206
|
+
return known ? known.style : null;
|
218
207
|
} // jsTokenBase()
|
219
208
|
|
220
209
|
// tw invisible comment
|
@@ -228,7 +217,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
228
217
|
}
|
229
218
|
maybeEnd = (ch == "%");
|
230
219
|
}
|
231
|
-
return
|
220
|
+
return "comment";
|
232
221
|
}
|
233
222
|
|
234
223
|
// tw strong / bold
|
@@ -242,29 +231,29 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
242
231
|
}
|
243
232
|
maybeEnd = (ch == "'");
|
244
233
|
}
|
245
|
-
return
|
234
|
+
return "strong";
|
246
235
|
}
|
247
236
|
|
248
237
|
// tw code
|
249
238
|
function twTokenCode(stream, state) {
|
250
|
-
var
|
239
|
+
var sb = state.block;
|
251
240
|
|
252
241
|
if (sb && stream.current()) {
|
253
|
-
return
|
242
|
+
return "comment";
|
254
243
|
}
|
255
244
|
|
256
245
|
if (!sb && stream.match(reUntilCodeStop)) {
|
257
246
|
state.tokenize = jsTokenBase;
|
258
|
-
return
|
247
|
+
return "comment";
|
259
248
|
}
|
260
249
|
|
261
250
|
if (sb && stream.sol() && stream.match(reCodeBlockStop)) {
|
262
251
|
state.tokenize = jsTokenBase;
|
263
|
-
return
|
252
|
+
return "comment";
|
264
253
|
}
|
265
254
|
|
266
|
-
|
267
|
-
return
|
255
|
+
stream.next();
|
256
|
+
return "comment";
|
268
257
|
}
|
269
258
|
|
270
259
|
// tw em / italic
|
@@ -278,7 +267,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
278
267
|
}
|
279
268
|
maybeEnd = (ch == "/");
|
280
269
|
}
|
281
|
-
return
|
270
|
+
return "em";
|
282
271
|
}
|
283
272
|
|
284
273
|
// tw underlined text
|
@@ -292,7 +281,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
292
281
|
}
|
293
282
|
maybeEnd = (ch == "_");
|
294
283
|
}
|
295
|
-
return
|
284
|
+
return "underlined";
|
296
285
|
}
|
297
286
|
|
298
287
|
// tw strike through text looks ugly
|
@@ -307,7 +296,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
307
296
|
}
|
308
297
|
maybeEnd = (ch == "-");
|
309
298
|
}
|
310
|
-
return
|
299
|
+
return "strikethrough";
|
311
300
|
}
|
312
301
|
|
313
302
|
// macro
|
@@ -315,19 +304,19 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
315
304
|
var ch, word, known;
|
316
305
|
|
317
306
|
if (stream.current() == '<<') {
|
318
|
-
return
|
307
|
+
return 'macro';
|
319
308
|
}
|
320
309
|
|
321
310
|
ch = stream.next();
|
322
311
|
if (!ch) {
|
323
312
|
state.tokenize = jsTokenBase;
|
324
|
-
return
|
313
|
+
return null;
|
325
314
|
}
|
326
315
|
if (ch == ">") {
|
327
316
|
if (stream.peek() == '>') {
|
328
317
|
stream.next();
|
329
318
|
state.tokenize = jsTokenBase;
|
330
|
-
return
|
319
|
+
return "macro";
|
331
320
|
}
|
332
321
|
}
|
333
322
|
|
@@ -336,10 +325,10 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|
336
325
|
known = keywords.propertyIsEnumerable(word) && keywords[word];
|
337
326
|
|
338
327
|
if (known) {
|
339
|
-
return
|
328
|
+
return known.style, word;
|
340
329
|
}
|
341
330
|
else {
|
342
|
-
return
|
331
|
+
return null, word;
|
343
332
|
}
|
344
333
|
}
|
345
334
|
|
@@ -52,35 +52,27 @@ CodeMirror.defineMode('tiki', function(config) {
|
|
52
52
|
case "{": //plugin
|
53
53
|
stream.eat("/");
|
54
54
|
stream.eatSpace();
|
55
|
-
|
56
|
-
var c;
|
57
|
-
while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c;
|
55
|
+
stream.eatWhile(/[^\s\u00a0=\"\'\/?(}]/);
|
58
56
|
state.tokenize = inPlugin;
|
59
57
|
return "tag";
|
60
|
-
break;
|
61
58
|
case "_": //bold
|
62
|
-
if (stream.eat("_"))
|
59
|
+
if (stream.eat("_"))
|
63
60
|
return chain(inBlock("strong", "__", inText));
|
64
|
-
}
|
65
61
|
break;
|
66
62
|
case "'": //italics
|
67
|
-
if (stream.eat("'"))
|
68
|
-
// Italic text
|
63
|
+
if (stream.eat("'"))
|
69
64
|
return chain(inBlock("em", "''", inText));
|
70
|
-
}
|
71
65
|
break;
|
72
66
|
case "(":// Wiki Link
|
73
|
-
if (stream.eat("("))
|
67
|
+
if (stream.eat("("))
|
74
68
|
return chain(inBlock("variable-2", "))", inText));
|
75
|
-
}
|
76
69
|
break;
|
77
70
|
case "[":// Weblink
|
78
71
|
return chain(inBlock("variable-3", "]", inText));
|
79
72
|
break;
|
80
73
|
case "|": //table
|
81
|
-
if (stream.eat("|"))
|
74
|
+
if (stream.eat("|"))
|
82
75
|
return chain(inBlock("comment", "||"));
|
83
|
-
}
|
84
76
|
break;
|
85
77
|
case "-":
|
86
78
|
if (stream.eat("=")) {//titleBar
|
@@ -90,22 +82,19 @@ CodeMirror.defineMode('tiki', function(config) {
|
|
90
82
|
}
|
91
83
|
break;
|
92
84
|
case "=": //underline
|
93
|
-
if (stream.match("=="))
|
85
|
+
if (stream.match("=="))
|
94
86
|
return chain(inBlock("tw-underline", "===", inText));
|
95
|
-
}
|
96
87
|
break;
|
97
88
|
case ":":
|
98
|
-
if (stream.eat(":"))
|
89
|
+
if (stream.eat(":"))
|
99
90
|
return chain(inBlock("comment", "::"));
|
100
|
-
}
|
101
91
|
break;
|
102
92
|
case "^": //box
|
103
93
|
return chain(inBlock("tw-box", "^"));
|
104
94
|
break;
|
105
95
|
case "~": //np
|
106
|
-
if (stream.match("np~"))
|
96
|
+
if (stream.match("np~"))
|
107
97
|
return chain(inBlock("meta", "~/np~"));
|
108
|
-
}
|
109
98
|
break;
|
110
99
|
}
|
111
100
|
|
@@ -0,0 +1,214 @@
|
|
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("ttcn-cfg", function(config, parserConfig) {
|
15
|
+
var indentUnit = config.indentUnit,
|
16
|
+
keywords = parserConfig.keywords || {},
|
17
|
+
fileNCtrlMaskOptions = parserConfig.fileNCtrlMaskOptions || {},
|
18
|
+
externalCommands = parserConfig.externalCommands || {},
|
19
|
+
multiLineStrings = parserConfig.multiLineStrings,
|
20
|
+
indentStatements = parserConfig.indentStatements !== false;
|
21
|
+
var isOperatorChar = /[\|]/;
|
22
|
+
var curPunc;
|
23
|
+
|
24
|
+
function tokenBase(stream, state) {
|
25
|
+
var ch = stream.next();
|
26
|
+
if (ch == '"' || ch == "'") {
|
27
|
+
state.tokenize = tokenString(ch);
|
28
|
+
return state.tokenize(stream, state);
|
29
|
+
}
|
30
|
+
if (/[:=]/.test(ch)) {
|
31
|
+
curPunc = ch;
|
32
|
+
return "punctuation";
|
33
|
+
}
|
34
|
+
if (ch == "#"){
|
35
|
+
stream.skipToEnd();
|
36
|
+
return "comment";
|
37
|
+
}
|
38
|
+
if (/\d/.test(ch)) {
|
39
|
+
stream.eatWhile(/[\w\.]/);
|
40
|
+
return "number";
|
41
|
+
}
|
42
|
+
if (isOperatorChar.test(ch)) {
|
43
|
+
stream.eatWhile(isOperatorChar);
|
44
|
+
return "operator";
|
45
|
+
}
|
46
|
+
if (ch == "["){
|
47
|
+
stream.eatWhile(/[\w_\]]/);
|
48
|
+
return "number sectionTitle";
|
49
|
+
}
|
50
|
+
|
51
|
+
stream.eatWhile(/[\w\$_]/);
|
52
|
+
var cur = stream.current();
|
53
|
+
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
54
|
+
if (fileNCtrlMaskOptions.propertyIsEnumerable(cur))
|
55
|
+
return "negative fileNCtrlMaskOptions";
|
56
|
+
if (externalCommands.propertyIsEnumerable(cur)) return "negative externalCommands";
|
57
|
+
|
58
|
+
return "variable";
|
59
|
+
}
|
60
|
+
|
61
|
+
function tokenString(quote) {
|
62
|
+
return function(stream, state) {
|
63
|
+
var escaped = false, next, end = false;
|
64
|
+
while ((next = stream.next()) != null) {
|
65
|
+
if (next == quote && !escaped){
|
66
|
+
var afterNext = stream.peek();
|
67
|
+
//look if the character if the quote is like the B in '10100010'B
|
68
|
+
if (afterNext){
|
69
|
+
afterNext = afterNext.toLowerCase();
|
70
|
+
if(afterNext == "b" || afterNext == "h" || afterNext == "o")
|
71
|
+
stream.next();
|
72
|
+
}
|
73
|
+
end = true; break;
|
74
|
+
}
|
75
|
+
escaped = !escaped && next == "\\";
|
76
|
+
}
|
77
|
+
if (end || !(escaped || multiLineStrings))
|
78
|
+
state.tokenize = null;
|
79
|
+
return "string";
|
80
|
+
};
|
81
|
+
}
|
82
|
+
|
83
|
+
function Context(indented, column, type, align, prev) {
|
84
|
+
this.indented = indented;
|
85
|
+
this.column = column;
|
86
|
+
this.type = type;
|
87
|
+
this.align = align;
|
88
|
+
this.prev = prev;
|
89
|
+
}
|
90
|
+
function pushContext(state, col, type) {
|
91
|
+
var indent = state.indented;
|
92
|
+
if (state.context && state.context.type == "statement")
|
93
|
+
indent = state.context.indented;
|
94
|
+
return state.context = new Context(indent, col, type, null, state.context);
|
95
|
+
}
|
96
|
+
function popContext(state) {
|
97
|
+
var t = state.context.type;
|
98
|
+
if (t == ")" || t == "]" || t == "}")
|
99
|
+
state.indented = state.context.indented;
|
100
|
+
return state.context = state.context.prev;
|
101
|
+
}
|
102
|
+
|
103
|
+
//Interface
|
104
|
+
return {
|
105
|
+
startState: function(basecolumn) {
|
106
|
+
return {
|
107
|
+
tokenize: null,
|
108
|
+
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
109
|
+
indented: 0,
|
110
|
+
startOfLine: true
|
111
|
+
};
|
112
|
+
},
|
113
|
+
|
114
|
+
token: function(stream, state) {
|
115
|
+
var ctx = state.context;
|
116
|
+
if (stream.sol()) {
|
117
|
+
if (ctx.align == null) ctx.align = false;
|
118
|
+
state.indented = stream.indentation();
|
119
|
+
state.startOfLine = true;
|
120
|
+
}
|
121
|
+
if (stream.eatSpace()) return null;
|
122
|
+
curPunc = null;
|
123
|
+
var style = (state.tokenize || tokenBase)(stream, state);
|
124
|
+
if (style == "comment") return style;
|
125
|
+
if (ctx.align == null) ctx.align = true;
|
126
|
+
|
127
|
+
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
|
128
|
+
&& ctx.type == "statement"){
|
129
|
+
popContext(state);
|
130
|
+
}
|
131
|
+
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
132
|
+
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
133
|
+
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
134
|
+
else if (curPunc == "}") {
|
135
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
136
|
+
if (ctx.type == "}") ctx = popContext(state);
|
137
|
+
while (ctx.type == "statement") ctx = popContext(state);
|
138
|
+
}
|
139
|
+
else if (curPunc == ctx.type) popContext(state);
|
140
|
+
else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
|
141
|
+
&& curPunc != ';') || (ctx.type == "statement"
|
142
|
+
&& curPunc == "newstatement")))
|
143
|
+
pushContext(state, stream.column(), "statement");
|
144
|
+
state.startOfLine = false;
|
145
|
+
return style;
|
146
|
+
},
|
147
|
+
|
148
|
+
electricChars: "{}",
|
149
|
+
lineComment: "#",
|
150
|
+
fold: "brace"
|
151
|
+
};
|
152
|
+
});
|
153
|
+
|
154
|
+
function words(str) {
|
155
|
+
var obj = {}, words = str.split(" ");
|
156
|
+
for (var i = 0; i < words.length; ++i)
|
157
|
+
obj[words[i]] = true;
|
158
|
+
return obj;
|
159
|
+
}
|
160
|
+
|
161
|
+
CodeMirror.defineMIME("text/x-ttcn-cfg", {
|
162
|
+
name: "ttcn-cfg",
|
163
|
+
keywords: words("Yes No LogFile FileMask ConsoleMask AppendFile" +
|
164
|
+
" TimeStampFormat LogEventTypes SourceInfoFormat" +
|
165
|
+
" LogEntityName LogSourceInfo DiskFullAction" +
|
166
|
+
" LogFileNumber LogFileSize MatchingHints Detailed" +
|
167
|
+
" Compact SubCategories Stack Single None Seconds" +
|
168
|
+
" DateTime Time Stop Error Retry Delete TCPPort KillTimer" +
|
169
|
+
" NumHCs UnixSocketsEnabled LocalAddress"),
|
170
|
+
fileNCtrlMaskOptions: words("TTCN_EXECUTOR TTCN_ERROR TTCN_WARNING" +
|
171
|
+
" TTCN_PORTEVENT TTCN_TIMEROP TTCN_VERDICTOP" +
|
172
|
+
" TTCN_DEFAULTOP TTCN_TESTCASE TTCN_ACTION" +
|
173
|
+
" TTCN_USER TTCN_FUNCTION TTCN_STATISTICS" +
|
174
|
+
" TTCN_PARALLEL TTCN_MATCHING TTCN_DEBUG" +
|
175
|
+
" EXECUTOR ERROR WARNING PORTEVENT TIMEROP" +
|
176
|
+
" VERDICTOP DEFAULTOP TESTCASE ACTION USER" +
|
177
|
+
" FUNCTION STATISTICS PARALLEL MATCHING DEBUG" +
|
178
|
+
" LOG_ALL LOG_NOTHING ACTION_UNQUALIFIED" +
|
179
|
+
" DEBUG_ENCDEC DEBUG_TESTPORT" +
|
180
|
+
" DEBUG_UNQUALIFIED DEFAULTOP_ACTIVATE" +
|
181
|
+
" DEFAULTOP_DEACTIVATE DEFAULTOP_EXIT" +
|
182
|
+
" DEFAULTOP_UNQUALIFIED ERROR_UNQUALIFIED" +
|
183
|
+
" EXECUTOR_COMPONENT EXECUTOR_CONFIGDATA" +
|
184
|
+
" EXECUTOR_EXTCOMMAND EXECUTOR_LOGOPTIONS" +
|
185
|
+
" EXECUTOR_RUNTIME EXECUTOR_UNQUALIFIED" +
|
186
|
+
" FUNCTION_RND FUNCTION_UNQUALIFIED" +
|
187
|
+
" MATCHING_DONE MATCHING_MCSUCCESS" +
|
188
|
+
" MATCHING_MCUNSUCC MATCHING_MMSUCCESS" +
|
189
|
+
" MATCHING_MMUNSUCC MATCHING_PCSUCCESS" +
|
190
|
+
" MATCHING_PCUNSUCC MATCHING_PMSUCCESS" +
|
191
|
+
" MATCHING_PMUNSUCC MATCHING_PROBLEM" +
|
192
|
+
" MATCHING_TIMEOUT MATCHING_UNQUALIFIED" +
|
193
|
+
" PARALLEL_PORTCONN PARALLEL_PORTMAP" +
|
194
|
+
" PARALLEL_PTC PARALLEL_UNQUALIFIED" +
|
195
|
+
" PORTEVENT_DUALRECV PORTEVENT_DUALSEND" +
|
196
|
+
" PORTEVENT_MCRECV PORTEVENT_MCSEND" +
|
197
|
+
" PORTEVENT_MMRECV PORTEVENT_MMSEND" +
|
198
|
+
" PORTEVENT_MQUEUE PORTEVENT_PCIN" +
|
199
|
+
" PORTEVENT_PCOUT PORTEVENT_PMIN" +
|
200
|
+
" PORTEVENT_PMOUT PORTEVENT_PQUEUE" +
|
201
|
+
" PORTEVENT_STATE PORTEVENT_UNQUALIFIED" +
|
202
|
+
" STATISTICS_UNQUALIFIED STATISTICS_VERDICT" +
|
203
|
+
" TESTCASE_FINISH TESTCASE_START" +
|
204
|
+
" TESTCASE_UNQUALIFIED TIMEROP_GUARD" +
|
205
|
+
" TIMEROP_READ TIMEROP_START TIMEROP_STOP" +
|
206
|
+
" TIMEROP_TIMEOUT TIMEROP_UNQUALIFIED" +
|
207
|
+
" USER_UNQUALIFIED VERDICTOP_FINAL" +
|
208
|
+
" VERDICTOP_GETVERDICT VERDICTOP_SETVERDICT" +
|
209
|
+
" VERDICTOP_UNQUALIFIED WARNING_UNQUALIFIED"),
|
210
|
+
externalCommands: words("BeginControlPart EndControlPart BeginTestCase" +
|
211
|
+
" EndTestCase"),
|
212
|
+
multiLineStrings: true
|
213
|
+
});
|
214
|
+
});
|