codemirror-rails 5.7 → 5.8

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codemirror/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/codemirror.js +54 -33
  4. data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +20 -7
  5. data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +77 -23
  6. data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +3 -6
  7. data/vendor/assets/javascripts/codemirror/addons/mode/multiplex.js +3 -3
  8. data/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js +9 -6
  9. data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +3 -1
  10. data/vendor/assets/javascripts/codemirror/modes/clike.js +140 -15
  11. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +0 -11
  12. data/vendor/assets/javascripts/codemirror/modes/css.js +2 -0
  13. data/vendor/assets/javascripts/codemirror/modes/cypher.js +3 -3
  14. data/vendor/assets/javascripts/codemirror/modes/dart.js +81 -1
  15. data/vendor/assets/javascripts/codemirror/modes/haxe.js +13 -4
  16. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +2 -2
  17. data/vendor/assets/javascripts/codemirror/modes/javascript.js +20 -5
  18. data/vendor/assets/javascripts/codemirror/modes/markdown.js +58 -47
  19. data/vendor/assets/javascripts/codemirror/modes/nsis.js +63 -0
  20. data/vendor/assets/javascripts/codemirror/modes/rpm.js +17 -9
  21. data/vendor/assets/stylesheets/codemirror/themes/abcdef.css +1 -1
  22. data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +1 -1
  23. data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +1 -1
  24. data/vendor/assets/stylesheets/codemirror/themes/bespin.css +34 -0
  25. data/vendor/assets/stylesheets/codemirror/themes/hopscotch.css +34 -0
  26. data/vendor/assets/stylesheets/codemirror/themes/isotope.css +34 -0
  27. data/vendor/assets/stylesheets/codemirror/themes/liquibyte.css +14 -14
  28. data/vendor/assets/stylesheets/codemirror/themes/railscasts.css +34 -0
  29. metadata +6 -2
  30. data/vendor/assets/javascripts/codemirror/modes/kotlin.js +0 -284
@@ -89,8 +89,8 @@
89
89
  tags.script.unshift(["type", configScript[i].matches, configScript[i].mode])
90
90
 
91
91
  function html(stream, state) {
92
- var tagName = state.htmlState.tagName;
93
- var tagInfo = tagName && tags[tagName.toLowerCase()];
92
+ var tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase();
93
+ var tagInfo = tagName && tags.hasOwnProperty(tagName) && tags[tagName];
94
94
 
95
95
  var style = htmlMode.token(stream, state.htmlState), modeSpec;
96
96
 
@@ -30,7 +30,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
30
30
 
31
31
  var jsKeywords = {
32
32
  "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
33
- "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, "debugger": C,
33
+ "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
34
34
  "var": kw("var"), "const": kw("var"), "let": kw("var"),
35
35
  "async": kw("async"), "function": kw("function"), "catch": kw("catch"),
36
36
  "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
@@ -56,7 +56,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
56
56
  "static": kw("static"),
57
57
 
58
58
  // types
59
- "string": type, "number": type, "bool": type, "any": type
59
+ "string": type, "number": type, "boolean": type, "any": type
60
60
  };
61
61
 
62
62
  for (var attr in tsKeywords) {
@@ -122,7 +122,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
122
122
  stream.skipToEnd();
123
123
  return ret("comment", "comment");
124
124
  } else if (state.lastType == "operator" || state.lastType == "keyword c" ||
125
- state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) {
125
+ state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) {
126
126
  readRegexp(stream);
127
127
  stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
128
128
  return ret("regexp", "string-2");
@@ -281,8 +281,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
281
281
  return false;
282
282
  }
283
283
  var state = cx.state;
284
+ cx.marked = "def";
284
285
  if (state.context) {
285
- cx.marked = "def";
286
286
  if (inList(state.localVars)) return;
287
287
  state.localVars = {name: varname, next: state.localVars};
288
288
  } else {
@@ -380,7 +380,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
380
380
  if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
381
381
  if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
382
382
  if (type == "{") return contCommasep(objprop, "}", null, maybeop);
383
- if (type == "quasi") { return pass(quasi, maybeop); }
383
+ if (type == "quasi") return pass(quasi, maybeop);
384
+ if (type == "new") return cont(maybeTarget(noComma));
384
385
  return cont();
385
386
  }
386
387
  function maybeexpression(type) {
@@ -431,6 +432,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
431
432
  findFatArrow(cx.stream, cx.state);
432
433
  return pass(type == "{" ? statement : expressionNoComma);
433
434
  }
435
+ function maybeTarget(noComma) {
436
+ return function(type) {
437
+ if (type == ".") return cont(noComma ? targetNoComma : target);
438
+ else return pass(noComma ? expressionNoComma : expression);
439
+ };
440
+ }
441
+ function target(_, value) {
442
+ if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
443
+ }
444
+ function targetNoComma(_, value) {
445
+ if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
446
+ }
434
447
  function maybelabel(type) {
435
448
  if (type == ":") return cont(poplex, statement);
436
449
  return pass(maybeoperatorComma, expect(";"), poplex);
@@ -501,6 +514,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
501
514
  }
502
515
  function pattern(type, value) {
503
516
  if (type == "variable") { register(value); return cont(); }
517
+ if (type == "spread") return cont(pattern);
504
518
  if (type == "[") return contCommasep(pattern, "]");
505
519
  if (type == "{") return contCommasep(proppattern, "}");
506
520
  }
@@ -510,6 +524,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
510
524
  return cont(maybeAssign);
511
525
  }
