codemirror-rails 5.13.2 → 5.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codemirror/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/codemirror.js +55 -42
  4. data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +9 -2
  5. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +1 -1
  6. data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +8 -8
  7. data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +3 -3
  8. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +25 -38
  9. data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +2 -2
  10. data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +2 -1
  11. data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +9 -6
  12. data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +24 -27
  13. data/vendor/assets/javascripts/codemirror/addons/search/search.js +5 -2
  14. data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +2 -2
  15. data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +3 -21
  16. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +24 -25
  17. data/vendor/assets/javascripts/codemirror/modes/clike.js +34 -29
  18. data/vendor/assets/javascripts/codemirror/modes/clojure.js +59 -3
  19. data/vendor/assets/javascripts/codemirror/modes/crystal.js +1 -1
  20. data/vendor/assets/javascripts/codemirror/modes/css.js +6 -6
  21. data/vendor/assets/javascripts/codemirror/modes/django.js +8 -8
  22. data/vendor/assets/javascripts/codemirror/modes/dtd.js +6 -6
  23. data/vendor/assets/javascripts/codemirror/modes/ebnf.js +1 -1
  24. data/vendor/assets/javascripts/codemirror/modes/haml.js +3 -3
  25. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +1 -1
  26. data/vendor/assets/javascripts/codemirror/modes/jade.js +3 -3
  27. data/vendor/assets/javascripts/codemirror/modes/javascript.js +15 -9
  28. data/vendor/assets/javascripts/codemirror/modes/markdown.js +11 -21
  29. data/vendor/assets/javascripts/codemirror/modes/mathematica.js +1 -0
  30. data/vendor/assets/javascripts/codemirror/modes/mbox.js +129 -0
  31. data/vendor/assets/javascripts/codemirror/modes/pegjs.js +6 -6
  32. data/vendor/assets/javascripts/codemirror/modes/perl.js +1 -1
  33. data/vendor/assets/javascripts/codemirror/modes/php.js +1 -1
  34. data/vendor/assets/javascripts/codemirror/modes/powershell.js +396 -0
  35. data/vendor/assets/javascripts/codemirror/modes/properties.js +1 -1
  36. data/vendor/assets/javascripts/codemirror/modes/puppet.js +1 -1
  37. data/vendor/assets/javascripts/codemirror/modes/python.js +20 -28
  38. data/vendor/assets/javascripts/codemirror/modes/sas.js +315 -0
  39. data/vendor/assets/javascripts/codemirror/modes/slim.js +4 -4
  40. data/vendor/assets/javascripts/codemirror/modes/sparql.js +1 -1
  41. data/vendor/assets/javascripts/codemirror/modes/sql.js +10 -2
  42. data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +78 -128
  43. data/vendor/assets/javascripts/codemirror/modes/verilog.js +1 -1
  44. data/vendor/assets/javascripts/codemirror/modes/vhdl.js +1 -1
  45. data/vendor/assets/javascripts/codemirror/modes/webidl.js +195 -0
  46. data/vendor/assets/javascripts/codemirror/modes/xquery.js +1 -1
  47. data/vendor/assets/javascripts/codemirror/modes/yacas.js +204 -0
  48. data/vendor/assets/stylesheets/codemirror.css +1 -1
  49. data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +2 -2
  50. data/vendor/assets/stylesheets/codemirror/themes/icecoder.css +4 -4
  51. metadata +6 -1
@@ -65,7 +65,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
65
65
  // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
66
66
  return "keyword";
67
67
  } else if (/^[\(\),\;\[\]]/.test(ch)) {
68
- // no highlightning
68
+ // no highlighting
69
69
  return null;
70
70
  } else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) {
71
71
  // 1-line comment
@@ -341,7 +341,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
341
341
  name: "sql",
342
342
  client: set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
343
343
  keywords: set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
344
- builtin: set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),
344
+ builtin: set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),
345
345
  operatorChars: /^[*+\-%<>!=~]/,
346
346
  dateSQL: set("date time timestamp"),
347
347
  support: set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")
@@ -371,6 +371,14 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
371
371
  support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast commentHash commentSpaceRequired")
372
372
  });
373
373
 
374
+ // Google's SQL-like query language, GQL
375
+ CodeMirror.defineMIME("text/x-gql", {
376
+ name: "sql",
377
+ keywords: set("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),
378
+ atoms: set("false true"),
379
+ builtin: set("blob datetime first key __key__ string integer double boolean null"),
380
+ operatorChars: /^[*+\-%<>!=]/
381
+ });
374
382
  }());
375
383
 
376
384
  });
@@ -16,7 +16,6 @@
16
16
  ! Info
17
17
  CoreVersion parameter is needed for TiddlyWiki only!
18
18
  ***/
19
- //{{{
20
19
 
21
20
  (function(mod) {
22
21
  if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -32,73 +31,60 @@ CodeMirror.defineMode("tiddlywiki", function () {
32
31
  // Tokenizer
33
32
  var textwords = {};
34
33
 
35
- var keywords = function () {
36
- function kw(type) {
37
- return { type: type, style: "macro"};
38
- }
39
- return {
40
- "allTags": kw('allTags'), "closeAll": kw('closeAll'), "list": kw('list'),
41
- "newJournal": kw('newJournal'), "newTiddler": kw('newTiddler'),
42
- "permaview": kw('permaview'), "saveChanges": kw('saveChanges'),
43
- "search": kw('search'), "slider": kw('slider'), "tabs": kw('tabs'),
44
- "tag": kw('tag'), "tagging": kw('tagging'), "tags": kw('tags'),
45
- "tiddler": kw('tiddler'), "timeline": kw('timeline'),
46
- "today": kw('today'), "version": kw('version'), "option": kw('option'),
47
-
48
- "with": kw('with'),
49
- "filter": kw('filter')
50
- };
51
- }();
34
+ var keywords = {
35
+ "allTags": true, "closeAll": true, "list": true,
36
+ "newJournal": true, "newTiddler": true,
37
+ "permaview": true, "saveChanges": true,
38
+ "search": true, "slider": true, "tabs": true,
39
+ "tag": true, "tagging": true, "tags": true,
40
+ "tiddler": true, "timeline": true,
41
+ "today": true, "version": true, "option": true,
42
+ "with": true, "filter": true
43
+ };
52
44
 
53
45
  var isSpaceName = /[\w_\-]/i,
54
- reHR = /^\-\-\-\-+$/, // <hr>
55
- reWikiCommentStart = /^\/\*\*\*$/, // /***
56
- reWikiCommentStop = /^\*\*\*\/$/, // ***/
57
- reBlockQuote = /^<<<$/,
46
+ reHR = /^\-\-\-\-+$/, // <hr>
47
+ reWikiCommentStart = /^\/\*\*\*$/, // /***
48
+ reWikiCommentStop = /^\*\*\*\/$/, // ***/
49
+ reBlockQuote = /^<<<$/,
58
50
 
59
- reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start
60
- reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop
61
- reXmlCodeStart = /^<!--\{\{\{-->$/, // xml block start
62
- reXmlCodeStop = /^<!--\}\}\}-->$/, // xml stop
51
+ reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start
52
+ reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop
53
+ reXmlCodeStart = /^<!--\{\{\{-->$/, // xml block start
54
+ reXmlCodeStop = /^<!--\}\}\}-->$/, // xml stop
63
55
 
64
- reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start
65
- reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop
56
+ reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start
57
+ reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop
66
58
 
67
- reUntilCodeStop = /.*?\}\}\}/;
59
+ reUntilCodeStop = /.*?\}\}\}/;
68
60
 
69
61
  function chain(stream, state, f) {
70
62
  state.tokenize = f;
71
63
  return f(stream, state);
72
64
  }
73
65
 
74
- function jsTokenBase(stream, state) {
75
- var sol = stream.sol(), ch;
66
+ function tokenBase(stream, state) {
67
+ var sol = stream.sol(), ch = stream.peek();
76
68
 
77
69
  state.block = false; // indicates the start of a code block.
78
70
 
79
- ch = stream.peek(); // don't eat, to make matching simpler
80
-
81
71
  // check start of blocks
82
72
  if (sol && /[<\/\*{}\-]/.test(ch)) {
83
73
  if (stream.match(reCodeBlockStart)) {
84
74
  state.block = true;
85
75
  return chain(stream, state, twTokenCode);
86
76
  }
87
- if (stream.match(reBlockQuote)) {
77
+ if (stream.match(reBlockQuote))
88
78
  return 'quote';
89
- }
90
- if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) {
79
+ if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop))
91
80
  return 'comment';
92
- }
93
- if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) {
81
+ if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop))
94
82
  return 'comment';