512
526
  if (type == "variable") cx.marked = "property";
527
+ if (type == "spread") return cont(pattern);
513
528
  return cont(expect(":"), pattern, maybeAssign);
514
529
  }
515
530
  function maybeAssign(_type, value) {
@@ -51,24 +51,36 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
51
51
  if (modeCfg.strikethrough === undefined)
52
52
  modeCfg.strikethrough = false;
53
53
 
54
+ // Allow token types to be overridden by user-provided token types.
55
+ if (modeCfg.tokenTypeOverrides === undefined)
56
+ modeCfg.tokenTypeOverrides = {};
57
+
54
58
  var codeDepth = 0;
55
59
 
56
- var header = 'header'
57
- , code = 'comment'
58
- , quote = 'quote'
59
- , list1 = 'variable-2'
60
- , list2 = 'variable-3'
61
- , list3 = 'keyword'
62
- , hr = 'hr'
63
- , image = 'tag'
64
- , formatting = 'formatting'
65
- , linkinline = 'link'
66
- , linkemail = 'link'
67
- , linktext = 'link'
68
- , linkhref = 'string'
69
- , em = 'em'
70
- , strong = 'strong'
71
- , strikethrough = 'strikethrough';
60
+ var tokenTypes = {
61
+ header: "header",
62
+ code: "comment",
63
+ quote: "quote",
64
+ list1: "variable-2",
65
+ list2: "variable-3",
66
+ list3: "keyword",
67
+ hr: "hr",
68
+ image: "tag",
69
+ formatting: "formatting",
70
+ linkInline: "link",
71
+ linkEmail: "link",
72
+ linkText: "link",
73
+ linkHref: "string",
74
+ em: "em",
75
+ strong: "strong",
76
+ strikethrough: "strikethrough"
77
+ };
78
+
79
+ for (var tokenType in tokenTypes) {
80
+ if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
81
+ tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
82
+ }
83
+ }
72
84
 
73
85
  var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
74
86
  , ulRE = /^[*\-+]\s+/
@@ -152,7 +164,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
152
164
  if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) {
153
165
  state.indentation -= 4;
154
166
  state.indentedCode = true;
155
- return code;
167
+ return tokenTypes.code;
156
168
  } else {
157
169
  return null;
158
170
  }
@@ -178,7 +190,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
178
190
  return switchInline(stream, state, footnoteLink);
179
191
  } else if (stream.match(hrRE, true)) {
180
192
  state.hr = true;
181
- return hr;
193
+ return tokenTypes.hr;
182
194
  } else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
183
195
  var listType = null;
184
196
  if (stream.match(ulRE, true)) {
@@ -231,7 +243,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
231
243
  return state.localMode.token(stream, state.localState);
232
244
  } else {
233
245
  stream.skipToEnd();
234
- return code;
246
+ return tokenTypes.code;
235
247
  }
236
248
  }
237
249
 
@@ -252,22 +264,22 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
252
264
  var styles = [];
253
265
 
254
266
  if (state.formatting) {
255
- styles.push(formatting);
267
+ styles.push(tokenTypes.formatting);
256
268
 
257
269
  if (typeof state.formatting === "string") state.formatting = [state.formatting];
258
270
 
259
271
  for (var i = 0; i < state.formatting.length; i++) {
260
- styles.push(formatting + "-" + state.formatting[i]);
272
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
261
273
 
262
274
  if (state.formatting[i] === "header") {
263
- styles.push(formatting + "-" + state.formatting[i] + "-" + state.header);
275
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
264
276
  }
265
277
 
266
278
  // Add `formatting-quote` and `formatting-quote-#` for blockquotes
267
279
  // Add `error` instead if the maximum blockquote nesting depth is passed
268
280
  if (state.formatting[i] === "quote") {
269
281
  if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
270
- styles.push(formatting + "-" + state.formatting[i] + "-" + state.quote);
282
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
271
283
  } else {
272
284
  styles.push("error");
273
285
  }
@@ -285,38 +297,36 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
285
297
  }
286
298
 
287
299
  if (state.linkHref) {
288
- styles.push(linkhref, "url");
300
+ styles.push(tokenTypes.linkHref, "url");
289
301
  } else { // Only apply inline styles to non-url text
290
- if (state.strong) { styles.push(strong); }
291
- if (state.em) { styles.push(em); }
292
- if (state.strikethrough) { styles.push(strikethrough); }
293
-
294
- if (state.linkText) { styles.push(linktext); }
295
-
296
- if (state.code) { styles.push(code); }
302
+ if (state.strong) { styles.push(tokenTypes.strong); }
303
+ if (state.em) { styles.push(tokenTypes.em); }
304
+ if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
305
+ if (state.linkText) { styles.push(tokenTypes.linkText); }
306
+ if (state.code) { styles.push(tokenTypes.code); }
297
307
  }
298
308
 
299
- if (state.header) { styles.push(header); styles.push(header + "-" + state.header); }
309
+ if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
300
310
 
301
311
  if (state.quote) {
302
- styles.push(quote);
312
+ styles.push(tokenTypes.quote);
303
313
 
304
314
  // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
305
315
  if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
306
- styles.push(quote + "-" + state.quote);
316
+ styles.push(tokenTypes.quote + "-" + state.quote);
307
317
  } else {
308
- styles.push(quote + "-" + modeCfg.maxBlockquoteDepth);
318
+ styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
309
319
  }
310
320
  }
311
321
 
312
322
  if (state.list !== false) {
313
323
  var listMod = (state.listDepth - 1) % 3;
314
324
  if (!listMod) {
315
- styles.push(list1);
325
+ styles.push(tokenTypes.list1);
316
326
  } else if (listMod === 1) {
317
- styles.push(list2);
327
+ styles.push(tokenTypes.list2);
318
328
  } else {
319
- styles.push(list3);
329
+ styles.push(tokenTypes.list3);
320
330
  }
321
331
  }
322
332
 
@@ -372,7 +382,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
372
382
  stream.next();
373
383
  if (modeCfg.highlightFormatting) {
374
384
  var type = getType(state);
375
- return type ? type + " formatting-escape" : "formatting-escape";
385
+ var formattingEscape = tokenTypes.formatting + "-escape";
386
+ return type ? type + " " + formattingEscape : formattingEscape;
376
387
  }
377
388
  }
378
389
 
@@ -386,7 +397,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
386
397
  matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