95
- }
96
- if (stream.match(reHR)) {
83
+ if (stream.match(reHR))
97
84
  return 'hr';
98
- }
99
- } // sol
100
- ch = stream.next();
85
+ }
101
86
 
87
+ stream.next();
102
88
  if (sol && /[\/\*!#;:>|]/.test(ch)) {
103
89
  if (ch == "!") { // tw header
104
90
  stream.skipToEnd();
@@ -124,95 +110,77 @@ CodeMirror.defineMode("tiddlywiki", function () {
124
110
  stream.eatWhile(">");
125
111
  return "quote";
126
112
  }
127
- if (ch == '|') {
113
+ if (ch == '|')
128
114
  return 'header';
129
- }
130
115
  }
131
116
 
132
- if (ch == '{' && stream.match(/\{\{/)) {
117
+ if (ch == '{' && stream.match(/\{\{/))
133
118
  return chain(stream, state, twTokenCode);
134
- }
135
119
 
136
120
  // rudimentary html:// file:// link matching. TW knows much more ...
137
- if (/[hf]/i.test(ch)) {
138
- if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) {
139
- return "link";
140
- }
141
- }
121
+ if (/[hf]/i.test(ch) &&
122
+ /[ti]/i.test(stream.peek()) &&
123
+ stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))
124
+ return "link";
125
+
142
126
  // just a little string indicator, don't want to have the whole string covered
143
- if (ch == '"') {
127
+ if (ch == '"')
144
128
  return 'string';
145
- }
146
- if (ch == '~') { // _no_ CamelCase indicator should be bold
129
+
130
+ if (ch == '~') // _no_ CamelCase indicator should be bold
147
131
  return 'brace';
148
- }
149
- if (/[\[\]]/.test(ch)) { // check for [[..]]
150
- if (stream.peek() == ch) {
151
- stream.next();
152
- return 'brace';
153
- }
154
- }
132
+
133
+ if (/[\[\]]/.test(ch) && stream.match(ch)) // check for [[..]]
134
+ return 'brace';
135
+
155
136
  if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting
156
137
  stream.eatWhile(isSpaceName);
157
138
  return "link";
158
139
  }
140
+
159
141
  if (/\d/.test(ch)) { // numbers
160
142
  stream.eatWhile(/\d/);
161
143
  return "number";
162
144
  }
145
+
163
146
  if (ch == "/") { // tw invisible comment
164
147
  if (stream.eat("%")) {
165
148
  return chain(stream, state, twTokenComment);
166
- }
167
- else if (stream.eat("/")) { //
149
+ } else if (stream.eat("/")) { //
168
150
  return chain(stream, state, twTokenEm);
169
151
  }
170
152
  }
171
- if (ch == "_") { // tw underline
172
- if (stream.eat("_")) {
153
+
154
+ if (ch == "_" && stream.eat("_")) // tw underline
173
155
  return chain(stream, state, twTokenUnderline);
174
- }
175
- }
156
+
176
157
  // strikethrough and mdash handling
177
- if (ch == "-") {
178
- if (stream.eat("-")) {
179
- // if strikethrough looks ugly, change CSS.
180
- if (stream.peek() != ' ')
181
- return chain(stream, state, twTokenStrike);
182
- // mdash
183
- if (stream.peek() == ' ')
184
- return 'brace';
185
- }
186
- }
187
- if (ch == "'") { // tw bold
188
- if (stream.eat("'")) {
189
- return chain(stream, state, twTokenStrong);
190
- }
191
- }
192
- if (ch == "<") { // tw macro
193
- if (stream.eat("<")) {
194
- return chain(stream, state, twTokenMacro);
195
- }
196
- }
197
- else {
198
- return null;
158
+ if (ch == "-" && stream.eat("-")) {
159
+ // if strikethrough looks ugly, change CSS.
160
+ if (stream.peek() != ' ')
161
+ return chain(stream, state, twTokenStrike);
162
+ // mdash
163
+ if (stream.peek() == ' ')
164
+ return 'brace';
199
165
  }
200
166
 
167
+ if (ch == "'" && stream.eat("'")) // tw bold
168
+ return chain(stream, state, twTokenStrong);
169
+
170
+ if (ch == "<" && stream.eat("<")) // tw macro
171
+ return chain(stream, state, twTokenMacro);
172
+
201
173
  // core macro handling
202
174
  stream.eatWhile(/[\w\$_]/);
203
- var word = stream.current(),
204
- known = textwords.propertyIsEnumerable(word) && textwords[word];
205
-
206
- return known ? known.style : null;
207
- } // jsTokenBase()
175
+ return textwords.propertyIsEnumerable(stream.current()) ? "keyword" : null
176
+ }
208
177
 
209
178
  // tw invisible comment
210
179
  function twTokenComment(stream, state) {
211
- var maybeEnd = false,
212
- ch;
180
+ var maybeEnd = false, ch;
213
181
  while (ch = stream.next()) {
214
182
  if (ch == "/" && maybeEnd) {
215
- state.tokenize = jsTokenBase;
183
+ state.tokenize = tokenBase;
216
184
  break;
217
185
  }
218
186
  maybeEnd = (ch == "%");
@@ -226,7 +194,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
226
194
  ch;
227
195
  while (ch = stream.next()) {
228
196
  if (ch == "'" && maybeEnd) {
229
- state.tokenize = jsTokenBase;
197
+ state.tokenize = tokenBase;
230
198
  break;
231
199
  }
232
200
  maybeEnd = (ch == "'");
@@ -243,12 +211,12 @@ CodeMirror.defineMode("tiddlywiki", function () {
243
211
  }
244
212
 
245
213
  if (!sb && stream.match(reUntilCodeStop)) {
246
- state.tokenize = jsTokenBase;
214
+ state.tokenize = tokenBase;
247
215
  return "comment";
248
216
  }
249
217
 
250
218
  if (sb && stream.sol() && stream.match(reCodeBlockStop)) {
251
- state.tokenize = jsTokenBase;
219
+ state.tokenize = tokenBase;
252
220
  return "comment";
253
221
  }
254
222
 
@@ -262,7 +230,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
262
230
  ch;
263
231
  while (ch = stream.next()) {
264
232
  if (ch == "/" && maybeEnd) {
265
- state.tokenize = jsTokenBase;
233
+ state.tokenize = tokenBase;
266
234
  break;
267
235
  }
268
236
  maybeEnd = (ch == "/");
@@ -276,7 +244,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
276
244
  ch;
277
245
  while (ch = stream.next()) {
278
246
  if (ch == "_" && maybeEnd) {
279
- state.tokenize = jsTokenBase;
247
+ state.tokenize = tokenBase;
280
248
  break;
281
249
  }
282
250
  maybeEnd = (ch == "_");
@@ -291,7 +259,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
291
259
 
292
260
  while (ch = stream.next()) {
293
261
  if (ch == "-" && maybeEnd) {
294
- state.tokenize = jsTokenBase;
262
+ state.tokenize = tokenBase;
295
263
  break;
296
264
  }
297
265
  maybeEnd = (ch == "-");
@@ -301,58 +269,40 @@ CodeMirror.defineMode("tiddlywiki", function () {
301
269
 
302
270
  // macro
303
271
  function twTokenMacro(stream, state) {
304
- var ch, word, known;
305
-
306
272
  if (stream.current() == '<<') {
307
273
  return 'macro';
308
274
  }
309
275
 
310
- ch = stream.next();
276
+ var ch = stream.next();
311
277
  if (!ch) {
312
- state.tokenize = jsTokenBase;
278
+ state.tokenize = tokenBase;
313
279
  return null;
314
280
  }
315
281
  if (ch == ">") {
316
282
  if (stream.peek() == '>') {
317
283
  stream.next();
318
- state.tokenize = jsTokenBase;
284
+ state.tokenize = tokenBase;
319
285
  return "macro";
320
286
  }
321
287
  }
322
288
 
323
289
  stream.eatWhile(/[\w\$_]/);
324
- word = stream.current();
325
- known = keywords.propertyIsEnumerable(word) && keywords[word];
326
-
327
- if (known) {
328
- return known.style, word;
329
- }
330
- else {
331
- return null, word;
332
- }
290
+ return keywords.propertyIsEnumerable(stream.current()) ? "keyword" : null
333
291
  }
334
292
 
335
293
  // Interface
336
294
  return {
337
295
  startState: function () {
338
- return {
339
- tokenize: jsTokenBase,
340
- indented: 0,
341
- level: 0
342
- };
296
+ return {tokenize: tokenBase};
343
297
  },
344
298
 
345
299
  token: function (stream, state) {
346
300
  if (stream.eatSpace()) return null;
347
301
  var style = state.tokenize(stream, state);
348
302
  return style;
349
- },
350
-
351
- electricChars: ""
303
+ }
352
304
  };
353
305
  });
354
306
 
355
307
  CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki");
356
308
  });
357
-
358
- //}}}
@@ -250,7 +250,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
250
250
  if (text == contextClosing) {
251
251
  return true;
252
252
  } else {
253
- // contextClosing may be mulitple keywords separated by ;
253
+ // contextClosing may be multiple keywords separated by ;
254
254
  var closingKeywords = contextClosing.split(";");
255
255
  for (var i in closingKeywords) {
256
256
  if (text == closingKeywords[i]) {
@@ -36,7 +36,7 @@ CodeMirror.defineMode("vhdl", function(config, parserConfig) {
36
36
  multiLineStrings = parserConfig.multiLineStrings;
37
37
 
38
38
  var keywords = words("abs,access,after,alias,all,and,architecture,array,assert,attribute,begin,block," +
39
- "body,buffer,bus,case,component,configuration,constant,disconnent,downto,else,elsif,end,end block,end case," +
39
+ "body,buffer,bus,case,component,configuration,constant,disconnect,downto,else,elsif,end,end block,end case," +
40
40
  "end component,end for,end generate,end if,end loop,end process,end record,end units,entity,exit,file,for," +
41
41
  "function,generate,generic,generic map,group,guarded,if,impure,in,inertial,inout,is,label,library,linkage," +
42
42
  "literal,loop,map,mod,nand,new,next,nor,null,of,on,open,or,others,out,package,package body,port,port map," +
@@ -0,0 +1,195 @@
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
+ function wordRegexp(words) {
15
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
16
+ };
17
+
18
+ var builtinArray = [
19
+ "Clamp",
20
+ "Constructor",
21
+ "EnforceRange",
22
+ "Exposed",
23
+ "ImplicitThis",
24
+ "Global", "PrimaryGlobal",
25
+ "LegacyArrayClass",
26
+ "LegacyUnenumerableNamedProperties",
27
+ "LenientThis",
28
+ "NamedConstructor",
29
+ "NewObject",
30
+ "NoInterfaceObject",
31
+ "OverrideBuiltins",
32
+ "PutForwards",
33
+ "Replaceable",
34
+ "SameObject",
35
+ "TreatNonObjectAsNull",
36
+ "TreatNullAs",
37
+ "EmptyString",
38
+ "Unforgeable",
39
+ "Unscopeable"
40
+ ];
41
+ var builtins = wordRegexp(builtinArray);
42
+
43
+ var typeArray = [
44
+ "unsigned", "short", "long", // UnsignedIntegerType
45
+ "unrestricted", "float", "double", // UnrestrictedFloatType
46
+ "boolean", "byte", "octet", // Rest of PrimitiveType
47
+ "Promise", // PromiseType
48
+ "ArrayBuffer", "DataView", "Int8Array", "Int16Array", "Int32Array",
49
+ "Uint8Array", "Uint16Array", "Uint32Array", "Uint8ClampedArray",
50
+ "Float32Array", "Float64Array", // BufferRelatedType
51
+ "ByteString", "DOMString", "USVString", "sequence", "object", "RegExp",
52
+ "Error", "DOMException", "FrozenArray", // Rest of NonAnyType
53
+ "any", // Rest of SingleType
54
+ "void" // Rest of ReturnType
55
+ ];
56
+ var types = wordRegexp(typeArray);
57
+
58
+ var keywordArray = [
59
+ "attribute", "callback", "const", "deleter", "dictionary", "enum", "getter",
60
+ "implements", "inherit", "interface", "iterable", "legacycaller", "maplike",
61
+ "partial", "required", "serializer", "setlike", "setter", "static",
62
+ "stringifier", "typedef", // ArgumentNameKeyword except
63
+ // "unrestricted"
64
+ "optional", "readonly", "or"
65
+ ];
66
+ var keywords = wordRegexp(keywordArray);
67
+
68
+ var atomArray = [
69
+ "true", "false", // BooleanLiteral
70
+ "Infinity", "NaN", // FloatLiteral
71
+ "null" // Rest of ConstValue
72
+ ];
73
+ var atoms = wordRegexp(atomArray);
74
+
75
+ CodeMirror.registerHelper("hintWords", "webidl",
76
+ builtinArray.concat(typeArray).concat(keywordArray).concat(atomArray));
77
+
78
+ var startDefArray = ["callback", "dictionary", "enum", "interface"];
79
+ var startDefs = wordRegexp(startDefArray);
80
+
81
+ var endDefArray = ["typedef"];
82
+ var endDefs = wordRegexp(endDefArray);
83
+
84
+ var singleOperators = /^[:<=>?]/;
85
+ var integers = /^-?([1-9][0-9]*|0[Xx][0-9A-Fa-f]+|0[0-7]*)/;
86
+ var floats = /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)/;
87
+ var identifiers = /^_?[A-Za-z][0-9A-Z_a-z-]*/;
88
+ var identifiersEnd = /^_?[A-Za-z][0-9A-Z_a-z-]*(?=\s*;)/;
89
+ var strings = /^"[^"]*"/;
90
+ var multilineComments = /^\/\*.*?\*\//;
91
+ var multilineCommentsStart = /^\/\*.*/;
92
+ var multilineCommentsEnd = /^.*?\*\//;
93
+
94
+ function readToken(stream, state) {
95
+ // whitespace
96
+ if (stream.eatSpace()) return null;
97
+
98
+ // comment
99
+ if (state.inComment) {
100
+ if (stream.match(multilineCommentsEnd)) {
101
+ state.inComment = false;
102
+ return "comment";
103
+ }
104
+ stream.skipToEnd();
105
+ return "comment";
106
+ }
107
+ if (stream.match("//")) {
108
+ stream.skipToEnd();
109
+ return "comment";
110
+ }
111
+ if (stream.match(multilineComments)) return "comment";
112
+ if (stream.match(multilineCommentsStart)) {
113
+ state.inComment = true;
114
+ return "comment";
115
+ }
116
+
117
+ // integer and float
118
+ if (stream.match(/^-?[0-9\.]/, false)) {
119
+ if (stream.match(integers) || stream.match(floats)) return "number";
120
+ }
121
+
122
+ // string
123
+ if (stream.match(strings)) return "string";
124
+
125
+ // identifier
126
+ if (state.startDef && stream.match(identifiers)) return "def";
127
+
128
+ if (state.endDef && stream.match(identifiersEnd)) {
129
+ state.endDef = false;
130
+ return "def";
131
+ }
132
+
133
+ if (stream.match(keywords)) return "keyword";
134
+
135
+ if (stream.match(types)) {
136
+ var lastToken = state.lastToken;
137
+ var nextToken = (stream.match(/^\s*(.+?)\b/, false) || [])[1];
138
+
139
+ if (lastToken === ":" || lastToken === "implements" ||
140
+ nextToken === "implements" || nextToken === "=") {
141
+ // Used as identifier
142
+ return "builtin";
143
+ } else {
144
+ // Used as type
145
+ return "variable-3";
146
+ }
147
+ }
148
+
149
+ if (stream.match(builtins)) return "builtin";
150
+ if (stream.match(atoms)) return "atom";
151
+ if (stream.match(identifiers)) return "variable";
152
+
153
+ // other
154
+ if (stream.match(singleOperators)) return "operator";
155
+
156
+ // unrecognized
157
+ stream.next();
158
+ return null;
159
+ };
160
+
161
+ CodeMirror.defineMode("webidl", function() {
162
+ return {
163
+ startState: function() {
164
+ return {
165
+ // Is in multiline comment
166
+ inComment: false,
167
+ // Last non-whitespace, matched token
168
+ lastToken: "",
169
+ // Next token is a definition
170
+ startDef: false,
171
+ // Last token of the statement is a definition
172
+ endDef: false
173
+ };
174
+ },
175
+ token: function(stream, state) {
176
+ var style = readToken(stream, state);
177
+
178
+ if (style) {
179
+ var cur = stream.current();
180
+ state.lastToken = cur;
181
+ if (style === "keyword") {
182
+ state.startDef = startDefs.test(cur);
183
+ state.endDef = state.endDef || endDefs.test(cur);
184
+ } else {
185
+ state.startDef = false;
186
+ }
187
+ }
188
+
189
+ return style;
190
+ }
191
+ };
192
+ });
193
+
194
+ CodeMirror.defineMIME("text/x-webidl", "webidl");
195
+ });