387
398
  var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
388
399
  if (stream.match(new RegExp(regex), true)) {
389
- return linkhref;
400
+ return tokenTypes.linkHref;
390
401
  }
391
402
  }
392
403
 
@@ -417,7 +428,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
417
428
  if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
418
429
  stream.match(/\[[^\]]*\]/);
419
430
  state.inline = state.f = linkHref;
420
- return image;
431
+ return tokenTypes.image;
421
432
  }
422
433
 
423
434
  if (ch === '[' && stream.match(/.*\](\(.*\)| ?\[.*\])/, false)) {
@@ -443,7 +454,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
443
454
  } else {
444
455
  type = "";
445
456
  }
446
- return type + linkinline;
457
+ return type + tokenTypes.linkInline;
447
458
  }
448
459
 
449
460
  if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
@@ -455,7 +466,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
455
466
  } else {
456
467
  type = "";
457
468
  }
458
- return type + linkemail;
469
+ return type + tokenTypes.linkEmail;
459
470
  }
460
471
 
461
472
  if (ch === '<' && stream.match(/^(!--|\w)/, false)) {
@@ -564,12 +575,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
564
575
  } else {
565
576
  type = "";
566
577
  }
567
- return type + linkinline;
578
+ return type + tokenTypes.linkInline;
568
579
  }
569
580
 
570
581
  stream.match(/^[^>]+/, true);
571
582
 
572
- return linkinline;
583
+ return tokenTypes.linkInline;
573
584
  }
574
585
 
575
586
  function linkHref(stream, state) {
@@ -630,7 +641,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
630
641
 
631
642
  stream.match(/^[^\]]+/, true);
632
643
 
633
- return linktext;
644
+ return tokenTypes.linkText;
634
645
  }
635
646
 
636
647
  function footnoteUrl(stream, state) {
@@ -647,7 +658,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
647
658
  stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
648
659
  }
649
660
  state.f = state.inline = inlineNormal;
650
- return linkhref + " url";
661
+ return tokenTypes.linkHref + " url";
651
662
  }
652
663
 
653
664
  var savedInlineRE = [];
@@ -0,0 +1,63 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ // Author: Jan T. Sott (http://github.com/idleberg)
5
+
6
+ (function(mod) {
7
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
8
+ mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
9
+ else if (typeof define == "function" && define.amd) // AMD
10
+ define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
11
+ else // Plain browser env
12
+ mod(CodeMirror);
13
+ })(function(CodeMirror) {
14
+ "use strict";
15
+
16
+ CodeMirror.defineSimpleMode("nsis",{
17
+ start:[
18
+ // Numbers
19
+ {regex: /(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/, token: "number"},
20
+ // Compile Time Commands
21
+ {regex: /(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|finalize|getdllversion|system|tempfile|warning|verbose|define|undef|insertmacro|makensis|searchparse|searchreplace))\b/, token: "keyword"},
22
+ // Conditional Compilation
23
+ {regex: /(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true},
24
+ {regex: /(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true},
25
+ // Runtime Commands
26
+ {regex: /(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|IntCmp|IntCmpU|IntFmt|IntOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetPluginUnload|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
27
+ {regex: /\b(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true},
28
+ {regex: /\b(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true},
29
+ // Options
30
+ {regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/, token: "atom"},
31
+ {regex: /\b(?:admin|all|auto|both|bottom|bzip2|components|current|custom|directory|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|right|show|silent|silentlog|textonly|top|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/, token: "builtin"},
32
+
33
+ // LogicLib
34
+ {regex: /\$\{(?:End(If|Unless|While)|Loop(?:Until)|Next)\}/, token: "variable-2", dedent: true},
35
+ {regex: /\$\{(?:Do(Until|While)|Else(?:If(?:Not)?)?|For(?:Each)?|(?:(?:And|Else|Or)?If(?:Cmd|Not|Then)?|Unless)|While)\}/, token: "variable-2", indent: true},
36
+
37
+ // Line Comment
38
+ {regex: /(#|;).*/, token: "comment"},
39
+ // Block Comment
40
+ {regex: /\/\*/, token: "comment", next: "comment"},
41
+ // Operator
42
+ {regex: /[-+\/*=<>!]+/, token: "operator"},
43
+ // Variable
44
+ {regex: /\$[\w]+/, token: "variable"},
45
+ // Constant
46
+ {regex: /\${[\w]+}/,token: "variable-2"},
47
+ // Language String
48
+ {regex: /\$\([\w]+\)/,token: "variable-3"}
49
+ ],
50
+ comment: [
51
+ {regex: /.*?\*\//, token: "comment", next: "start"},
52
+ {regex: /.*/, token: "comment"}
53
+ ],
54
+ meta: {
55
+ electricInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/,
56
+ blockCommentStart: "/*",
57
+ blockCommentEnd: "*/",
58
+ lineComment: ["#", ";"]
59
+ }
60
+ });
61
+
62
+ CodeMirror.defineMIME("text/x-nsis", "nsis");
63
+ });
@@ -34,10 +34,10 @@ CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes");
34
34
  // Quick and dirty spec file highlighting
35
35
 
36
36
  CodeMirror.defineMode("rpm-spec", function() {
37
- var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
37
+ var arch = /^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
38
38
 
39
- var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/;
40
- var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/;
39
+ var preamble = /^[a-zA-Z0-9()]+:/;
40
+ var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/;
41
41
  var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
42
42
  var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
43
43
  var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros
@@ -55,8 +55,8 @@ CodeMirror.defineMode("rpm-spec", function() {
55
55
  if (ch == "#") { stream.skipToEnd(); return "comment"; }
56
56
 
57
57
  if (stream.sol()) {
58
- if (stream.match(preamble)) { return "preamble"; }
59
- if (stream.match(section)) { return "section"; }
58
+ if (stream.match(preamble)) { return "header"; }
59
+ if (stream.match(section)) { return "atom"; }
60
60
  }
61
61
 
62
62
  if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT'
@@ -73,21 +73,29 @@ CodeMirror.defineMode("rpm-spec", function() {
73
73
  if (stream.eol()) { state.controlFlow = false; }
74
74
  }
75
75
 
76
- if (stream.match(arch)) { return "number"; }
76
+ if (stream.match(arch)) {
77
+ if (stream.eol()) { state.controlFlow = false; }
78
+ return "number";
79
+ }
77
80
 
78
81
  // Macros like '%make_install' or '%attr(0775,root,root)'
79
82
  if (stream.match(/^%[\w]+/)) {
80
83
  if (stream.match(/^\(/)) { state.macroParameters = true; }
81
- return "macro";
84
+ return "keyword";
82
85
  }
83
86
  if (state.macroParameters) {
84
87
  if (stream.match(/^\d+/)) { return "number";}
85
88
  if (stream.match(/^\)/)) {
86
89
  state.macroParameters = false;
87
- return "macro";
90
+ return "keyword";
88
91
  }
89
92
  }
90
- if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}'
93
+
94
+ // Macros like '%{defined fedora}'
95
+ if (stream.match(/^%\{\??[\w \-\:\!]+\}/)) {
96
+ if (stream.eol()) { state.controlFlow = false; }
97
+ return "def";
98
+ }
91
99
 
92
100
  //TODO: Include bash script sub-parser (CodeMirror supports that)
93
101
  stream.next();
@@ -27,6 +27,6 @@
27
27
  .cm-s-abcdef span.cm-attribute { color: #DDFF00; }
28
28
  .cm-s-abcdef span.cm-error { color: #FF0000; }
29
29
  .cm-s-abcdef span.cm-header { color: aquamarine; font-weight: bold; }
30
- .cm-s-abcdef span.cm-link { color: blue; }
30
+ .cm-s-abcdef span.cm-link { color: blueviolet; }
31
31
 
32
32
  .cm-s-abcdef .CodeMirror-activeline-background { background: #314151; }