@checkly/playwright-core 1.48.24-maxi → 1.48.25-beta.0

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 (113) hide show
  1. package/lib/generated/bindingsControllerSource.js +7 -0
  2. package/lib/generated/storageScriptSource.js +7 -0
  3. package/lib/server/har/harRecorder.js +3 -1
  4. package/lib/server/trace/recorder/tracing.js +9 -20
  5. package/lib/utils/fileUtils.js +65 -2
  6. package/lib/vite/{traceViewer/assets/codeMirrorModule-tzBrK1V4.js → recorder/assets/codeMirrorModule-baozm8ur.js} +10 -10
  7. package/lib/vite/recorder/assets/{index-BcaUAUCW.js → index-2ElAIWFB.js} +2 -2
  8. package/lib/vite/recorder/index.html +1 -1
  9. package/lib/vite/traceViewer/assets/{codeMirrorModule-CB-2okZ8.js → codeMirrorModule-DblsdhjA.js} +2096 -2331
  10. package/lib/vite/{recorder/assets/codeMirrorModule-CR6kB851.js → traceViewer/assets/codeMirrorModule-lDjkI8Ax.js} +1 -1
  11. package/lib/vite/traceViewer/assets/{inspectorTab-BHcfR9dD.js → inspectorTab-BPzhNk9r.js} +2 -2
  12. package/lib/vite/traceViewer/assets/inspectorTab-DOc4D3cX.js +17361 -0
  13. package/lib/vite/traceViewer/assets/{defaultSettingsView-CBiB4avC.js → testServerConnection-D-tXL3sj.js} +49 -42
  14. package/lib/vite/traceViewer/assets/{workbench-DZqNXdoV.js → workbench-DLv_q9ji.js} +1 -1
  15. package/lib/vite/traceViewer/assets/workbench-DNolpp3y.js +1473 -0
  16. package/lib/vite/traceViewer/assets/xtermModule-DZP0glxx.js +5982 -0
  17. package/lib/vite/traceViewer/{embedded.DInvAijy.js → embedded.BIubxTi3.js} +1 -1
  18. package/lib/vite/traceViewer/{embedded.gzudoghF.js → embedded.DeCrOtlO.js} +4 -4
  19. package/lib/vite/traceViewer/embedded.html +3 -3
  20. package/lib/vite/traceViewer/{index.DilotR1h.js → index.CM_h9lHr.js} +7 -124
  21. package/lib/vite/traceViewer/{index.Dha3cgqs.js → index.DPD22sZn.js} +1 -1
  22. package/lib/vite/traceViewer/index.html +3 -3
  23. package/lib/vite/traceViewer/{inspectorTab.DnGm18kV.css → inspectorTab.DGJWXOSd.css} +1488 -1521
  24. package/lib/vite/traceViewer/{recorder.C88JDknq.js → recorder.BaRuS6Pc.js} +1 -1
  25. package/lib/vite/traceViewer/{recorder.DVrkq3Um.js → recorder.Fwf59ZKh.js} +3 -3
  26. package/lib/vite/traceViewer/recorder.html +2 -2
  27. package/lib/vite/traceViewer/{uiMode.2tr9k625.js → uiMode.B11wexdJ.js} +1 -1
  28. package/lib/vite/traceViewer/{uiMode.C9_OcpPU.js → uiMode.CYBsUhm_.js} +58 -90
  29. package/lib/vite/traceViewer/{uiMode.c5ORgcrX.css → uiMode.DRmgrHSk.css} +45 -7
  30. package/lib/vite/traceViewer/uiMode.html +3 -3
  31. package/lib/vite/traceViewer/{workbench.xUZSA8PY.css → workbench.BQNDbcQ0.css} +83 -320
  32. package/package.json +1 -1
  33. package/lib/client/clientStackTrace.js +0 -66
  34. package/lib/client/fileUtils.js +0 -33
  35. package/lib/client/platform.js +0 -72
  36. package/lib/client/timeoutSettings.js +0 -66
  37. package/lib/client/webSocket.js +0 -107
  38. package/lib/generated/recorderSource.js +0 -7
  39. package/lib/server/callLog.js +0 -80
  40. package/lib/server/harBackend.js +0 -158
  41. package/lib/server/localUtils.js +0 -204
  42. package/lib/server/recorder/chat.js +0 -178
  43. package/lib/server/recorder/codeGenerator.js +0 -154
  44. package/lib/server/recorder/csharp.js +0 -311
  45. package/lib/server/recorder/java.js +0 -249
  46. package/lib/server/recorder/javascript.js +0 -230
  47. package/lib/server/recorder/jsonl.js +0 -48
  48. package/lib/server/recorder/language.js +0 -45
  49. package/lib/server/recorder/python.js +0 -276
  50. package/lib/server/recorder/recorderActions.js +0 -6
  51. package/lib/server/recorder/utils.js +0 -46
  52. package/lib/server/storageScript.js +0 -161
  53. package/lib/server/timeoutSettings.js +0 -75
  54. package/lib/server/utils/ascii.js +0 -32
  55. package/lib/server/utils/comparators.js +0 -160
  56. package/lib/server/utils/crypto.js +0 -172
  57. package/lib/server/utils/debug.js +0 -39
  58. package/lib/server/utils/debugLogger.js +0 -94
  59. package/lib/server/utils/env.js +0 -54
  60. package/lib/server/utils/eventsHelper.js +0 -39
  61. package/lib/server/utils/expectUtils.js +0 -34
  62. package/lib/server/utils/fileUtils.js +0 -205
  63. package/lib/server/utils/happyEyeballs.js +0 -210
  64. package/lib/server/utils/hostPlatform.js +0 -146
  65. package/lib/server/utils/httpServer.js +0 -234
  66. package/lib/server/utils/image_tools/colorUtils.js +0 -99
  67. package/lib/server/utils/image_tools/compare.js +0 -109
  68. package/lib/server/utils/image_tools/imageChannel.js +0 -71
  69. package/lib/server/utils/image_tools/stats.js +0 -103
  70. package/lib/server/utils/linuxUtils.js +0 -59
  71. package/lib/server/utils/network.js +0 -161
  72. package/lib/server/utils/nodePlatform.js +0 -141
  73. package/lib/server/utils/pipeTransport.js +0 -83
  74. package/lib/server/utils/processLauncher.js +0 -249
  75. package/lib/server/utils/profiler.js +0 -53
  76. package/lib/server/utils/socksProxy.js +0 -571
  77. package/lib/server/utils/spawnAsync.js +0 -46
  78. package/lib/server/utils/task.js +0 -59
  79. package/lib/server/utils/userAgent.js +0 -92
  80. package/lib/server/utils/wsServer.js +0 -129
  81. package/lib/server/utils/zipFile.js +0 -76
  82. package/lib/server/utils/zones.js +0 -55
  83. package/lib/utils/glob.js +0 -84
  84. package/lib/utils/isomorphic/ariaSnapshot.js +0 -393
  85. package/lib/utils/isomorphic/assert.js +0 -26
  86. package/lib/utils/isomorphic/colors.js +0 -66
  87. package/lib/utils/isomorphic/headers.js +0 -53
  88. package/lib/utils/isomorphic/manualPromise.js +0 -108
  89. package/lib/utils/isomorphic/multimap.js +0 -74
  90. package/lib/utils/isomorphic/rtti.js +0 -42
  91. package/lib/utils/isomorphic/semaphore.js +0 -52
  92. package/lib/utils/isomorphic/stackTrace.js +0 -170
  93. package/lib/utils/isomorphic/time.js +0 -26
  94. package/lib/utils/isomorphic/timeoutRunner.js +0 -67
  95. package/lib/utils/isomorphic/types.js +0 -6
  96. package/lib/utils/mimeType.js +0 -30
  97. package/lib/utils.js +0 -448
  98. package/lib/vite/traceViewer/assets/codeMirrorModule-DZoSgqUd.js +0 -24
  99. package/lib/vite/traceViewer/assets/inspectorTab-BuJ3wAX_.js +0 -64
  100. package/lib/vite/traceViewer/assets/inspectorTab-CwgfffWb.js +0 -25143
  101. package/lib/vite/traceViewer/assets/workbench-CWZselvp.js +0 -2470
  102. package/lib/vite/traceViewer/assets/workbench-DdmJ9AJV.js +0 -9
  103. package/lib/vite/traceViewer/assets/xtermModule-Es_gt_u7.js +0 -5994
  104. package/lib/vite/traceViewer/defaultSettingsView.Dp3b_92q.css +0 -41
  105. package/lib/vite/traceViewer/embedded.Dxe2heQk.js +0 -2
  106. package/lib/vite/traceViewer/index.CB297BuW.js +0 -2
  107. package/lib/vite/traceViewer/recorder.DNMfnSiu.js +0 -2
  108. package/lib/vite/traceViewer/uiMode.Cr1tvTWS.js +0 -5
  109. /package/lib/vite/traceViewer/{codeMirrorModule.DuST8d_k.css → codeMirrorModule.Cy8X9Wtw.css} +0 -0
  110. /package/lib/vite/traceViewer/{embedded.BeldSa2G.css → embedded.DjZq4InJ.css} +0 -0
  111. /package/lib/vite/traceViewer/{index.QewjJ85u.css → index.QanXxRUb.css} +0 -0
  112. /package/lib/vite/traceViewer/{recorder.DLgqV9db.css → recorder.DBDpiNOK.css} +0 -0
  113. /package/lib/vite/traceViewer/{xtermModule.EsaqrrTX.css → xtermModule.4oRVGWQ-.css} +0 -0
@@ -1,14 +1,13 @@
1
- import { Z as getDefaultExportFromCjs } from "./inspectorTab-CwgfffWb.js";
2
- var codemirror$2 = { exports: {} };
3
- var codemirror$1 = codemirror$2.exports;
1
+ import { U as commonjsGlobal, V as getDefaultExportFromCjs } from "./inspectorTab-DOc4D3cX.js";
2
+ var codemirror$1 = { exports: {} };
4
3
  var hasRequiredCodemirror;
5
4
  function requireCodemirror() {
6
- if (hasRequiredCodemirror) return codemirror$2.exports;
5
+ if (hasRequiredCodemirror) return codemirror$1.exports;
7
6
  hasRequiredCodemirror = 1;
8
7
  (function(module, exports) {
9
8
  (function(global, factory) {
10
9
  module.exports = factory();
11
- })(codemirror$1, function() {
10
+ })(commonjsGlobal, function() {
12
11
  var userAgent = navigator.userAgent;
13
12
  var platform = navigator.platform;
14
13
  var gecko = /gecko\/\d/i.test(userAgent);
@@ -10737,11 +10736,11 @@ function requireCodemirror() {
10737
10736
  };
10738
10737
  CodeMirror.fromTextArea = fromTextArea;
10739
10738
  addLegacyProps(CodeMirror);
10740
- CodeMirror.version = "5.65.18";
10739
+ CodeMirror.version = "5.65.15";
10741
10740
  return CodeMirror;
10742
10741
  });
10743
- })(codemirror$2);
10744
- return codemirror$2.exports;
10742
+ })(codemirror$1);
10743
+ return codemirror$1.exports;
10745
10744
  }
10746
10745
  var codemirrorExports = requireCodemirror();
10747
10746
  const codemirror = /* @__PURE__ */ getDefaultExportFromCjs(codemirrorExports);
@@ -12531,7 +12530,6 @@ function requireCss() {
12531
12530
  return css.exports;
12532
12531
  }
12533
12532
  requireCss();
12534
- var htmlmixed = { exports: {} };
12535
12533
  var xml = { exports: {} };
12536
12534
  var hasRequiredXml;
12537
12535
  function requireXml() {
@@ -13254,7 +13252,7 @@ function requireJavascript() {
13254
13252
  }
13255
13253
  }
13256
13254
  }
13257
- var cx = { state: null, marked: null, cc: null };
13255
+ var cx = { state: null, column: null, marked: null, cc: null };
13258
13256
  function pass() {
13259
13257
  for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
13260
13258
  }
@@ -13996,1312 +13994,1288 @@ function requireJavascript() {
13996
13994
  })();
13997
13995
  return javascript.exports;
13998
13996
  }
13999
- var hasRequiredHtmlmixed;
14000
- function requireHtmlmixed() {
14001
- if (hasRequiredHtmlmixed) return htmlmixed.exports;
14002
- hasRequiredHtmlmixed = 1;
14003
- (function(module, exports) {
14004
- (function(mod) {
14005
- mod(requireCodemirror(), requireXml(), requireJavascript(), requireCss());
14006
- })(function(CodeMirror) {
14007
- var defaultTags = {
14008
- script: [
14009
- ["lang", /(javascript|babel)/i, "javascript"],
14010
- ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"],
14011
- ["type", /./, "text/plain"],
14012
- [null, null, "javascript"]
14013
- ],
14014
- style: [
14015
- ["lang", /^css$/i, "css"],
14016
- ["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"],
14017
- ["type", /./, "text/plain"],
14018
- [null, null, "css"]
14019
- ]
14020
- };
14021
- function maybeBackup(stream, pat, style) {
14022
- var cur = stream.current(), close = cur.search(pat);
14023
- if (close > -1) {
14024
- stream.backUp(cur.length - close);
14025
- } else if (cur.match(/<\/?$/)) {
14026
- stream.backUp(cur.length);
14027
- if (!stream.match(pat, false)) stream.match(cur);
13997
+ (function(module, exports) {
13998
+ (function(mod) {
13999
+ mod(requireCodemirror(), requireXml(), requireJavascript(), requireCss());
14000
+ })(function(CodeMirror) {
14001
+ var defaultTags = {
14002
+ script: [
14003
+ ["lang", /(javascript|babel)/i, "javascript"],
14004
+ ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"],
14005
+ ["type", /./, "text/plain"],
14006
+ [null, null, "javascript"]
14007
+ ],
14008
+ style: [
14009
+ ["lang", /^css$/i, "css"],
14010
+ ["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"],
14011
+ ["type", /./, "text/plain"],
14012
+ [null, null, "css"]
14013
+ ]
14014
+ };
14015
+ function maybeBackup(stream, pat, style) {
14016
+ var cur = stream.current(), close = cur.search(pat);
14017
+ if (close > -1) {
14018
+ stream.backUp(cur.length - close);
14019
+ } else if (cur.match(/<\/?$/)) {
14020
+ stream.backUp(cur.length);
14021
+ if (!stream.match(pat, false)) stream.match(cur);
14022
+ }
14023
+ return style;
14024
+ }
14025
+ var attrRegexpCache = {};
14026
+ function getAttrRegexp(attr) {
14027
+ var regexp = attrRegexpCache[attr];
14028
+ if (regexp) return regexp;
14029
+ return attrRegexpCache[attr] = new RegExp("\\s+" + attr + `\\s*=\\s*('|")?([^'"]+)('|")?\\s*`);
14030
+ }
14031
+ function getAttrValue(text, attr) {
14032
+ var match = text.match(getAttrRegexp(attr));
14033
+ return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : "";
14034
+ }
14035
+ function getTagRegexp(tagName, anchored) {
14036
+ return new RegExp((anchored ? "^" : "") + "</\\s*" + tagName + "\\s*>", "i");
14037
+ }
14038
+ function addTags(from, to) {
14039
+ for (var tag in from) {
14040
+ var dest = to[tag] || (to[tag] = []);
14041
+ var source = from[tag];
14042
+ for (var i = source.length - 1; i >= 0; i--)
14043
+ dest.unshift(source[i]);
14044
+ }
14045
+ }
14046
+ function findMatchingMode(tagInfo, tagText) {
14047
+ for (var i = 0; i < tagInfo.length; i++) {
14048
+ var spec = tagInfo[i];
14049
+ if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];
14050
+ }
14051
+ }
14052
+ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
14053
+ var htmlMode = CodeMirror.getMode(config, {
14054
+ name: "xml",
14055
+ htmlMode: true,
14056
+ multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
14057
+ multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag,
14058
+ allowMissingTagName: parserConfig.allowMissingTagName
14059
+ });
14060
+ var tags = {};
14061
+ var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;
14062
+ addTags(defaultTags, tags);
14063
+ if (configTags) addTags(configTags, tags);
14064
+ if (configScript) for (var i = configScript.length - 1; i >= 0; i--)
14065
+ tags.script.unshift(["type", configScript[i].matches, configScript[i].mode]);
14066
+ function html(stream, state) {
14067
+ var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName;
14068
+ if (tag && !/[<>\s\/]/.test(stream.current()) && (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) && tags.hasOwnProperty(tagName)) {
14069
+ state.inTag = tagName + " ";
14070
+ } else if (state.inTag && tag && />$/.test(stream.current())) {
14071
+ var inTag = /^([\S]+) (.*)/.exec(state.inTag);
14072
+ state.inTag = null;
14073
+ var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2]);
14074
+ var mode = CodeMirror.getMode(config, modeSpec);
14075
+ var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);
14076
+ state.token = function(stream2, state2) {
14077
+ if (stream2.match(endTagA, false)) {
14078
+ state2.token = html;
14079
+ state2.localState = state2.localMode = null;
14080
+ return null;
14081
+ }
14082
+ return maybeBackup(stream2, endTag, state2.localMode.token(stream2, state2.localState));
14083
+ };
14084
+ state.localMode = mode;
14085
+ state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, "", ""));
14086
+ } else if (state.inTag) {
14087
+ state.inTag += stream.current();
14088
+ if (stream.eol()) state.inTag += " ";
14028
14089
  }
14029
14090
  return style;
14030
14091
  }
14031
- var attrRegexpCache = {};
14032
- function getAttrRegexp(attr) {
14033
- var regexp = attrRegexpCache[attr];
14034
- if (regexp) return regexp;
14035
- return attrRegexpCache[attr] = new RegExp("\\s+" + attr + `\\s*=\\s*('|")?([^'"]+)('|")?\\s*`);
14036
- }
14037
- function getAttrValue(text, attr) {
14038
- var match = text.match(getAttrRegexp(attr));
14039
- return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : "";
14040
- }
14041
- function getTagRegexp(tagName, anchored) {
14042
- return new RegExp((anchored ? "^" : "") + "</\\s*" + tagName + "\\s*>", "i");
14043
- }
14044
- function addTags(from, to) {
14045
- for (var tag in from) {
14046
- var dest = to[tag] || (to[tag] = []);
14047
- var source = from[tag];
14048
- for (var i = source.length - 1; i >= 0; i--)
14049
- dest.unshift(source[i]);
14050
- }
14051
- }
14052
- function findMatchingMode(tagInfo, tagText) {
14053
- for (var i = 0; i < tagInfo.length; i++) {
14054
- var spec = tagInfo[i];
14055
- if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];
14056
- }
14057
- }
14058
- CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
14059
- var htmlMode = CodeMirror.getMode(config, {
14060
- name: "xml",
14061
- htmlMode: true,
14062
- multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
14063
- multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag,
14064
- allowMissingTagName: parserConfig.allowMissingTagName
14065
- });
14066
- var tags = {};
14067
- var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;
14068
- addTags(defaultTags, tags);
14069
- if (configTags) addTags(configTags, tags);
14070
- if (configScript) for (var i = configScript.length - 1; i >= 0; i--)
14071
- tags.script.unshift(["type", configScript[i].matches, configScript[i].mode]);
14072
- function html(stream, state) {
14073
- var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName;
14074
- if (tag && !/[<>\s\/]/.test(stream.current()) && (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) && tags.hasOwnProperty(tagName)) {
14075
- state.inTag = tagName + " ";
14076
- } else if (state.inTag && tag && />$/.test(stream.current())) {
14077
- var inTag = /^([\S]+) (.*)/.exec(state.inTag);
14078
- state.inTag = null;
14079
- var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2]);
14080
- var mode = CodeMirror.getMode(config, modeSpec);
14081
- var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);
14082
- state.token = function(stream2, state2) {
14083
- if (stream2.match(endTagA, false)) {
14084
- state2.token = html;
14085
- state2.localState = state2.localMode = null;
14086
- return null;
14087
- }
14088
- return maybeBackup(stream2, endTag, state2.localMode.token(stream2, state2.localState));
14089
- };
14090
- state.localMode = mode;
14091
- state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, "", ""));
14092
- } else if (state.inTag) {
14093
- state.inTag += stream.current();
14094
- if (stream.eol()) state.inTag += " ";
14092
+ return {
14093
+ startState: function() {
14094
+ var state = CodeMirror.startState(htmlMode);
14095
+ return { token: html, inTag: null, localMode: null, localState: null, htmlState: state };
14096
+ },
14097
+ copyState: function(state) {
14098
+ var local;
14099
+ if (state.localState) {
14100
+ local = CodeMirror.copyState(state.localMode, state.localState);
14095
14101
  }
14096
- return style;
14102
+ return {
14103
+ token: state.token,
14104
+ inTag: state.inTag,
14105
+ localMode: state.localMode,
14106
+ localState: local,
14107
+ htmlState: CodeMirror.copyState(htmlMode, state.htmlState)
14108
+ };
14109
+ },
14110
+ token: function(stream, state) {
14111
+ return state.token(stream, state);
14112
+ },
14113
+ indent: function(state, textAfter, line) {
14114
+ if (!state.localMode || /^\s*<\//.test(textAfter))
14115
+ return htmlMode.indent(state.htmlState, textAfter, line);
14116
+ else if (state.localMode.indent)
14117
+ return state.localMode.indent(state.localState, textAfter, line);
14118
+ else
14119
+ return CodeMirror.Pass;
14120
+ },
14121
+ innerMode: function(state) {
14122
+ return { state: state.localState || state.htmlState, mode: state.localMode || htmlMode };
14097
14123
  }
14098
- return {
14099
- startState: function() {
14100
- var state = CodeMirror.startState(htmlMode);
14101
- return { token: html, inTag: null, localMode: null, localState: null, htmlState: state };
14102
- },
14103
- copyState: function(state) {
14104
- var local;
14105
- if (state.localState) {
14106
- local = CodeMirror.copyState(state.localMode, state.localState);
14107
- }
14108
- return {
14109
- token: state.token,
14110
- inTag: state.inTag,
14111
- localMode: state.localMode,
14112
- localState: local,
14113
- htmlState: CodeMirror.copyState(htmlMode, state.htmlState)
14114
- };
14115
- },
14116
- token: function(stream, state) {
14117
- return state.token(stream, state);
14118
- },
14119
- indent: function(state, textAfter, line) {
14120
- if (!state.localMode || /^\s*<\//.test(textAfter))
14121
- return htmlMode.indent(state.htmlState, textAfter, line);
14122
- else if (state.localMode.indent)
14123
- return state.localMode.indent(state.localState, textAfter, line);
14124
- else
14125
- return CodeMirror.Pass;
14126
- },
14127
- innerMode: function(state) {
14128
- return { state: state.localState || state.htmlState, mode: state.localMode || htmlMode };
14129
- }
14130
- };
14131
- }, "xml", "javascript", "css");
14132
- CodeMirror.defineMIME("text/html", "htmlmixed");
14133
- });
14134
- })();
14135
- return htmlmixed.exports;
14136
- }
14137
- requireHtmlmixed();
14124
+ };
14125
+ }, "xml", "javascript", "css");
14126
+ CodeMirror.defineMIME("text/html", "htmlmixed");
14127
+ });
14128
+ })();
14138
14129
  requireJavascript();
14139
- var python = { exports: {} };
14140
- var hasRequiredPython;
14141
- function requirePython() {
14142
- if (hasRequiredPython) return python.exports;
14143
- hasRequiredPython = 1;
14144
- (function(module, exports) {
14145
- (function(mod) {
14146
- mod(requireCodemirror());
14147
- })(function(CodeMirror) {
14148
- function wordRegexp(words2) {
14149
- return new RegExp("^((" + words2.join(")|(") + "))\\b");
14150
- }
14151
- var wordOperators = wordRegexp(["and", "or", "not", "is"]);
14152
- var commonKeywords = [
14153
- "as",
14154
- "assert",
14155
- "break",
14156
- "class",
14157
- "continue",
14158
- "def",
14159
- "del",
14160
- "elif",
14161
- "else",
14162
- "except",
14163
- "finally",
14164
- "for",
14165
- "from",
14166
- "global",
14167
- "if",
14168
- "import",
14169
- "lambda",
14170
- "pass",
14171
- "raise",
14172
- "return",
14173
- "try",
14174
- "while",
14175
- "with",
14176
- "yield",
14177
- "in",
14178
- "False",
14179
- "True"
14180
- ];
14181
- var commonBuiltins = [
14182
- "abs",
14183
- "all",
14184
- "any",
14185
- "bin",
14186
- "bool",
14187
- "bytearray",
14188
- "callable",
14189
- "chr",
14190
- "classmethod",
14191
- "compile",
14192
- "complex",
14193
- "delattr",
14194
- "dict",
14195
- "dir",
14196
- "divmod",
14197
- "enumerate",
14198
- "eval",
14199
- "filter",
14200
- "float",
14201
- "format",
14202
- "frozenset",
14203
- "getattr",
14204
- "globals",
14205
- "hasattr",
14206
- "hash",
14207
- "help",
14208
- "hex",
14209
- "id",
14210
- "input",
14211
- "int",
14212
- "isinstance",
14213
- "issubclass",
14214
- "iter",
14215
- "len",
14216
- "list",
14217
- "locals",
14218
- "map",
14219
- "max",
14220
- "memoryview",
14221
- "min",
14222
- "next",
14223
- "object",
14224
- "oct",
14225
- "open",
14226
- "ord",
14227
- "pow",
14228
- "property",
14229
- "range",
14230
- "repr",
14231
- "reversed",
14232
- "round",
14233
- "set",
14234
- "setattr",
14235
- "slice",
14236
- "sorted",
14237
- "staticmethod",
14238
- "str",
14239
- "sum",
14240
- "super",
14241
- "tuple",
14242
- "type",
14243
- "vars",
14244
- "zip",
14245
- "__import__",
14246
- "NotImplemented",
14247
- "Ellipsis",
14248
- "__debug__"
14130
+ (function(module, exports) {
14131
+ (function(mod) {
14132
+ mod(requireCodemirror());
14133
+ })(function(CodeMirror) {
14134
+ function wordRegexp(words2) {
14135
+ return new RegExp("^((" + words2.join(")|(") + "))\\b");
14136
+ }
14137
+ var wordOperators = wordRegexp(["and", "or", "not", "is"]);
14138
+ var commonKeywords = [
14139
+ "as",
14140
+ "assert",
14141
+ "break",
14142
+ "class",
14143
+ "continue",
14144
+ "def",
14145
+ "del",
14146
+ "elif",
14147
+ "else",
14148
+ "except",
14149
+ "finally",
14150
+ "for",
14151
+ "from",
14152
+ "global",
14153
+ "if",
14154
+ "import",
14155
+ "lambda",
14156
+ "pass",
14157
+ "raise",
14158
+ "return",
14159
+ "try",
14160
+ "while",
14161
+ "with",
14162
+ "yield",
14163
+ "in",
14164
+ "False",
14165
+ "True"
14166
+ ];
14167
+ var commonBuiltins = [
14168
+ "abs",
14169
+ "all",
14170
+ "any",
14171
+ "bin",
14172
+ "bool",
14173
+ "bytearray",
14174
+ "callable",
14175
+ "chr",
14176
+ "classmethod",
14177
+ "compile",
14178
+ "complex",
14179
+ "delattr",
14180
+ "dict",
14181
+ "dir",
14182
+ "divmod",
14183
+ "enumerate",
14184
+ "eval",
14185
+ "filter",
14186
+ "float",
14187
+ "format",
14188
+ "frozenset",
14189
+ "getattr",
14190
+ "globals",
14191
+ "hasattr",
14192
+ "hash",
14193
+ "help",
14194
+ "hex",
14195
+ "id",
14196
+ "input",
14197
+ "int",
14198
+ "isinstance",
14199
+ "issubclass",
14200
+ "iter",
14201
+ "len",
14202
+ "list",
14203
+ "locals",
14204
+ "map",
14205
+ "max",
14206
+ "memoryview",
14207
+ "min",
14208
+ "next",
14209
+ "object",
14210
+ "oct",
14211
+ "open",
14212
+ "ord",
14213
+ "pow",
14214
+ "property",
14215
+ "range",
14216
+ "repr",
14217
+ "reversed",
14218
+ "round",
14219
+ "set",
14220
+ "setattr",
14221
+ "slice",
14222
+ "sorted",
14223
+ "staticmethod",
14224
+ "str",
14225
+ "sum",
14226
+ "super",
14227
+ "tuple",
14228
+ "type",
14229
+ "vars",
14230
+ "zip",
14231
+ "__import__",
14232
+ "NotImplemented",
14233
+ "Ellipsis",
14234
+ "__debug__"
14235
+ ];
14236
+ CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins).concat(["exec", "print"]));
14237
+ function top(state) {
14238
+ return state.scopes[state.scopes.length - 1];
14239
+ }
14240
+ CodeMirror.defineMode("python", function(conf, parserConf) {
14241
+ var ERRORCLASS = "error";
14242
+ var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
14243
+ var operators = [
14244
+ parserConf.singleOperators,
14245
+ parserConf.doubleOperators,
14246
+ parserConf.doubleDelimiters,
14247
+ parserConf.tripleDelimiters,
14248
+ parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/
14249
14249
  ];
14250
- CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins).concat(["exec", "print"]));
14251
- function top(state) {
14252
- return state.scopes[state.scopes.length - 1];
14253
- }
14254
- CodeMirror.defineMode("python", function(conf, parserConf) {
14255
- var ERRORCLASS = "error";
14256
- var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
14257
- var operators = [
14258
- parserConf.singleOperators,
14259
- parserConf.doubleOperators,
14260
- parserConf.doubleDelimiters,
14261
- parserConf.tripleDelimiters,
14262
- parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/
14263
- ];
14264
- for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1);
14265
- var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
14266
- var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
14267
- if (parserConf.extra_keywords != void 0)
14268
- myKeywords = myKeywords.concat(parserConf.extra_keywords);
14269
- if (parserConf.extra_builtins != void 0)
14270
- myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
14271
- var py3 = !(parserConf.version && Number(parserConf.version) < 3);
14272
- if (py3) {
14273
- var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
14274
- myKeywords = myKeywords.concat(["nonlocal", "None", "aiter", "anext", "async", "await", "breakpoint", "match", "case"]);
14275
- myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
14276
- var stringPrefixes = new RegExp(`^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|"{3}|['"]))`, "i");
14277
- } else {
14278
- var identifiers = parserConf.identifiers || /^[_A-Za-z][_A-Za-z0-9]*/;
14279
- myKeywords = myKeywords.concat(["exec", "print"]);
14280
- myBuiltins = myBuiltins.concat([
14281
- "apply",
14282
- "basestring",
14283
- "buffer",
14284
- "cmp",
14285
- "coerce",
14286
- "execfile",
14287
- "file",
14288
- "intern",
14289
- "long",
14290
- "raw_input",
14291
- "reduce",
14292
- "reload",
14293
- "unichr",
14294
- "unicode",
14295
- "xrange",
14296
- "None"
14297
- ]);
14298
- var stringPrefixes = new RegExp(`^(([rubf]|(ur)|(br))?('{3}|"{3}|['"]))`, "i");
14299
- }
14300
- var keywords = wordRegexp(myKeywords);
14301
- var builtins = wordRegexp(myBuiltins);
14302
- function tokenBase(stream, state) {
14303
- var sol = stream.sol() && state.lastToken != "\\";
14304
- if (sol) state.indent = stream.indentation();
14305
- if (sol && top(state).type == "py") {
14306
- var scopeOffset = top(state).offset;
14307
- if (stream.eatSpace()) {
14308
- var lineOffset = stream.indentation();
14309
- if (lineOffset > scopeOffset)
14310
- pushPyScope(state);
14311
- else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
14312
- state.errorToken = true;
14313
- return null;
14314
- } else {
14315
- var style = tokenBaseInner(stream, state);
14316
- if (scopeOffset > 0 && dedent(stream, state))
14317
- style += " " + ERRORCLASS;
14318
- return style;
14319
- }
14250
+ for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1);
14251
+ var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
14252
+ var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
14253
+ if (parserConf.extra_keywords != void 0)
14254
+ myKeywords = myKeywords.concat(parserConf.extra_keywords);
14255
+ if (parserConf.extra_builtins != void 0)
14256
+ myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
14257
+ var py3 = !(parserConf.version && Number(parserConf.version) < 3);
14258
+ if (py3) {
14259
+ var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
14260
+ myKeywords = myKeywords.concat(["nonlocal", "None", "aiter", "anext", "async", "await", "breakpoint", "match", "case"]);
14261
+ myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
14262
+ var stringPrefixes = new RegExp(`^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|"{3}|['"]))`, "i");
14263
+ } else {
14264
+ var identifiers = parserConf.identifiers || /^[_A-Za-z][_A-Za-z0-9]*/;
14265
+ myKeywords = myKeywords.concat(["exec", "print"]);
14266
+ myBuiltins = myBuiltins.concat([
14267
+ "apply",
14268
+ "basestring",
14269
+ "buffer",
14270
+ "cmp",
14271
+ "coerce",
14272
+ "execfile",
14273
+ "file",
14274
+ "intern",
14275
+ "long",
14276
+ "raw_input",
14277
+ "reduce",
14278
+ "reload",
14279
+ "unichr",
14280
+ "unicode",
14281
+ "xrange",
14282
+ "None"
14283
+ ]);
14284
+ var stringPrefixes = new RegExp(`^(([rubf]|(ur)|(br))?('{3}|"{3}|['"]))`, "i");
14285
+ }
14286
+ var keywords = wordRegexp(myKeywords);
14287
+ var builtins = wordRegexp(myBuiltins);
14288
+ function tokenBase(stream, state) {
14289
+ var sol = stream.sol() && state.lastToken != "\\";
14290
+ if (sol) state.indent = stream.indentation();
14291
+ if (sol && top(state).type == "py") {
14292
+ var scopeOffset = top(state).offset;
14293
+ if (stream.eatSpace()) {
14294
+ var lineOffset = stream.indentation();
14295
+ if (lineOffset > scopeOffset)
14296
+ pushPyScope(state);
14297
+ else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
14298
+ state.errorToken = true;
14299
+ return null;
14300
+ } else {
14301
+ var style = tokenBaseInner(stream, state);
14302
+ if (scopeOffset > 0 && dedent(stream, state))
14303
+ style += " " + ERRORCLASS;
14304
+ return style;
14320
14305
  }
14321
- return tokenBaseInner(stream, state);
14322
14306
  }
14323
- function tokenBaseInner(stream, state, inFormat) {
14324
- if (stream.eatSpace()) return null;
14325
- if (!inFormat && stream.match(/^#.*/)) return "comment";
14326
- if (stream.match(/^[0-9\.]/, false)) {
14327
- var floatLiteral = false;
14328
- if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) {
14329
- floatLiteral = true;
14330
- }
14331
- if (stream.match(/^[\d_]+\.\d*/)) {
14332
- floatLiteral = true;
14333
- }
14334
- if (stream.match(/^\.\d+/)) {
14335
- floatLiteral = true;
14336
- }
14337
- if (floatLiteral) {
14338
- stream.eat(/J/i);
14339
- return "number";
14340
- }
14341
- var intLiteral = false;
14342
- if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
14343
- if (stream.match(/^0b[01_]+/i)) intLiteral = true;
14344
- if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
14345
- if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
14346
- stream.eat(/J/i);
14347
- intLiteral = true;
14348
- }
14349
- if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
14350
- if (intLiteral) {
14351
- stream.eat(/L/i);
14352
- return "number";
14353
- }
14307
+ return tokenBaseInner(stream, state);
14308
+ }
14309
+ function tokenBaseInner(stream, state, inFormat) {
14310
+ if (stream.eatSpace()) return null;
14311
+ if (!inFormat && stream.match(/^#.*/)) return "comment";
14312
+ if (stream.match(/^[0-9\.]/, false)) {
14313
+ var floatLiteral = false;
14314
+ if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) {
14315
+ floatLiteral = true;
14354
14316
  }
14355
- if (stream.match(stringPrefixes)) {
14356
- var isFmtString = stream.current().toLowerCase().indexOf("f") !== -1;
14357
- if (!isFmtString) {
14358
- state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
14359
- return state.tokenize(stream, state);
14360
- } else {
14361
- state.tokenize = formatStringFactory(stream.current(), state.tokenize);
14362
- return state.tokenize(stream, state);
14363
- }
14317
+ if (stream.match(/^[\d_]+\.\d*/)) {
14318
+ floatLiteral = true;
14364
14319
  }
14365
- for (var i2 = 0; i2 < operators.length; i2++)
14366
- if (stream.match(operators[i2])) return "operator";
14367
- if (stream.match(delimiters)) return "punctuation";
14368
- if (state.lastToken == "." && stream.match(identifiers))
14369
- return "property";
14370
- if (stream.match(keywords) || stream.match(wordOperators))
14371
- return "keyword";
14372
- if (stream.match(builtins))
14373
- return "builtin";
14374
- if (stream.match(/^(self|cls)\b/))
14375
- return "variable-2";
14376
- if (stream.match(identifiers)) {
14377
- if (state.lastToken == "def" || state.lastToken == "class")
14378
- return "def";
14379
- return "variable";
14320
+ if (stream.match(/^\.\d+/)) {
14321
+ floatLiteral = true;
14380
14322
  }
14381
- stream.next();
14382
- return inFormat ? null : ERRORCLASS;
14383
- }
14384
- function formatStringFactory(delimiter, tokenOuter) {
14385
- while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
14386
- delimiter = delimiter.substr(1);
14387
- var singleline = delimiter.length == 1;
14388
- var OUTCLASS = "string";
14389
- function tokenNestedExpr(depth) {
14390
- return function(stream, state) {
14391
- var inner = tokenBaseInner(stream, state, true);
14392
- if (inner == "punctuation") {
14393
- if (stream.current() == "{") {
14394
- state.tokenize = tokenNestedExpr(depth + 1);
14395
- } else if (stream.current() == "}") {
14396
- if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1);
14397
- else state.tokenize = tokenString;
14398
- }
14399
- }
14400
- return inner;
14401
- };
14323
+ if (floatLiteral) {
14324
+ stream.eat(/J/i);
14325
+ return "number";
14402
14326
  }
14403
- function tokenString(stream, state) {
14404
- while (!stream.eol()) {
14405
- stream.eatWhile(/[^'"\{\}\\]/);
14406
- if (stream.eat("\\")) {
14407
- stream.next();
14408
- if (singleline && stream.eol())
14409
- return OUTCLASS;
14410
- } else if (stream.match(delimiter)) {
14411
- state.tokenize = tokenOuter;
14412
- return OUTCLASS;
14413
- } else if (stream.match("{{")) {
14414
- return OUTCLASS;
14415
- } else if (stream.match("{", false)) {
14416
- state.tokenize = tokenNestedExpr(0);
14417
- if (stream.current()) return OUTCLASS;
14418
- else return state.tokenize(stream, state);
14419
- } else if (stream.match("}}")) {
14420
- return OUTCLASS;
14421
- } else if (stream.match("}")) {
14422
- return ERRORCLASS;
14423
- } else {
14424
- stream.eat(/['"]/);
14327
+ var intLiteral = false;
14328
+ if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
14329
+ if (stream.match(/^0b[01_]+/i)) intLiteral = true;
14330
+ if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
14331
+ if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
14332
+ stream.eat(/J/i);
14333
+ intLiteral = true;
14334
+ }
14335
+ if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
14336
+ if (intLiteral) {
14337
+ stream.eat(/L/i);
14338
+ return "number";
14339
+ }
14340
+ }
14341
+ if (stream.match(stringPrefixes)) {
14342
+ var isFmtString = stream.current().toLowerCase().indexOf("f") !== -1;
14343
+ if (!isFmtString) {
14344
+ state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
14345
+ return state.tokenize(stream, state);
14346
+ } else {
14347
+ state.tokenize = formatStringFactory(stream.current(), state.tokenize);
14348
+ return state.tokenize(stream, state);
14349
+ }
14350
+ }
14351
+ for (var i2 = 0; i2 < operators.length; i2++)
14352
+ if (stream.match(operators[i2])) return "operator";
14353
+ if (stream.match(delimiters)) return "punctuation";
14354
+ if (state.lastToken == "." && stream.match(identifiers))
14355
+ return "property";
14356
+ if (stream.match(keywords) || stream.match(wordOperators))
14357
+ return "keyword";
14358
+ if (stream.match(builtins))
14359
+ return "builtin";
14360
+ if (stream.match(/^(self|cls)\b/))
14361
+ return "variable-2";
14362
+ if (stream.match(identifiers)) {
14363
+ if (state.lastToken == "def" || state.lastToken == "class")
14364
+ return "def";
14365
+ return "variable";
14366
+ }
14367
+ stream.next();
14368
+ return inFormat ? null : ERRORCLASS;
14369
+ }
14370
+ function formatStringFactory(delimiter, tokenOuter) {
14371
+ while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
14372
+ delimiter = delimiter.substr(1);
14373
+ var singleline = delimiter.length == 1;
14374
+ var OUTCLASS = "string";
14375
+ function tokenNestedExpr(depth) {
14376
+ return function(stream, state) {
14377
+ var inner = tokenBaseInner(stream, state, true);
14378
+ if (inner == "punctuation") {
14379
+ if (stream.current() == "{") {
14380
+ state.tokenize = tokenNestedExpr(depth + 1);
14381
+ } else if (stream.current() == "}") {
14382
+ if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1);
14383
+ else state.tokenize = tokenString;
14425
14384
  }
14426
14385
  }
14427
- if (singleline) {
14428
- if (parserConf.singleLineStringErrors)
14429
- return ERRORCLASS;
14430
- else
14431
- state.tokenize = tokenOuter;
14386
+ return inner;
14387
+ };
14388
+ }
14389
+ function tokenString(stream, state) {
14390
+ while (!stream.eol()) {
14391
+ stream.eatWhile(/[^'"\{\}\\]/);
14392
+ if (stream.eat("\\")) {
14393
+ stream.next();
14394
+ if (singleline && stream.eol())
14395
+ return OUTCLASS;
14396
+ } else if (stream.match(delimiter)) {
14397
+ state.tokenize = tokenOuter;
14398
+ return OUTCLASS;
14399
+ } else if (stream.match("{{")) {
14400
+ return OUTCLASS;
14401
+ } else if (stream.match("{", false)) {
14402
+ state.tokenize = tokenNestedExpr(0);
14403
+ if (stream.current()) return OUTCLASS;
14404
+ else return state.tokenize(stream, state);
14405
+ } else if (stream.match("}}")) {
14406
+ return OUTCLASS;
14407
+ } else if (stream.match("}")) {
14408
+ return ERRORCLASS;
14409
+ } else {
14410
+ stream.eat(/['"]/);
14432
14411
  }
14433
- return OUTCLASS;
14434
14412
  }
14435
- tokenString.isString = true;
14436
- return tokenString;
14413
+ if (singleline) {
14414
+ if (parserConf.singleLineStringErrors)
14415
+ return ERRORCLASS;
14416
+ else
14417
+ state.tokenize = tokenOuter;
14418
+ }
14419
+ return OUTCLASS;
14437
14420
  }
14438
- function tokenStringFactory(delimiter, tokenOuter) {
14439
- while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
14440
- delimiter = delimiter.substr(1);
14441
- var singleline = delimiter.length == 1;
14442
- var OUTCLASS = "string";
14443
- function tokenString(stream, state) {
14444
- while (!stream.eol()) {
14445
- stream.eatWhile(/[^'"\\]/);
14446
- if (stream.eat("\\")) {
14447
- stream.next();
14448
- if (singleline && stream.eol())
14449
- return OUTCLASS;
14450
- } else if (stream.match(delimiter)) {
14451
- state.tokenize = tokenOuter;
14421
+ tokenString.isString = true;
14422
+ return tokenString;
14423
+ }
14424
+ function tokenStringFactory(delimiter, tokenOuter) {
14425
+ while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
14426
+ delimiter = delimiter.substr(1);
14427
+ var singleline = delimiter.length == 1;
14428
+ var OUTCLASS = "string";
14429
+ function tokenString(stream, state) {
14430
+ while (!stream.eol()) {
14431
+ stream.eatWhile(/[^'"\\]/);
14432
+ if (stream.eat("\\")) {
14433
+ stream.next();
14434
+ if (singleline && stream.eol())
14452
14435
  return OUTCLASS;
14453
- } else {
14454
- stream.eat(/['"]/);
14455
- }
14456
- }
14457
- if (singleline) {
14458
- if (parserConf.singleLineStringErrors)
14459
- return ERRORCLASS;
14460
- else
14461
- state.tokenize = tokenOuter;
14436
+ } else if (stream.match(delimiter)) {
14437
+ state.tokenize = tokenOuter;
14438
+ return OUTCLASS;
14439
+ } else {
14440
+ stream.eat(/['"]/);
14462
14441
  }
14463
- return OUTCLASS;
14464
14442
  }
14465
- tokenString.isString = true;
14466
- return tokenString;
14443
+ if (singleline) {
14444
+ if (parserConf.singleLineStringErrors)
14445
+ return ERRORCLASS;
14446
+ else
14447
+ state.tokenize = tokenOuter;
14448
+ }
14449
+ return OUTCLASS;
14467
14450
  }
14468
- function pushPyScope(state) {
14469
- while (top(state).type != "py") state.scopes.pop();
14470
- state.scopes.push({
14471
- offset: top(state).offset + conf.indentUnit,
14472
- type: "py",
14473
- align: null
14474
- });
14451
+ tokenString.isString = true;
14452
+ return tokenString;
14453
+ }
14454
+ function pushPyScope(state) {
14455
+ while (top(state).type != "py") state.scopes.pop();
14456
+ state.scopes.push({
14457
+ offset: top(state).offset + conf.indentUnit,
14458
+ type: "py",
14459
+ align: null
14460
+ });
14461
+ }
14462
+ function pushBracketScope(stream, state, type) {
14463
+ var align = stream.match(/^[\s\[\{\(]*(?:#|$)/, false) ? null : stream.column() + 1;
14464
+ state.scopes.push({
14465
+ offset: state.indent + hangingIndent,
14466
+ type,
14467
+ align
14468
+ });
14469
+ }
14470
+ function dedent(stream, state) {
14471
+ var indented = stream.indentation();
14472
+ while (state.scopes.length > 1 && top(state).offset > indented) {
14473
+ if (top(state).type != "py") return true;
14474
+ state.scopes.pop();
14475
+ }
14476
+ return top(state).offset != indented;
14477
+ }
14478
+ function tokenLexer(stream, state) {
14479
+ if (stream.sol()) {
14480
+ state.beginningOfLine = true;
14481
+ state.dedent = false;
14482
+ }
14483
+ var style = state.tokenize(stream, state);
14484
+ var current = stream.current();
14485
+ if (state.beginningOfLine && current == "@")
14486
+ return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
14487
+ if (/\S/.test(current)) state.beginningOfLine = false;
14488
+ if ((style == "variable" || style == "builtin") && state.lastToken == "meta")
14489
+ style = "meta";
14490
+ if (current == "pass" || current == "return")
14491
+ state.dedent = true;
14492
+ if (current == "lambda") state.lambda = true;
14493
+ if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false))
14494
+ pushPyScope(state);
14495
+ if (current.length == 1 && !/string|comment/.test(style)) {
14496
+ var delimiter_index = "[({".indexOf(current);
14497
+ if (delimiter_index != -1)
14498
+ pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index + 1));
14499
+ delimiter_index = "])}".indexOf(current);
14500
+ if (delimiter_index != -1) {
14501
+ if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent;
14502
+ else return ERRORCLASS;
14503
+ }
14504
+ }
14505
+ if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1)
14506
+ state.scopes.pop();
14507
+ return style;
14508
+ }
14509
+ var external = {
14510
+ startState: function(basecolumn) {
14511
+ return {
14512
+ tokenize: tokenBase,
14513
+ scopes: [{ offset: basecolumn || 0, type: "py", align: null }],
14514
+ indent: basecolumn || 0,
14515
+ lastToken: null,
14516
+ lambda: false,
14517
+ dedent: 0
14518
+ };
14519
+ },
14520
+ token: function(stream, state) {
14521
+ var addErr = state.errorToken;
14522
+ if (addErr) state.errorToken = false;
14523
+ var style = tokenLexer(stream, state);
14524
+ if (style && style != "comment")
14525
+ state.lastToken = style == "keyword" || style == "punctuation" ? stream.current() : style;
14526
+ if (style == "punctuation") style = null;
14527
+ if (stream.eol() && state.lambda)
14528
+ state.lambda = false;
14529
+ return addErr ? style + " " + ERRORCLASS : style;
14530
+ },
14531
+ indent: function(state, textAfter) {
14532
+ if (state.tokenize != tokenBase)
14533
+ return state.tokenize.isString ? CodeMirror.Pass : 0;
14534
+ var scope = top(state);
14535
+ var closing = scope.type == textAfter.charAt(0) || scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter);
14536
+ if (scope.align != null)
14537
+ return scope.align - (closing ? 1 : 0);
14538
+ else
14539
+ return scope.offset - (closing ? hangingIndent : 0);
14540
+ },
14541
+ electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/,
14542
+ closeBrackets: { triples: `'"` },
14543
+ lineComment: "#",
14544
+ fold: "indent"
14545
+ };
14546
+ return external;
14547
+ });
14548
+ CodeMirror.defineMIME("text/x-python", "python");
14549
+ var words = function(str) {
14550
+ return str.split(" ");
14551
+ };
14552
+ CodeMirror.defineMIME("text/x-cython", {
14553
+ name: "python",
14554
+ extra_keywords: words("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")
14555
+ });
14556
+ });
14557
+ })();
14558
+ (function(module, exports) {
14559
+ (function(mod) {
14560
+ mod(requireCodemirror());
14561
+ })(function(CodeMirror) {
14562
+ function Context(indented, column, type, info, align, prev) {
14563
+ this.indented = indented;
14564
+ this.column = column;
14565
+ this.type = type;
14566
+ this.info = info;
14567
+ this.align = align;
14568
+ this.prev = prev;
14569
+ }
14570
+ function pushContext(state, col, type, info) {
14571
+ var indent = state.indented;
14572
+ if (state.context && state.context.type == "statement" && type != "statement")
14573
+ indent = state.context.indented;
14574
+ return state.context = new Context(indent, col, type, info, null, state.context);
14575
+ }
14576
+ function popContext(state) {
14577
+ var t = state.context.type;
14578
+ if (t == ")" || t == "]" || t == "}")
14579
+ state.indented = state.context.indented;
14580
+ return state.context = state.context.prev;
14581
+ }
14582
+ function typeBefore(stream, state, pos) {
14583
+ if (state.prevToken == "variable" || state.prevToken == "type") return true;
14584
+ if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
14585
+ if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
14586
+ }
14587
+ function isTopScope(context) {
14588
+ for (; ; ) {
14589
+ if (!context || context.type == "top") return true;
14590
+ if (context.type == "}" && context.prev.info != "namespace") return false;
14591
+ context = context.prev;
14592
+ }
14593
+ }
14594
+ CodeMirror.defineMode("clike", function(config, parserConfig) {
14595
+ var indentUnit = config.indentUnit, statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, dontAlignCalls = parserConfig.dontAlignCalls, keywords = parserConfig.keywords || {}, types = parserConfig.types || {}, builtin = parserConfig.builtin || {}, blockKeywords = parserConfig.blockKeywords || {}, defKeywords = parserConfig.defKeywords || {}, atoms = parserConfig.atoms || {}, hooks = parserConfig.hooks || {}, multiLineStrings = parserConfig.multiLineStrings, indentStatements = parserConfig.indentStatements !== false, indentSwitch = parserConfig.indentSwitch !== false, namespaceSeparator = parserConfig.namespaceSeparator, isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/, numberStart = parserConfig.numberStart || /[\d\.]/, number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i, isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/, isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/, isReservedIdentifier = parserConfig.isReservedIdentifier || false;
14596
+ var curPunc, isDefKeyword;
14597
+ function tokenBase(stream, state) {
14598
+ var ch = stream.next();
14599
+ if (hooks[ch]) {
14600
+ var result = hooks[ch](stream, state);
14601
+ if (result !== false) return result;
14602
+ }
14603
+ if (ch == '"' || ch == "'") {
14604
+ state.tokenize = tokenString(ch);
14605
+ return state.tokenize(stream, state);
14606
+ }
14607
+ if (numberStart.test(ch)) {
14608
+ stream.backUp(1);
14609
+ if (stream.match(number)) return "number";
14610
+ stream.next();
14475
14611
  }
14476
- function pushBracketScope(stream, state, type) {
14477
- var align = stream.match(/^[\s\[\{\(]*(?:#|$)/, false) ? null : stream.column() + 1;
14478
- state.scopes.push({
14479
- offset: state.indent + hangingIndent,
14480
- type,
14481
- align
14482
- });
14612
+ if (isPunctuationChar.test(ch)) {
14613
+ curPunc = ch;
14614
+ return null;
14483
14615
  }
14484
- function dedent(stream, state) {
14485
- var indented = stream.indentation();
14486
- while (state.scopes.length > 1 && top(state).offset > indented) {
14487
- if (top(state).type != "py") return true;
14488
- state.scopes.pop();
14616
+ if (ch == "/") {
14617
+ if (stream.eat("*")) {
14618
+ state.tokenize = tokenComment;
14619
+ return tokenComment(stream, state);
14620
+ }
14621
+ if (stream.eat("/")) {
14622
+ stream.skipToEnd();
14623
+ return "comment";
14489
14624
  }
14490
- return top(state).offset != indented;
14491
14625
  }
14492
- function tokenLexer(stream, state) {
14493
- if (stream.sol()) {
14494
- state.beginningOfLine = true;
14495
- state.dedent = false;
14496
- }
14497
- var style = state.tokenize(stream, state);
14498
- var current = stream.current();
14499
- if (state.beginningOfLine && current == "@")
14500
- return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
14501
- if (/\S/.test(current)) state.beginningOfLine = false;
14502
- if ((style == "variable" || style == "builtin") && state.lastToken == "meta")
14503
- style = "meta";
14504
- if (current == "pass" || current == "return")
14505
- state.dedent = true;
14506
- if (current == "lambda") state.lambda = true;
14507
- if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false))
14508
- pushPyScope(state);
14509
- if (current.length == 1 && !/string|comment/.test(style)) {
14510
- var delimiter_index = "[({".indexOf(current);
14511
- if (delimiter_index != -1)
14512
- pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index + 1));
14513
- delimiter_index = "])}".indexOf(current);
14514
- if (delimiter_index != -1) {
14515
- if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent;
14516
- else return ERRORCLASS;
14517
- }
14518
- }
14519
- if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1)
14520
- state.scopes.pop();
14521
- return style;
14626
+ if (isOperatorChar.test(ch)) {
14627
+ while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {
14628
+ }
14629
+ return "operator";
14522
14630
  }
14523
- var external = {
14524
- startState: function(basecolumn) {
14525
- return {
14526
- tokenize: tokenBase,
14527
- scopes: [{ offset: basecolumn || 0, type: "py", align: null }],
14528
- indent: basecolumn || 0,
14529
- lastToken: null,
14530
- lambda: false,
14531
- dedent: 0
14532
- };
14533
- },
14534
- token: function(stream, state) {
14535
- var addErr = state.errorToken;
14536
- if (addErr) state.errorToken = false;
14537
- var style = tokenLexer(stream, state);
14538
- if (style && style != "comment")
14539
- state.lastToken = style == "keyword" || style == "punctuation" ? stream.current() : style;
14540
- if (style == "punctuation") style = null;
14541
- if (stream.eol() && state.lambda)
14542
- state.lambda = false;
14543
- return addErr ? style + " " + ERRORCLASS : style;
14544
- },
14545
- indent: function(state, textAfter) {
14546
- if (state.tokenize != tokenBase)
14547
- return state.tokenize.isString ? CodeMirror.Pass : 0;
14548
- var scope = top(state);
14549
- var closing = scope.type == textAfter.charAt(0) || scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter);
14550
- if (scope.align != null)
14551
- return scope.align - (closing ? 1 : 0);
14552
- else
14553
- return scope.offset - (closing ? hangingIndent : 0);
14554
- },
14555
- electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/,
14556
- closeBrackets: { triples: `'"` },
14557
- lineComment: "#",
14558
- fold: "indent"
14559
- };
14560
- return external;
14561
- });
14562
- CodeMirror.defineMIME("text/x-python", "python");
14563
- var words = function(str) {
14564
- return str.split(" ");
14565
- };
14566
- CodeMirror.defineMIME("text/x-cython", {
14567
- name: "python",
14568
- extra_keywords: words("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")
14569
- });
14570
- });
14571
- })();
14572
- return python.exports;
14573
- }
14574
- requirePython();
14575
- var clike = { exports: {} };
14576
- var hasRequiredClike;
14577
- function requireClike() {
14578
- if (hasRequiredClike) return clike.exports;
14579
- hasRequiredClike = 1;
14580
- (function(module, exports) {
14581
- (function(mod) {
14582
- mod(requireCodemirror());
14583
- })(function(CodeMirror) {
14584
- function Context(indented, column, type, info, align, prev) {
14585
- this.indented = indented;
14586
- this.column = column;
14587
- this.type = type;
14588
- this.info = info;
14589
- this.align = align;
14590
- this.prev = prev;
14591
- }
14592
- function pushContext(state, col, type, info) {
14593
- var indent = state.indented;
14594
- if (state.context && state.context.type == "statement" && type != "statement")
14595
- indent = state.context.indented;
14596
- return state.context = new Context(indent, col, type, info, null, state.context);
14597
- }
14598
- function popContext(state) {
14599
- var t = state.context.type;
14600
- if (t == ")" || t == "]" || t == "}")
14601
- state.indented = state.context.indented;
14602
- return state.context = state.context.prev;
14603
- }
14604
- function typeBefore(stream, state, pos) {
14605
- if (state.prevToken == "variable" || state.prevToken == "type") return true;
14606
- if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
14607
- if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
14608
- }
14609
- function isTopScope(context) {
14610
- for (; ; ) {
14611
- if (!context || context.type == "top") return true;
14612
- if (context.type == "}" && context.prev.info != "namespace") return false;
14613
- context = context.prev;
14631
+ stream.eatWhile(isIdentifierChar);
14632
+ if (namespaceSeparator) while (stream.match(namespaceSeparator))
14633
+ stream.eatWhile(isIdentifierChar);
14634
+ var cur = stream.current();
14635
+ if (contains(keywords, cur)) {
14636
+ if (contains(blockKeywords, cur)) curPunc = "newstatement";
14637
+ if (contains(defKeywords, cur)) isDefKeyword = true;
14638
+ return "keyword";
14614
14639
  }
14640
+ if (contains(types, cur)) return "type";
14641
+ if (contains(builtin, cur) || isReservedIdentifier && isReservedIdentifier(cur)) {
14642
+ if (contains(blockKeywords, cur)) curPunc = "newstatement";
14643
+ return "builtin";
14644
+ }
14645
+ if (contains(atoms, cur)) return "atom";
14646
+ return "variable";
14615
14647
  }
14616
- CodeMirror.defineMode("clike", function(config, parserConfig) {
14617
- var indentUnit = config.indentUnit, statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, dontAlignCalls = parserConfig.dontAlignCalls, keywords = parserConfig.keywords || {}, types = parserConfig.types || {}, builtin = parserConfig.builtin || {}, blockKeywords = parserConfig.blockKeywords || {}, defKeywords = parserConfig.defKeywords || {}, atoms = parserConfig.atoms || {}, hooks = parserConfig.hooks || {}, multiLineStrings = parserConfig.multiLineStrings, indentStatements = parserConfig.indentStatements !== false, indentSwitch = parserConfig.indentSwitch !== false, namespaceSeparator = parserConfig.namespaceSeparator, isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/, numberStart = parserConfig.numberStart || /[\d\.]/, number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i, isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/, isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/, isReservedIdentifier = parserConfig.isReservedIdentifier || false;
14618
- var curPunc, isDefKeyword;
14619
- function tokenBase(stream, state) {
14620
- var ch = stream.next();
14621
- if (hooks[ch]) {
14622
- var result = hooks[ch](stream, state);
14623
- if (result !== false) return result;
14648
+ function tokenString(quote) {
14649
+ return function(stream, state) {
14650
+ var escaped = false, next, end = false;
14651
+ while ((next = stream.next()) != null) {
14652
+ if (next == quote && !escaped) {
14653
+ end = true;
14654
+ break;
14655
+ }
14656
+ escaped = !escaped && next == "\\";
14624
14657
  }
14625
- if (ch == '"' || ch == "'") {
14626
- state.tokenize = tokenString(ch);
14627
- return state.tokenize(stream, state);
14658
+ if (end || !(escaped || multiLineStrings))
14659
+ state.tokenize = null;
14660
+ return "string";
14661
+ };
14662
+ }
14663
+ function tokenComment(stream, state) {
14664
+ var maybeEnd = false, ch;
14665
+ while (ch = stream.next()) {
14666
+ if (ch == "/" && maybeEnd) {
14667
+ state.tokenize = null;
14668
+ break;
14628
14669
  }
14629
- if (numberStart.test(ch)) {
14630
- stream.backUp(1);
14631
- if (stream.match(number)) return "number";
14632
- stream.next();
14670
+ maybeEnd = ch == "*";
14671
+ }
14672
+ return "comment";
14673
+ }
14674
+ function maybeEOL(stream, state) {
14675
+ if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context))
14676
+ state.typeAtEndOfLine = typeBefore(stream, state, stream.pos);
14677
+ }
14678
+ return {
14679
+ startState: function(basecolumn) {
14680
+ return {
14681
+ tokenize: null,
14682
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", null, false),
14683
+ indented: 0,
14684
+ startOfLine: true,
14685
+ prevToken: null
14686
+ };
14687
+ },
14688
+ token: function(stream, state) {
14689
+ var ctx = state.context;
14690
+ if (stream.sol()) {
14691
+ if (ctx.align == null) ctx.align = false;
14692
+ state.indented = stream.indentation();
14693
+ state.startOfLine = true;
14633
14694
  }
14634
- if (isPunctuationChar.test(ch)) {
14635
- curPunc = ch;
14695
+ if (stream.eatSpace()) {
14696
+ maybeEOL(stream, state);
14636
14697
  return null;
14637
14698
  }
14638
- if (ch == "/") {
14639
- if (stream.eat("*")) {
14640
- state.tokenize = tokenComment;
14641
- return tokenComment(stream, state);
14642
- }
14643
- if (stream.eat("/")) {
14644
- stream.skipToEnd();
14645
- return "comment";
14646
- }
14647
- }
14648
- if (isOperatorChar.test(ch)) {
14649
- while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {
14650
- }
14651
- return "operator";
14652
- }
14653
- stream.eatWhile(isIdentifierChar);
14654
- if (namespaceSeparator) while (stream.match(namespaceSeparator))
14655
- stream.eatWhile(isIdentifierChar);
14656
- var cur = stream.current();
14657
- if (contains(keywords, cur)) {
14658
- if (contains(blockKeywords, cur)) curPunc = "newstatement";
14659
- if (contains(defKeywords, cur)) isDefKeyword = true;
14660
- return "keyword";
14661
- }
14662
- if (contains(types, cur)) return "type";
14663
- if (contains(builtin, cur) || isReservedIdentifier && isReservedIdentifier(cur)) {
14664
- if (contains(blockKeywords, cur)) curPunc = "newstatement";
14665
- return "builtin";
14666
- }
14667
- if (contains(atoms, cur)) return "atom";
14668
- return "variable";
14699
+ curPunc = isDefKeyword = null;
14700
+ var style = (state.tokenize || tokenBase)(stream, state);
14701
+ if (style == "comment" || style == "meta") return style;
14702
+ if (ctx.align == null) ctx.align = true;
14703
+ if (curPunc == ";" || curPunc == ":" || curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false))
14704
+ while (state.context.type == "statement") popContext(state);
14705
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
14706
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
14707
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
14708
+ else if (curPunc == "}") {
14709
+ while (ctx.type == "statement") ctx = popContext(state);
14710
+ if (ctx.type == "}") ctx = popContext(state);
14711
+ while (ctx.type == "statement") ctx = popContext(state);
14712
+ } else if (curPunc == ctx.type) popContext(state);
14713
+ else if (indentStatements && ((ctx.type == "}" || ctx.type == "top") && curPunc != ";" || ctx.type == "statement" && curPunc == "newstatement")) {
14714
+ pushContext(state, stream.column(), "statement", stream.current());
14715
+ }
14716
+ if (style == "variable" && (state.prevToken == "def" || parserConfig.typeFirstDefinitions && typeBefore(stream, state, stream.start) && isTopScope(state.context) && stream.match(/^\s*\(/, false)))
14717
+ style = "def";
14718
+ if (hooks.token) {
14719
+ var result = hooks.token(stream, state, style);
14720
+ if (result !== void 0) style = result;
14721
+ }
14722
+ if (style == "def" && parserConfig.styleDefs === false) style = "variable";
14723
+ state.startOfLine = false;
14724
+ state.prevToken = isDefKeyword ? "def" : style || curPunc;
14725
+ maybeEOL(stream, state);
14726
+ return style;
14727
+ },
14728
+ indent: function(state, textAfter) {
14729
+ if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine && isTopScope(state.context))
14730
+ return CodeMirror.Pass;
14731
+ var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
14732
+ var closing = firstChar == ctx.type;
14733
+ if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
14734
+ if (parserConfig.dontIndentStatements)
14735
+ while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info))
14736
+ ctx = ctx.prev;
14737
+ if (hooks.indent) {
14738
+ var hook = hooks.indent(state, ctx, textAfter, indentUnit);
14739
+ if (typeof hook == "number") return hook;
14740
+ }
14741
+ var switchBlock = ctx.prev && ctx.prev.info == "switch";
14742
+ if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
14743
+ while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev;
14744
+ return ctx.indented;
14745
+ }
14746
+ if (ctx.type == "statement")
14747
+ return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
14748
+ if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
14749
+ return ctx.column + (closing ? 0 : 1);
14750
+ if (ctx.type == ")" && !closing)
14751
+ return ctx.indented + statementIndentUnit;
14752
+ return ctx.indented + (closing ? 0 : indentUnit) + (!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
14753
+ },
14754
+ electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
14755
+ blockCommentStart: "/*",
14756
+ blockCommentEnd: "*/",
14757
+ blockCommentContinue: " * ",
14758
+ lineComment: "//",
14759
+ fold: "brace"
14760
+ };
14761
+ });
14762
+ function words(str) {
14763
+ var obj = {}, words2 = str.split(" ");
14764
+ for (var i = 0; i < words2.length; ++i) obj[words2[i]] = true;
14765
+ return obj;
14766
+ }
14767
+ function contains(words2, word) {
14768
+ if (typeof words2 === "function") {
14769
+ return words2(word);
14770
+ } else {
14771
+ return words2.propertyIsEnumerable(word);
14772
+ }
14773
+ }
14774
+ var cKeywords = "auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran";
14775
+ var cppKeywords = "alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq";
14776
+ var objCKeywords = "bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available";
14777
+ var objCBuiltins = "FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT";
14778
+ var basicCTypes = words("int long char short double float unsigned signed void bool");
14779
+ var basicObjCTypes = words("SEL instancetype id Class Protocol BOOL");
14780
+ function cTypes(identifier) {
14781
+ return contains(basicCTypes, identifier) || /.+_t$/.test(identifier);
14782
+ }
14783
+ function objCTypes(identifier) {
14784
+ return cTypes(identifier) || contains(basicObjCTypes, identifier);
14785
+ }
14786
+ var cBlockKeywords = "case do else for if switch while struct enum union";
14787
+ var cDefKeywords = "struct enum union";
14788
+ function cppHook(stream, state) {
14789
+ if (!state.startOfLine) return false;
14790
+ for (var ch, next = null; ch = stream.peek(); ) {
14791
+ if (ch == "\\" && stream.match(/^.$/)) {
14792
+ next = cppHook;
14793
+ break;
14794
+ } else if (ch == "/" && stream.match(/^\/[\/\*]/, false)) {
14795
+ break;
14669
14796
  }
14670
- function tokenString(quote) {
14671
- return function(stream, state) {
14672
- var escaped = false, next, end = false;
14673
- while ((next = stream.next()) != null) {
14674
- if (next == quote && !escaped) {
14675
- end = true;
14676
- break;
14677
- }
14678
- escaped = !escaped && next == "\\";
14679
- }
14680
- if (end || !(escaped || multiLineStrings))
14681
- state.tokenize = null;
14682
- return "string";
14683
- };
14797
+ stream.next();
14798
+ }
14799
+ state.tokenize = next;
14800
+ return "meta";
14801
+ }
14802
+ function pointerHook(_stream, state) {
14803
+ if (state.prevToken == "type") return "type";
14804
+ return false;
14805
+ }
14806
+ function cIsReservedIdentifier(token) {
14807
+ if (!token || token.length < 2) return false;
14808
+ if (token[0] != "_") return false;
14809
+ return token[1] == "_" || token[1] !== token[1].toLowerCase();
14810
+ }
14811
+ function cpp14Literal(stream) {
14812
+ stream.eatWhile(/[\w\.']/);
14813
+ return "number";
14814
+ }
14815
+ function cpp11StringHook(stream, state) {
14816
+ stream.backUp(1);
14817
+ if (stream.match(/^(?:R|u8R|uR|UR|LR)/)) {
14818
+ var match = stream.match(/^"([^\s\\()]{0,16})\(/);
14819
+ if (!match) {
14820
+ return false;
14684
14821
  }
14685
- function tokenComment(stream, state) {
14686
- var maybeEnd = false, ch;
14687
- while (ch = stream.next()) {
14688
- if (ch == "/" && maybeEnd) {
14689
- state.tokenize = null;
14690
- break;
14691
- }
14692
- maybeEnd = ch == "*";
14693
- }
14694
- return "comment";
14822
+ state.cpp11RawStringDelim = match[1];
14823
+ state.tokenize = tokenRawString;
14824
+ return tokenRawString(stream, state);
14825
+ }
14826
+ if (stream.match(/^(?:u8|u|U|L)/)) {
14827
+ if (stream.match(
14828
+ /^["']/,
14829
+ /* eat */
14830
+ false
14831
+ )) {
14832
+ return "string";
14695
14833
  }
14696
- function maybeEOL(stream, state) {
14697
- if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context))
14698
- state.typeAtEndOfLine = typeBefore(stream, state, stream.pos);
14834
+ return false;
14835
+ }
14836
+ stream.next();
14837
+ return false;
14838
+ }
14839
+ function cppLooksLikeConstructor(word) {
14840
+ var lastTwo = /(\w+)::~?(\w+)$/.exec(word);
14841
+ return lastTwo && lastTwo[1] == lastTwo[2];
14842
+ }
14843
+ function tokenAtString(stream, state) {
14844
+ var next;
14845
+ while ((next = stream.next()) != null) {
14846
+ if (next == '"' && !stream.eat('"')) {
14847
+ state.tokenize = null;
14848
+ break;
14849
+ }
14850
+ }
14851
+ return "string";
14852
+ }
14853
+ function tokenRawString(stream, state) {
14854
+ var delim = state.cpp11RawStringDelim.replace(/[^\w\s]/g, "\\$&");
14855
+ var match = stream.match(new RegExp(".*?\\)" + delim + '"'));
14856
+ if (match)
14857
+ state.tokenize = null;
14858
+ else
14859
+ stream.skipToEnd();
14860
+ return "string";
14861
+ }
14862
+ function def(mimes, mode) {
14863
+ if (typeof mimes == "string") mimes = [mimes];
14864
+ var words2 = [];
14865
+ function add(obj) {
14866
+ if (obj) {
14867
+ for (var prop in obj) if (obj.hasOwnProperty(prop))
14868
+ words2.push(prop);
14869
+ }
14870
+ }
14871
+ add(mode.keywords);
14872
+ add(mode.types);
14873
+ add(mode.builtin);
14874
+ add(mode.atoms);
14875
+ if (words2.length) {
14876
+ mode.helperType = mimes[0];
14877
+ CodeMirror.registerHelper("hintWords", mimes[0], words2);
14878
+ }
14879
+ for (var i = 0; i < mimes.length; ++i)
14880
+ CodeMirror.defineMIME(mimes[i], mode);
14881
+ }
14882
+ def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
14883
+ name: "clike",
14884
+ keywords: words(cKeywords),
14885
+ types: cTypes,
14886
+ blockKeywords: words(cBlockKeywords),
14887
+ defKeywords: words(cDefKeywords),
14888
+ typeFirstDefinitions: true,
14889
+ atoms: words("NULL true false"),
14890
+ isReservedIdentifier: cIsReservedIdentifier,
14891
+ hooks: {
14892
+ "#": cppHook,
14893
+ "*": pointerHook
14894
+ },
14895
+ modeProps: { fold: ["brace", "include"] }
14896
+ });
14897
+ def(["text/x-c++src", "text/x-c++hdr"], {
14898
+ name: "clike",
14899
+ keywords: words(cKeywords + " " + cppKeywords),
14900
+ types: cTypes,
14901
+ blockKeywords: words(cBlockKeywords + " class try catch"),
14902
+ defKeywords: words(cDefKeywords + " class namespace"),
14903
+ typeFirstDefinitions: true,
14904
+ atoms: words("true false NULL nullptr"),
14905
+ dontIndentStatements: /^template$/,
14906
+ isIdentifierChar: /[\w\$_~\xa1-\uffff]/,
14907
+ isReservedIdentifier: cIsReservedIdentifier,
14908
+ hooks: {
14909
+ "#": cppHook,
14910
+ "*": pointerHook,
14911
+ "u": cpp11StringHook,
14912
+ "U": cpp11StringHook,
14913
+ "L": cpp11StringHook,
14914
+ "R": cpp11StringHook,
14915
+ "0": cpp14Literal,
14916
+ "1": cpp14Literal,
14917
+ "2": cpp14Literal,
14918
+ "3": cpp14Literal,
14919
+ "4": cpp14Literal,
14920
+ "5": cpp14Literal,
14921
+ "6": cpp14Literal,
14922
+ "7": cpp14Literal,
14923
+ "8": cpp14Literal,
14924
+ "9": cpp14Literal,
14925
+ token: function(stream, state, style) {
14926
+ if (style == "variable" && stream.peek() == "(" && (state.prevToken == ";" || state.prevToken == null || state.prevToken == "}") && cppLooksLikeConstructor(stream.current()))
14927
+ return "def";
14928
+ }
14929
+ },
14930
+ namespaceSeparator: "::",
14931
+ modeProps: { fold: ["brace", "include"] }
14932
+ });
14933
+ def("text/x-java", {
14934
+ name: "clike",
14935
+ keywords: words("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),
14936
+ types: words("var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),
14937
+ blockKeywords: words("catch class do else finally for if switch try while"),
14938
+ defKeywords: words("class interface enum @interface"),
14939
+ typeFirstDefinitions: true,
14940
+ atoms: words("true false null"),
14941
+ number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
14942
+ hooks: {
14943
+ "@": function(stream) {
14944
+ if (stream.match("interface", false)) return false;
14945
+ stream.eatWhile(/[\w\$_]/);
14946
+ return "meta";
14947
+ },
14948
+ '"': function(stream, state) {
14949
+ if (!stream.match(/""$/)) return false;
14950
+ state.tokenize = tokenTripleString;
14951
+ return state.tokenize(stream, state);
14699
14952
  }
14700
- return {
14701
- startState: function(basecolumn) {
14702
- return {
14703
- tokenize: null,
14704
- context: new Context((basecolumn || 0) - indentUnit, 0, "top", null, false),
14705
- indented: 0,
14706
- startOfLine: true,
14707
- prevToken: null
14708
- };
14709
- },
14710
- token: function(stream, state) {
14711
- var ctx = state.context;
14712
- if (stream.sol()) {
14713
- if (ctx.align == null) ctx.align = false;
14714
- state.indented = stream.indentation();
14715
- state.startOfLine = true;
14716
- }
14717
- if (stream.eatSpace()) {
14718
- maybeEOL(stream, state);
14719
- return null;
14953
+ },
14954
+ modeProps: { fold: ["brace", "import"] }
14955
+ });
14956
+ def("text/x-csharp", {
14957
+ name: "clike",
14958
+ keywords: words("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in init interface internal is lock namespace new operator out override params private protected public readonly record ref required return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),
14959
+ types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),
14960
+ blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
14961
+ defKeywords: words("class interface namespace record struct var"),
14962
+ typeFirstDefinitions: true,
14963
+ atoms: words("true false null"),
14964
+ hooks: {
14965
+ "@": function(stream, state) {
14966
+ if (stream.eat('"')) {
14967
+ state.tokenize = tokenAtString;
14968
+ return tokenAtString(stream, state);
14969
+ }
14970
+ stream.eatWhile(/[\w\$_]/);
14971
+ return "meta";
14972
+ }
14973
+ }
14974
+ });
14975
+ function tokenTripleString(stream, state) {
14976
+ var escaped = false;
14977
+ while (!stream.eol()) {
14978
+ if (!escaped && stream.match('"""')) {
14979
+ state.tokenize = null;
14980
+ break;
14981
+ }
14982
+ escaped = stream.next() == "\\" && !escaped;
14983
+ }
14984
+ return "string";
14985
+ }
14986
+ function tokenNestedComment(depth) {
14987
+ return function(stream, state) {
14988
+ var ch;
14989
+ while (ch = stream.next()) {
14990
+ if (ch == "*" && stream.eat("/")) {
14991
+ if (depth == 1) {
14992
+ state.tokenize = null;
14993
+ break;
14994
+ } else {
14995
+ state.tokenize = tokenNestedComment(depth - 1);
14996
+ return state.tokenize(stream, state);
14720
14997
  }
14721
- curPunc = isDefKeyword = null;
14722
- var style = (state.tokenize || tokenBase)(stream, state);
14723
- if (style == "comment" || style == "meta") return style;
14724
- if (ctx.align == null) ctx.align = true;
14725
- if (curPunc == ";" || curPunc == ":" || curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false))
14726
- while (state.context.type == "statement") popContext(state);
14727
- else if (curPunc == "{") pushContext(state, stream.column(), "}");
14728
- else if (curPunc == "[") pushContext(state, stream.column(), "]");
14729
- else if (curPunc == "(") pushContext(state, stream.column(), ")");
14730
- else if (curPunc == "}") {
14731
- while (ctx.type == "statement") ctx = popContext(state);
14732
- if (ctx.type == "}") ctx = popContext(state);
14733
- while (ctx.type == "statement") ctx = popContext(state);
14734
- } else if (curPunc == ctx.type) popContext(state);
14735
- else if (indentStatements && ((ctx.type == "}" || ctx.type == "top") && curPunc != ";" || ctx.type == "statement" && curPunc == "newstatement")) {
14736
- pushContext(state, stream.column(), "statement", stream.current());
14737
- }
14738
- if (style == "variable" && (state.prevToken == "def" || parserConfig.typeFirstDefinitions && typeBefore(stream, state, stream.start) && isTopScope(state.context) && stream.match(/^\s*\(/, false)))
14739
- style = "def";
14740
- if (hooks.token) {
14741
- var result = hooks.token(stream, state, style);
14742
- if (result !== void 0) style = result;
14743
- }
14744
- if (style == "def" && parserConfig.styleDefs === false) style = "variable";
14745
- state.startOfLine = false;
14746
- state.prevToken = isDefKeyword ? "def" : style || curPunc;
14747
- maybeEOL(stream, state);
14748
- return style;
14749
- },
14750
- indent: function(state, textAfter) {
14751
- if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine && isTopScope(state.context))
14752
- return CodeMirror.Pass;
14753
- var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
14754
- var closing = firstChar == ctx.type;
14755
- if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
14756
- if (parserConfig.dontIndentStatements)
14757
- while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info))
14758
- ctx = ctx.prev;
14759
- if (hooks.indent) {
14760
- var hook = hooks.indent(state, ctx, textAfter, indentUnit);
14761
- if (typeof hook == "number") return hook;
14762
- }
14763
- var switchBlock = ctx.prev && ctx.prev.info == "switch";
14764
- if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
14765
- while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev;
14766
- return ctx.indented;
14767
- }
14768
- if (ctx.type == "statement")
14769
- return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
14770
- if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
14771
- return ctx.column + (closing ? 0 : 1);
14772
- if (ctx.type == ")" && !closing)
14773
- return ctx.indented + statementIndentUnit;
14774
- return ctx.indented + (closing ? 0 : indentUnit) + (!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
14775
- },
14776
- electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
14777
- blockCommentStart: "/*",
14778
- blockCommentEnd: "*/",
14779
- blockCommentContinue: " * ",
14780
- lineComment: "//",
14781
- fold: "brace"
14782
- };
14783
- });
14784
- function words(str) {
14785
- var obj = {}, words2 = str.split(" ");
14786
- for (var i = 0; i < words2.length; ++i) obj[words2[i]] = true;
14787
- return obj;
14788
- }
14789
- function contains(words2, word) {
14790
- if (typeof words2 === "function") {
14791
- return words2(word);
14792
- } else {
14793
- return words2.propertyIsEnumerable(word);
14794
- }
14795
- }
14796
- var cKeywords = "auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran";
14797
- var cppKeywords = "alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq";
14798
- var objCKeywords = "bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available";
14799
- var objCBuiltins = "FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT";
14800
- var basicCTypes = words("int long char short double float unsigned signed void bool");
14801
- var basicObjCTypes = words("SEL instancetype id Class Protocol BOOL");
14802
- function cTypes(identifier) {
14803
- return contains(basicCTypes, identifier) || /.+_t$/.test(identifier);
14804
- }
14805
- function objCTypes(identifier) {
14806
- return cTypes(identifier) || contains(basicObjCTypes, identifier);
14807
- }
14808
- var cBlockKeywords = "case do else for if switch while struct enum union";
14809
- var cDefKeywords = "struct enum union";
14810
- function cppHook(stream, state) {
14811
- if (!state.startOfLine) return false;
14812
- for (var ch, next = null; ch = stream.peek(); ) {
14813
- if (ch == "\\" && stream.match(/^.$/)) {
14814
- next = cppHook;
14815
- break;
14816
- } else if (ch == "/" && stream.match(/^\/[\/\*]/, false)) {
14817
- break;
14998
+ } else if (ch == "/" && stream.eat("*")) {
14999
+ state.tokenize = tokenNestedComment(depth + 1);
15000
+ return state.tokenize(stream, state);
14818
15001
  }
14819
- stream.next();
14820
15002
  }
14821
- state.tokenize = next;
14822
- return "meta";
14823
- }
14824
- function pointerHook(_stream, state) {
14825
- if (state.prevToken == "type") return "type";
14826
- return false;
14827
- }
14828
- function cIsReservedIdentifier(token) {
14829
- if (!token || token.length < 2) return false;
14830
- if (token[0] != "_") return false;
14831
- return token[1] == "_" || token[1] !== token[1].toLowerCase();
14832
- }
14833
- function cpp14Literal(stream) {
14834
- stream.eatWhile(/[\w\.']/);
14835
- return "number";
14836
- }
14837
- function cpp11StringHook(stream, state) {
14838
- stream.backUp(1);
14839
- if (stream.match(/^(?:R|u8R|uR|UR|LR)/)) {
14840
- var match = stream.match(/^"([^\s\\()]{0,16})\(/);
14841
- if (!match) {
15003
+ return "comment";
15004
+ };
15005
+ }
15006
+ def("text/x-scala", {
15007
+ name: "clike",
15008
+ keywords: words(
15009
+ /* scala */
15010
+ "abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"
15011
+ ),
15012
+ types: words(
15013
+ "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
15014
+ ),
15015
+ multiLineStrings: true,
15016
+ blockKeywords: words("catch class enum do else finally for forSome if match switch try while"),
15017
+ defKeywords: words("class enum def object package trait type val var"),
15018
+ atoms: words("true false null"),
15019
+ indentStatements: false,
15020
+ indentSwitch: false,
15021
+ isOperatorChar: /[+\-*&%=<>!?|\/#:@]/,
15022
+ hooks: {
15023
+ "@": function(stream) {
15024
+ stream.eatWhile(/[\w\$_]/);
15025
+ return "meta";
15026
+ },
15027
+ '"': function(stream, state) {
15028
+ if (!stream.match('""')) return false;
15029
+ state.tokenize = tokenTripleString;
15030
+ return state.tokenize(stream, state);
15031
+ },
15032
+ "'": function(stream) {
15033
+ if (stream.match(/^(\\[^'\s]+|[^\\'])'/)) return "string-2";
15034
+ stream.eatWhile(/[\w\$_\xa1-\uffff]/);
15035
+ return "atom";
15036
+ },
15037
+ "=": function(stream, state) {
15038
+ var cx = state.context;
15039
+ if (cx.type == "}" && cx.align && stream.eat(">")) {
15040
+ state.context = new Context(cx.indented, cx.column, cx.type, cx.info, null, cx.prev);
15041
+ return "operator";
15042
+ } else {
14842
15043
  return false;
14843
15044
  }
14844
- state.cpp11RawStringDelim = match[1];
14845
- state.tokenize = tokenRawString;
14846
- return tokenRawString(stream, state);
15045
+ },
15046
+ "/": function(stream, state) {
15047
+ if (!stream.eat("*")) return false;
15048
+ state.tokenize = tokenNestedComment(1);
15049
+ return state.tokenize(stream, state);
14847
15050
  }
14848
- if (stream.match(/^(?:u8|u|U|L)/)) {
14849
- if (stream.match(
14850
- /^["']/,
14851
- /* eat */
14852
- false
14853
- )) {
14854
- return "string";
15051
+ },
15052
+ modeProps: { closeBrackets: { pairs: '()[]{}""', triples: '"' } }
15053
+ });
15054
+ function tokenKotlinString(tripleString) {
15055
+ return function(stream, state) {
15056
+ var escaped = false, next, end = false;
15057
+ while (!stream.eol()) {
15058
+ if (!tripleString && !escaped && stream.match('"')) {
15059
+ end = true;
15060
+ break;
14855
15061
  }
14856
- return false;
14857
- }
14858
- stream.next();
14859
- return false;
14860
- }
14861
- function cppLooksLikeConstructor(word) {
14862
- var lastTwo = /(\w+)::~?(\w+)$/.exec(word);
14863
- return lastTwo && lastTwo[1] == lastTwo[2];
14864
- }
14865
- function tokenAtString(stream, state) {
14866
- var next;
14867
- while ((next = stream.next()) != null) {
14868
- if (next == '"' && !stream.eat('"')) {
14869
- state.tokenize = null;
15062
+ if (tripleString && stream.match('"""')) {
15063
+ end = true;
14870
15064
  break;
14871
15065
  }
15066
+ next = stream.next();
15067
+ if (!escaped && next == "$" && stream.match("{"))
15068
+ stream.skipTo("}");
15069
+ escaped = !escaped && next == "\\" && !tripleString;
14872
15070
  }
14873
- return "string";
14874
- }
14875
- function tokenRawString(stream, state) {
14876
- var delim = state.cpp11RawStringDelim.replace(/[^\w\s]/g, "\\$&");
14877
- var match = stream.match(new RegExp(".*?\\)" + delim + '"'));
14878
- if (match)
15071
+ if (end || !tripleString)
14879
15072
  state.tokenize = null;
14880
- else
14881
- stream.skipToEnd();
14882
15073
  return "string";
14883
- }
14884
- function def(mimes, mode) {
14885
- if (typeof mimes == "string") mimes = [mimes];
14886
- var words2 = [];
14887
- function add(obj) {
14888
- if (obj) {
14889
- for (var prop in obj) if (obj.hasOwnProperty(prop))
14890
- words2.push(prop);
14891
- }
14892
- }
14893
- add(mode.keywords);
14894
- add(mode.types);
14895
- add(mode.builtin);
14896
- add(mode.atoms);
14897
- if (words2.length) {
14898
- mode.helperType = mimes[0];
14899
- CodeMirror.registerHelper("hintWords", mimes[0], words2);
14900
- }
14901
- for (var i = 0; i < mimes.length; ++i)
14902
- CodeMirror.defineMIME(mimes[i], mode);
14903
- }
14904
- def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
14905
- name: "clike",
14906
- keywords: words(cKeywords),
14907
- types: cTypes,
14908
- blockKeywords: words(cBlockKeywords),
14909
- defKeywords: words(cDefKeywords),
14910
- typeFirstDefinitions: true,
14911
- atoms: words("NULL true false"),
14912
- isReservedIdentifier: cIsReservedIdentifier,
14913
- hooks: {
14914
- "#": cppHook,
14915
- "*": pointerHook
15074
+ };
15075
+ }
15076
+ def("text/x-kotlin", {
15077
+ name: "clike",
15078
+ keywords: words(
15079
+ /*keywords*/
15080
+ "package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam value"
15081
+ ),
15082
+ types: words(
15083
+ /* package java.lang */
15084
+ "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"
15085
+ ),
15086
+ intendSwitch: false,
15087
+ indentStatements: false,
15088
+ multiLineStrings: true,
15089
+ number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
15090
+ blockKeywords: words("catch class do else finally for if where try while enum"),
15091
+ defKeywords: words("class val var object interface fun"),
15092
+ atoms: words("true false null this"),
15093
+ hooks: {
15094
+ "@": function(stream) {
15095
+ stream.eatWhile(/[\w\$_]/);
15096
+ return "meta";
14916
15097
  },
14917
- modeProps: { fold: ["brace", "include"] }
14918
- });
14919
- def(["text/x-c++src", "text/x-c++hdr"], {
14920
- name: "clike",
14921
- keywords: words(cKeywords + " " + cppKeywords),
14922
- types: cTypes,
14923
- blockKeywords: words(cBlockKeywords + " class try catch"),
14924
- defKeywords: words(cDefKeywords + " class namespace"),
14925
- typeFirstDefinitions: true,
14926
- atoms: words("true false NULL nullptr"),
14927
- dontIndentStatements: /^template$/,
14928
- isIdentifierChar: /[\w\$_~\xa1-\uffff]/,
14929
- isReservedIdentifier: cIsReservedIdentifier,
14930
- hooks: {
14931
- "#": cppHook,
14932
- "*": pointerHook,
14933
- "u": cpp11StringHook,
14934
- "U": cpp11StringHook,
14935
- "L": cpp11StringHook,
14936
- "R": cpp11StringHook,
14937
- "0": cpp14Literal,
14938
- "1": cpp14Literal,
14939
- "2": cpp14Literal,
14940
- "3": cpp14Literal,
14941
- "4": cpp14Literal,
14942
- "5": cpp14Literal,
14943
- "6": cpp14Literal,
14944
- "7": cpp14Literal,
14945
- "8": cpp14Literal,
14946
- "9": cpp14Literal,
14947
- token: function(stream, state, style) {
14948
- if (style == "variable" && stream.peek() == "(" && (state.prevToken == ";" || state.prevToken == null || state.prevToken == "}") && cppLooksLikeConstructor(stream.current()))
14949
- return "def";
14950
- }
15098
+ "*": function(_stream, state) {
15099
+ return state.prevToken == "." ? "variable" : "operator";
14951
15100
  },
14952
- namespaceSeparator: "::",
14953
- modeProps: { fold: ["brace", "include"] }
14954
- });
14955
- def("text/x-java", {
14956
- name: "clike",
14957
- keywords: words("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),
14958
- types: words("var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),
14959
- blockKeywords: words("catch class do else finally for if switch try while"),
14960
- defKeywords: words("class interface enum @interface"),
14961
- typeFirstDefinitions: true,
14962
- atoms: words("true false null"),
14963
- number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
14964
- hooks: {
14965
- "@": function(stream) {
14966
- if (stream.match("interface", false)) return false;
14967
- stream.eatWhile(/[\w\$_]/);
14968
- return "meta";
14969
- },
14970
- '"': function(stream, state) {
14971
- if (!stream.match(/""$/)) return false;
14972
- state.tokenize = tokenTripleString;
14973
- return state.tokenize(stream, state);
14974
- }
15101
+ '"': function(stream, state) {
15102
+ state.tokenize = tokenKotlinString(stream.match('""'));
15103
+ return state.tokenize(stream, state);
14975
15104
  },
14976
- modeProps: { fold: ["brace", "import"] }
14977
- });
14978
- def("text/x-csharp", {
14979
- name: "clike",
14980
- keywords: words("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in init interface internal is lock namespace new operator out override params private protected public readonly record ref required return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),
14981
- types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),
14982
- blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
14983
- defKeywords: words("class interface namespace record struct var"),
14984
- typeFirstDefinitions: true,
14985
- atoms: words("true false null"),
14986
- hooks: {
14987
- "@": function(stream, state) {
14988
- if (stream.eat('"')) {
14989
- state.tokenize = tokenAtString;
14990
- return tokenAtString(stream, state);
14991
- }
14992
- stream.eatWhile(/[\w\$_]/);
14993
- return "meta";
14994
- }
14995
- }
14996
- });
14997
- function tokenTripleString(stream, state) {
14998
- var escaped = false;
15105
+ "/": function(stream, state) {
15106
+ if (!stream.eat("*")) return false;
15107
+ state.tokenize = tokenNestedComment(1);
15108
+ return state.tokenize(stream, state);
15109
+ },
15110
+ indent: function(state, ctx, textAfter, indentUnit) {
15111
+ var firstChar = textAfter && textAfter.charAt(0);
15112
+ if ((state.prevToken == "}" || state.prevToken == ")") && textAfter == "")
15113
+ return state.indented;
15114
+ if (state.prevToken == "operator" && textAfter != "}" && state.context.type != "}" || state.prevToken == "variable" && firstChar == "." || (state.prevToken == "}" || state.prevToken == ")") && firstChar == ".")
15115
+ return indentUnit * 2 + ctx.indented;
15116
+ if (ctx.align && ctx.type == "}")
15117
+ return ctx.indented + (state.context.type == (textAfter || "").charAt(0) ? 0 : indentUnit);
15118
+ }
15119
+ },
15120
+ modeProps: { closeBrackets: { triples: '"' } }
15121
+ });
15122
+ def(["x-shader/x-vertex", "x-shader/x-fragment"], {
15123
+ name: "clike",
15124
+ keywords: words("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),
15125
+ types: words("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),
15126
+ blockKeywords: words("for while do if else struct"),
15127
+ builtin: words("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),
15128
+ atoms: words("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),
15129
+ indentSwitch: false,
15130
+ hooks: { "#": cppHook },
15131
+ modeProps: { fold: ["brace", "include"] }
15132
+ });
15133
+ def("text/x-nesc", {
15134
+ name: "clike",
15135
+ keywords: words(cKeywords + " as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),
15136
+ types: cTypes,
15137
+ blockKeywords: words(cBlockKeywords),
15138
+ atoms: words("null true false"),
15139
+ hooks: { "#": cppHook },
15140
+ modeProps: { fold: ["brace", "include"] }
15141
+ });
15142
+ def("text/x-objectivec", {
15143
+ name: "clike",
15144
+ keywords: words(cKeywords + " " + objCKeywords),
15145
+ types: objCTypes,
15146
+ builtin: words(objCBuiltins),
15147
+ blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized"),
15148
+ defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class"),
15149
+ dontIndentStatements: /^@.*$/,
15150
+ typeFirstDefinitions: true,
15151
+ atoms: words("YES NO NULL Nil nil true false nullptr"),
15152
+ isReservedIdentifier: cIsReservedIdentifier,
15153
+ hooks: {
15154
+ "#": cppHook,
15155
+ "*": pointerHook
15156
+ },
15157
+ modeProps: { fold: ["brace", "include"] }
15158
+ });
15159
+ def("text/x-objectivec++", {
15160
+ name: "clike",
15161
+ keywords: words(cKeywords + " " + objCKeywords + " " + cppKeywords),
15162
+ types: objCTypes,
15163
+ builtin: words(objCBuiltins),
15164
+ blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),
15165
+ defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class class namespace"),
15166
+ dontIndentStatements: /^@.*$|^template$/,
15167
+ typeFirstDefinitions: true,
15168
+ atoms: words("YES NO NULL Nil nil true false nullptr"),
15169
+ isReservedIdentifier: cIsReservedIdentifier,
15170
+ hooks: {
15171
+ "#": cppHook,
15172
+ "*": pointerHook,
15173
+ "u": cpp11StringHook,
15174
+ "U": cpp11StringHook,
15175
+ "L": cpp11StringHook,
15176
+ "R": cpp11StringHook,
15177
+ "0": cpp14Literal,
15178
+ "1": cpp14Literal,
15179
+ "2": cpp14Literal,
15180
+ "3": cpp14Literal,
15181
+ "4": cpp14Literal,
15182
+ "5": cpp14Literal,
15183
+ "6": cpp14Literal,
15184
+ "7": cpp14Literal,
15185
+ "8": cpp14Literal,
15186
+ "9": cpp14Literal,
15187
+ token: function(stream, state, style) {
15188
+ if (style == "variable" && stream.peek() == "(" && (state.prevToken == ";" || state.prevToken == null || state.prevToken == "}") && cppLooksLikeConstructor(stream.current()))
15189
+ return "def";
15190
+ }
15191
+ },
15192
+ namespaceSeparator: "::",
15193
+ modeProps: { fold: ["brace", "include"] }
15194
+ });
15195
+ def("text/x-squirrel", {
15196
+ name: "clike",
15197
+ keywords: words("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),
15198
+ types: cTypes,
15199
+ blockKeywords: words("case catch class else for foreach if switch try while"),
15200
+ defKeywords: words("function local class"),
15201
+ typeFirstDefinitions: true,
15202
+ atoms: words("true false null"),
15203
+ hooks: { "#": cppHook },
15204
+ modeProps: { fold: ["brace", "include"] }
15205
+ });
15206
+ var stringTokenizer = null;
15207
+ function tokenCeylonString(type) {
15208
+ return function(stream, state) {
15209
+ var escaped = false, next, end = false;
14999
15210
  while (!stream.eol()) {
15000
- if (!escaped && stream.match('"""')) {
15001
- state.tokenize = null;
15211
+ if (!escaped && stream.match('"') && (type == "single" || stream.match('""'))) {
15212
+ end = true;
15213
+ break;
15214
+ }
15215
+ if (!escaped && stream.match("``")) {
15216
+ stringTokenizer = tokenCeylonString(type);
15217
+ end = true;
15002
15218
  break;
15003
15219
  }
15004
- escaped = stream.next() == "\\" && !escaped;
15220
+ next = stream.next();
15221
+ escaped = type == "single" && !escaped && next == "\\";
15005
15222
  }
15223
+ if (end)
15224
+ state.tokenize = null;
15006
15225
  return "string";
15007
- }
15008
- function tokenNestedComment(depth) {
15009
- return function(stream, state) {
15010
- var ch;
15011
- while (ch = stream.next()) {
15012
- if (ch == "*" && stream.eat("/")) {
15013
- if (depth == 1) {
15014
- state.tokenize = null;
15015
- break;
15016
- } else {
15017
- state.tokenize = tokenNestedComment(depth - 1);
15018
- return state.tokenize(stream, state);
15019
- }
15020
- } else if (ch == "/" && stream.eat("*")) {
15021
- state.tokenize = tokenNestedComment(depth + 1);
15022
- return state.tokenize(stream, state);
15023
- }
15024
- }
15025
- return "comment";
15026
- };
15027
- }
15028
- def("text/x-scala", {
15029
- name: "clike",
15030
- keywords: words(
15031
- /* scala */
15032
- "abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"
15033
- ),
15034
- types: words(
15035
- "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
15036
- ),
15037
- multiLineStrings: true,
15038
- blockKeywords: words("catch class enum do else finally for forSome if match switch try while"),
15039
- defKeywords: words("class enum def object package trait type val var"),
15040
- atoms: words("true false null"),
15041
- indentStatements: false,
15042
- indentSwitch: false,
15043
- isOperatorChar: /[+\-*&%=<>!?|\/#:@]/,
15044
- hooks: {
15045
- "@": function(stream) {
15046
- stream.eatWhile(/[\w\$_]/);
15047
- return "meta";
15048
- },
15049
- '"': function(stream, state) {
15050
- if (!stream.match('""')) return false;
15051
- state.tokenize = tokenTripleString;
15052
- return state.tokenize(stream, state);
15053
- },
15054
- "'": function(stream) {
15055
- if (stream.match(/^(\\[^'\s]+|[^\\'])'/)) return "string-2";
15056
- stream.eatWhile(/[\w\$_\xa1-\uffff]/);
15057
- return "atom";
15058
- },
15059
- "=": function(stream, state) {
15060
- var cx = state.context;
15061
- if (cx.type == "}" && cx.align && stream.eat(">")) {
15062
- state.context = new Context(cx.indented, cx.column, cx.type, cx.info, null, cx.prev);
15063
- return "operator";
15064
- } else {
15065
- return false;
15066
- }
15067
- },
15068
- "/": function(stream, state) {
15069
- if (!stream.eat("*")) return false;
15070
- state.tokenize = tokenNestedComment(1);
15071
- return state.tokenize(stream, state);
15072
- }
15073
- },
15074
- modeProps: { closeBrackets: { pairs: '()[]{}""', triples: '"' } }
15075
- });
15076
- function tokenKotlinString(tripleString) {
15077
- return function(stream, state) {
15078
- var escaped = false, next, end = false;
15079
- while (!stream.eol()) {
15080
- if (!tripleString && !escaped && stream.match('"')) {
15081
- end = true;
15082
- break;
15083
- }
15084
- if (tripleString && stream.match('"""')) {
15085
- end = true;
15086
- break;
15087
- }
15088
- next = stream.next();
15089
- if (!escaped && next == "$" && stream.match("{"))
15090
- stream.skipTo("}");
15091
- escaped = !escaped && next == "\\" && !tripleString;
15092
- }
15093
- if (end || !tripleString)
15094
- state.tokenize = null;
15095
- return "string";
15096
- };
15097
- }
15098
- def("text/x-kotlin", {
15099
- name: "clike",
15100
- keywords: words(
15101
- /*keywords*/
15102
- "package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam value"
15103
- ),
15104
- types: words(
15105
- /* package java.lang */
15106
- "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"
15107
- ),
15108
- intendSwitch: false,
15109
- indentStatements: false,
15110
- multiLineStrings: true,
15111
- number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
15112
- blockKeywords: words("catch class do else finally for if where try while enum"),
15113
- defKeywords: words("class val var object interface fun"),
15114
- atoms: words("true false null this"),
15115
- hooks: {
15116
- "@": function(stream) {
15117
- stream.eatWhile(/[\w\$_]/);
15118
- return "meta";
15119
- },
15120
- "*": function(_stream, state) {
15121
- return state.prevToken == "." ? "variable" : "operator";
15122
- },
15123
- '"': function(stream, state) {
15124
- state.tokenize = tokenKotlinString(stream.match('""'));
15125
- return state.tokenize(stream, state);
15126
- },
15127
- "/": function(stream, state) {
15128
- if (!stream.eat("*")) return false;
15129
- state.tokenize = tokenNestedComment(1);
15130
- return state.tokenize(stream, state);
15131
- },
15132
- indent: function(state, ctx, textAfter, indentUnit) {
15133
- var firstChar = textAfter && textAfter.charAt(0);
15134
- if ((state.prevToken == "}" || state.prevToken == ")") && textAfter == "")
15135
- return state.indented;
15136
- if (state.prevToken == "operator" && textAfter != "}" && state.context.type != "}" || state.prevToken == "variable" && firstChar == "." || (state.prevToken == "}" || state.prevToken == ")") && firstChar == ".")
15137
- return indentUnit * 2 + ctx.indented;
15138
- if (ctx.align && ctx.type == "}")
15139
- return ctx.indented + (state.context.type == (textAfter || "").charAt(0) ? 0 : indentUnit);
15140
- }
15226
+ };
15227
+ }
15228
+ def("text/x-ceylon", {
15229
+ name: "clike",
15230
+ keywords: words("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),
15231
+ types: function(word) {
15232
+ var first = word.charAt(0);
15233
+ return first === first.toUpperCase() && first !== first.toLowerCase();
15234
+ },
15235
+ blockKeywords: words("case catch class dynamic else finally for function if interface module new object switch try while"),
15236
+ defKeywords: words("class dynamic function interface module object package value"),
15237
+ builtin: words("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),
15238
+ isPunctuationChar: /[\[\]{}\(\),;\:\.`]/,
15239
+ isOperatorChar: /[+\-*&%=<>!?|^~:\/]/,
15240
+ numberStart: /[\d#$]/,
15241
+ number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,
15242
+ multiLineStrings: true,
15243
+ typeFirstDefinitions: true,
15244
+ atoms: words("true false null larger smaller equal empty finished"),
15245
+ indentSwitch: false,
15246
+ styleDefs: false,
15247
+ hooks: {
15248
+ "@": function(stream) {
15249
+ stream.eatWhile(/[\w\$_]/);
15250
+ return "meta";
15141
15251
  },
15142
- modeProps: { closeBrackets: { triples: '"' } }
15143
- });
15144
- def(["x-shader/x-vertex", "x-shader/x-fragment"], {
15145
- name: "clike",
15146
- keywords: words("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),
15147
- types: words("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),
15148
- blockKeywords: words("for while do if else struct"),
15149
- builtin: words("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),
15150
- atoms: words("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),
15151
- indentSwitch: false,
15152
- hooks: { "#": cppHook },
15153
- modeProps: { fold: ["brace", "include"] }
15154
- });
15155
- def("text/x-nesc", {
15156
- name: "clike",
15157
- keywords: words(cKeywords + " as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),
15158
- types: cTypes,
15159
- blockKeywords: words(cBlockKeywords),
15160
- atoms: words("null true false"),
15161
- hooks: { "#": cppHook },
15162
- modeProps: { fold: ["brace", "include"] }
15163
- });
15164
- def("text/x-objectivec", {
15165
- name: "clike",
15166
- keywords: words(cKeywords + " " + objCKeywords),
15167
- types: objCTypes,
15168
- builtin: words(objCBuiltins),
15169
- blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized"),
15170
- defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class"),
15171
- dontIndentStatements: /^@.*$/,
15172
- typeFirstDefinitions: true,
15173
- atoms: words("YES NO NULL Nil nil true false nullptr"),
15174
- isReservedIdentifier: cIsReservedIdentifier,
15175
- hooks: {
15176
- "#": cppHook,
15177
- "*": pointerHook
15252
+ '"': function(stream, state) {
15253
+ state.tokenize = tokenCeylonString(stream.match('""') ? "triple" : "single");
15254
+ return state.tokenize(stream, state);
15178
15255
  },
15179
- modeProps: { fold: ["brace", "include"] }
15180
- });
15181
- def("text/x-objectivec++", {
15182
- name: "clike",
15183
- keywords: words(cKeywords + " " + objCKeywords + " " + cppKeywords),
15184
- types: objCTypes,
15185
- builtin: words(objCBuiltins),
15186
- blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),
15187
- defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class class namespace"),
15188
- dontIndentStatements: /^@.*$|^template$/,
15189
- typeFirstDefinitions: true,
15190
- atoms: words("YES NO NULL Nil nil true false nullptr"),
15191
- isReservedIdentifier: cIsReservedIdentifier,
15192
- hooks: {
15193
- "#": cppHook,
15194
- "*": pointerHook,
15195
- "u": cpp11StringHook,
15196
- "U": cpp11StringHook,
15197
- "L": cpp11StringHook,
15198
- "R": cpp11StringHook,
15199
- "0": cpp14Literal,
15200
- "1": cpp14Literal,
15201
- "2": cpp14Literal,
15202
- "3": cpp14Literal,
15203
- "4": cpp14Literal,
15204
- "5": cpp14Literal,
15205
- "6": cpp14Literal,
15206
- "7": cpp14Literal,
15207
- "8": cpp14Literal,
15208
- "9": cpp14Literal,
15209
- token: function(stream, state, style) {
15210
- if (style == "variable" && stream.peek() == "(" && (state.prevToken == ";" || state.prevToken == null || state.prevToken == "}") && cppLooksLikeConstructor(stream.current()))
15211
- return "def";
15212
- }
15256
+ "`": function(stream, state) {
15257
+ if (!stringTokenizer || !stream.match("`")) return false;
15258
+ state.tokenize = stringTokenizer;
15259
+ stringTokenizer = null;
15260
+ return state.tokenize(stream, state);
15213
15261
  },
15214
- namespaceSeparator: "::",
15215
- modeProps: { fold: ["brace", "include"] }
15216
- });
15217
- def("text/x-squirrel", {
15218
- name: "clike",
15219
- keywords: words("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),
15220
- types: cTypes,
15221
- blockKeywords: words("case catch class else for foreach if switch try while"),
15222
- defKeywords: words("function local class"),
15223
- typeFirstDefinitions: true,
15224
- atoms: words("true false null"),
15225
- hooks: { "#": cppHook },
15226
- modeProps: { fold: ["brace", "include"] }
15227
- });
15228
- var stringTokenizer = null;
15229
- function tokenCeylonString(type) {
15230
- return function(stream, state) {
15231
- var escaped = false, next, end = false;
15232
- while (!stream.eol()) {
15233
- if (!escaped && stream.match('"') && (type == "single" || stream.match('""'))) {
15234
- end = true;
15235
- break;
15236
- }
15237
- if (!escaped && stream.match("``")) {
15238
- stringTokenizer = tokenCeylonString(type);
15239
- end = true;
15240
- break;
15241
- }
15242
- next = stream.next();
15243
- escaped = type == "single" && !escaped && next == "\\";
15244
- }
15245
- if (end)
15246
- state.tokenize = null;
15247
- return "string";
15248
- };
15249
- }
15250
- def("text/x-ceylon", {
15251
- name: "clike",
15252
- keywords: words("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),
15253
- types: function(word) {
15254
- var first = word.charAt(0);
15255
- return first === first.toUpperCase() && first !== first.toLowerCase();
15262
+ "'": function(stream) {
15263
+ stream.eatWhile(/[\w\$_\xa1-\uffff]/);
15264
+ return "atom";
15256
15265
  },
15257
- blockKeywords: words("case catch class dynamic else finally for function if interface module new object switch try while"),
15258
- defKeywords: words("class dynamic function interface module object package value"),
15259
- builtin: words("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),
15260
- isPunctuationChar: /[\[\]{}\(\),;\:\.`]/,
15261
- isOperatorChar: /[+\-*&%=<>!?|^~:\/]/,
15262
- numberStart: /[\d#$]/,
15263
- number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,
15264
- multiLineStrings: true,
15265
- typeFirstDefinitions: true,
15266
- atoms: words("true false null larger smaller equal empty finished"),
15267
- indentSwitch: false,
15268
- styleDefs: false,
15269
- hooks: {
15270
- "@": function(stream) {
15271
- stream.eatWhile(/[\w\$_]/);
15272
- return "meta";
15273
- },
15274
- '"': function(stream, state) {
15275
- state.tokenize = tokenCeylonString(stream.match('""') ? "triple" : "single");
15276
- return state.tokenize(stream, state);
15277
- },
15278
- "`": function(stream, state) {
15279
- if (!stringTokenizer || !stream.match("`")) return false;
15280
- state.tokenize = stringTokenizer;
15281
- stringTokenizer = null;
15282
- return state.tokenize(stream, state);
15283
- },
15284
- "'": function(stream) {
15285
- stream.eatWhile(/[\w\$_\xa1-\uffff]/);
15286
- return "atom";
15287
- },
15288
- token: function(_stream, state, style) {
15289
- if ((style == "variable" || style == "type") && state.prevToken == ".") {
15290
- return "variable-2";
15291
- }
15266
+ token: function(_stream, state, style) {
15267
+ if ((style == "variable" || style == "type") && state.prevToken == ".") {
15268
+ return "variable-2";
15292
15269
  }
15293
- },
15294
- modeProps: {
15295
- fold: ["brace", "import"],
15296
- closeBrackets: { triples: '"' }
15297
15270
  }
15298
- });
15271
+ },
15272
+ modeProps: {
15273
+ fold: ["brace", "import"],
15274
+ closeBrackets: { triples: '"' }
15275
+ }
15299
15276
  });
15300
- })();
15301
- return clike.exports;
15302
- }
15303
- requireClike();
15304
- var markdown = { exports: {} };
15277
+ });
15278
+ })();
15305
15279
  var meta = { exports: {} };
15306
15280
  var hasRequiredMeta;
15307
15281
  function requireMeta() {
@@ -15532,1153 +15506,944 @@ function requireMeta() {
15532
15506
  })();
15533
15507
  return meta.exports;
15534
15508
  }
15535
- var hasRequiredMarkdown;
15536
- function requireMarkdown() {
15537
- if (hasRequiredMarkdown) return markdown.exports;
15538
- hasRequiredMarkdown = 1;
15539
- (function(module, exports) {
15540
- (function(mod) {
15541
- mod(requireCodemirror(), requireXml(), requireMeta());
15542
- })(function(CodeMirror) {
15543
- CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
15544
- var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
15545
- var htmlModeMissing = htmlMode.name == "null";
15546
- function getMode(name) {
15547
- if (CodeMirror.findModeByName) {
15548
- var found = CodeMirror.findModeByName(name);
15549
- if (found) name = found.mime || found.mimes[0];
15550
- }
15551
- var mode2 = CodeMirror.getMode(cmCfg, name);
15552
- return mode2.name == "null" ? null : mode2;
15553
- }
15554
- if (modeCfg.highlightFormatting === void 0)
15555
- modeCfg.highlightFormatting = false;
15556
- if (modeCfg.maxBlockquoteDepth === void 0)
15557
- modeCfg.maxBlockquoteDepth = 0;
15558
- if (modeCfg.taskLists === void 0) modeCfg.taskLists = false;
15559
- if (modeCfg.strikethrough === void 0)
15560
- modeCfg.strikethrough = false;
15561
- if (modeCfg.emoji === void 0)
15562
- modeCfg.emoji = false;
15563
- if (modeCfg.fencedCodeBlockHighlighting === void 0)
15564
- modeCfg.fencedCodeBlockHighlighting = true;
15565
- if (modeCfg.fencedCodeBlockDefaultMode === void 0)
15566
- modeCfg.fencedCodeBlockDefaultMode = "text/plain";
15567
- if (modeCfg.xml === void 0)
15568
- modeCfg.xml = true;
15569
- if (modeCfg.tokenTypeOverrides === void 0)
15570
- modeCfg.tokenTypeOverrides = {};
15571
- var tokenTypes = {
15572
- header: "header",
15573
- code: "comment",
15574
- quote: "quote",
15575
- list1: "variable-2",
15576
- list2: "variable-3",
15577
- list3: "keyword",
15578
- hr: "hr",
15579
- image: "image",
15580
- imageAltText: "image-alt-text",
15581
- imageMarker: "image-marker",
15582
- formatting: "formatting",
15583
- linkInline: "link",
15584
- linkEmail: "link",
15585
- linkText: "link",
15586
- linkHref: "string",
15587
- em: "em",
15588
- strong: "strong",
15589
- strikethrough: "strikethrough",
15590
- emoji: "builtin"
15591
- };
15592
- for (var tokenType in tokenTypes) {
15593
- if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
15594
- tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
15509
+ (function(module, exports) {
15510
+ (function(mod) {
15511
+ mod(requireCodemirror(), requireXml(), requireMeta());
15512
+ })(function(CodeMirror) {
15513
+ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
15514
+ var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
15515
+ var htmlModeMissing = htmlMode.name == "null";
15516
+ function getMode(name) {
15517
+ if (CodeMirror.findModeByName) {
15518
+ var found = CodeMirror.findModeByName(name);
15519
+ if (found) name = found.mime || found.mimes[0];
15520
+ }
15521
+ var mode2 = CodeMirror.getMode(cmCfg, name);
15522
+ return mode2.name == "null" ? null : mode2;
15523
+ }
15524
+ if (modeCfg.highlightFormatting === void 0)
15525
+ modeCfg.highlightFormatting = false;
15526
+ if (modeCfg.maxBlockquoteDepth === void 0)
15527
+ modeCfg.maxBlockquoteDepth = 0;
15528
+ if (modeCfg.taskLists === void 0) modeCfg.taskLists = false;
15529
+ if (modeCfg.strikethrough === void 0)
15530
+ modeCfg.strikethrough = false;
15531
+ if (modeCfg.emoji === void 0)
15532
+ modeCfg.emoji = false;
15533
+ if (modeCfg.fencedCodeBlockHighlighting === void 0)
15534
+ modeCfg.fencedCodeBlockHighlighting = true;
15535
+ if (modeCfg.fencedCodeBlockDefaultMode === void 0)
15536
+ modeCfg.fencedCodeBlockDefaultMode = "text/plain";
15537
+ if (modeCfg.xml === void 0)
15538
+ modeCfg.xml = true;
15539
+ if (modeCfg.tokenTypeOverrides === void 0)
15540
+ modeCfg.tokenTypeOverrides = {};
15541
+ var tokenTypes = {
15542
+ header: "header",
15543
+ code: "comment",
15544
+ quote: "quote",
15545
+ list1: "variable-2",
15546
+ list2: "variable-3",
15547
+ list3: "keyword",
15548
+ hr: "hr",
15549
+ image: "image",
15550
+ imageAltText: "image-alt-text",
15551
+ imageMarker: "image-marker",
15552
+ formatting: "formatting",
15553
+ linkInline: "link",
15554
+ linkEmail: "link",
15555
+ linkText: "link",
15556
+ linkHref: "string",
15557
+ em: "em",
15558
+ strong: "strong",
15559
+ strikethrough: "strikethrough",
15560
+ emoji: "builtin"
15561
+ };
15562
+ for (var tokenType in tokenTypes) {
15563
+ if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
15564
+ tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
15565
+ }
15566
+ }
15567
+ var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/, listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/, taskListRE = /^\[(x| )\](?=\s)/i, atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/, setextHeaderRE = /^ {0,3}(?:\={1,}|-{2,})\s*$/, textRE = /^[^#!\[\]*_\\<>` "'(~:]+/, fencedCodeRE = /^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/, linkDefRE = /^\s*\[[^\]]+?\]:.*$/, punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/, expandedTab = " ";
15568
+ function switchInline(stream, state, f) {
15569
+ state.f = state.inline = f;
15570
+ return f(stream, state);
15571
+ }
15572
+ function switchBlock(stream, state, f) {
15573
+ state.f = state.block = f;
15574
+ return f(stream, state);
15575
+ }
15576
+ function lineIsEmpty(line) {
15577
+ return !line || !/\S/.test(line.string);
15578
+ }
15579
+ function blankLine(state) {
15580
+ state.linkTitle = false;
15581
+ state.linkHref = false;
15582
+ state.linkText = false;
15583
+ state.em = false;
15584
+ state.strong = false;
15585
+ state.strikethrough = false;
15586
+ state.quote = 0;
15587
+ state.indentedCode = false;
15588
+ if (state.f == htmlBlock) {
15589
+ var exit = htmlModeMissing;
15590
+ if (!exit) {
15591
+ var inner = CodeMirror.innerMode(htmlMode, state.htmlState);
15592
+ exit = inner.mode.name == "xml" && inner.state.tagStart === null && (!inner.state.context && inner.state.tokenize.isInText);
15593
+ }
15594
+ if (exit) {
15595
+ state.f = inlineNormal;
15596
+ state.block = blockNormal;
15597
+ state.htmlState = null;
15595
15598
  }
15596
15599
  }
15597
- var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/, listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/, taskListRE = /^\[(x| )\](?=\s)/i, atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/, setextHeaderRE = /^ {0,3}(?:\={1,}|-{2,})\s*$/, textRE = /^[^#!\[\]*_\\<>` "'(~:]+/, fencedCodeRE = /^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/, linkDefRE = /^\s*\[[^\]]+?\]:.*$/, punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/, expandedTab = " ";
15598
- function switchInline(stream, state, f) {
15599
- state.f = state.inline = f;
15600
- return f(stream, state);
15601
- }
15602
- function switchBlock(stream, state, f) {
15603
- state.f = state.block = f;
15604
- return f(stream, state);
15605
- }
15606
- function lineIsEmpty(line) {
15607
- return !line || !/\S/.test(line.string);
15600
+ state.trailingSpace = 0;
15601
+ state.trailingSpaceNewLine = false;
15602
+ state.prevLine = state.thisLine;
15603
+ state.thisLine = { stream: null };
15604
+ return null;
15605
+ }
15606
+ function blockNormal(stream, state) {
15607
+ var firstTokenOnLine = stream.column() === state.indentation;
15608
+ var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
15609
+ var prevLineIsIndentedCode = state.indentedCode;
15610
+ var prevLineIsHr = state.prevLine.hr;
15611
+ var prevLineIsList = state.list !== false;
15612
+ var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
15613
+ state.indentedCode = false;
15614
+ var lineIndentation = state.indentation;
15615
+ if (state.indentationDiff === null) {
15616
+ state.indentationDiff = state.indentation;
15617
+ if (prevLineIsList) {
15618
+ state.list = null;
15619
+ while (lineIndentation < state.listStack[state.listStack.length - 1]) {
15620
+ state.listStack.pop();
15621
+ if (state.listStack.length) {
15622
+ state.indentation = state.listStack[state.listStack.length - 1];
15623
+ } else {
15624
+ state.list = false;
15625
+ }
15626
+ }
15627
+ if (state.list !== false) {
15628
+ state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1];
15629
+ }
15630
+ }
15608
15631
  }
15609
- function blankLine(state) {
15610
- state.linkTitle = false;
15611
- state.linkHref = false;
15612
- state.linkText = false;
15632
+ var allowsInlineContinuation = !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header && (!prevLineIsList || !prevLineIsIndentedCode) && !state.prevLine.fencedCodeEnd;
15633
+ var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) && state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
15634
+ var match = null;
15635
+ if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd || state.prevLine.header || prevLineLineIsEmpty)) {
15636
+ stream.skipToEnd();
15637
+ state.indentedCode = true;
15638
+ return tokenTypes.code;
15639
+ } else if (stream.eatSpace()) {
15640
+ return null;
15641
+ } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
15642
+ state.quote = 0;
15643
+ state.header = match[1].length;
15644
+ state.thisLine.header = true;
15645
+ if (modeCfg.highlightFormatting) state.formatting = "header";
15646
+ state.f = state.inline;
15647
+ return getType(state);
15648
+ } else if (state.indentation <= maxNonCodeIndentation && stream.eat(">")) {
15649
+ state.quote = firstTokenOnLine ? 1 : state.quote + 1;
15650
+ if (modeCfg.highlightFormatting) state.formatting = "quote";
15651
+ stream.eatSpace();
15652
+ return getType(state);
15653
+ } else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
15654
+ var listType = match[1] ? "ol" : "ul";
15655
+ state.indentation = lineIndentation + stream.current().length;
15656
+ state.list = true;
15657
+ state.quote = 0;
15658
+ state.listStack.push(state.indentation);
15613
15659
  state.em = false;
15614
15660
  state.strong = false;
15661
+ state.code = false;
15615
15662
  state.strikethrough = false;
15616
- state.quote = 0;
15617
- state.indentedCode = false;
15618
- if (state.f == htmlBlock) {
15619
- var exit = htmlModeMissing;
15620
- if (!exit) {
15621
- var inner = CodeMirror.innerMode(htmlMode, state.htmlState);
15622
- exit = inner.mode.name == "xml" && inner.state.tagStart === null && (!inner.state.context && inner.state.tokenize.isInText);
15623
- }
15624
- if (exit) {
15625
- state.f = inlineNormal;
15626
- state.block = blockNormal;
15627
- state.htmlState = null;
15628
- }
15629
- }
15630
- state.trailingSpace = 0;
15631
- state.trailingSpaceNewLine = false;
15632
- state.prevLine = state.thisLine;
15633
- state.thisLine = { stream: null };
15634
- return null;
15635
- }
15636
- function blockNormal(stream, state) {
15637
- var firstTokenOnLine = stream.column() === state.indentation;
15638
- var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
15639
- var prevLineIsIndentedCode = state.indentedCode;
15640
- var prevLineIsHr = state.prevLine.hr;
15641
- var prevLineIsList = state.list !== false;
15642
- var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
15643
- state.indentedCode = false;
15644
- var lineIndentation = state.indentation;
15645
- if (state.indentationDiff === null) {
15646
- state.indentationDiff = state.indentation;
15647
- if (prevLineIsList) {
15648
- state.list = null;
15649
- while (lineIndentation < state.listStack[state.listStack.length - 1]) {
15650
- state.listStack.pop();
15651
- if (state.listStack.length) {
15652
- state.indentation = state.listStack[state.listStack.length - 1];
15653
- } else {
15654
- state.list = false;
15655
- }
15656
- }
15657
- if (state.list !== false) {
15658
- state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1];
15659
- }
15660
- }
15663
+ if (modeCfg.taskLists && stream.match(taskListRE, false)) {
15664
+ state.taskList = true;
15661
15665
  }
15662
- var allowsInlineContinuation = !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header && (!prevLineIsList || !prevLineIsIndentedCode) && !state.prevLine.fencedCodeEnd;
15663
- var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) && state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
15664
- var match = null;
15665
- if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd || state.prevLine.header || prevLineLineIsEmpty)) {
15666
+ state.f = state.inline;
15667
+ if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
15668
+ return getType(state);
15669
+ } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
15670
+ state.quote = 0;
15671
+ state.fencedEndRE = new RegExp(match[1] + "+ *$");
15672
+ state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2] || modeCfg.fencedCodeBlockDefaultMode);
15673
+ if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
15674
+ state.f = state.block = local;
15675
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
15676
+ state.code = -1;
15677
+ return getType(state);
15678
+ } else if (
15679
+ // if setext set, indicates line after ---/===
15680
+ state.setext || // line before ---/===
15681
+ (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false && !state.code && !isHr && !linkDefRE.test(stream.string) && (match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
15682
+ ) {
15683
+ if (!state.setext) {
15684
+ state.header = match[0].charAt(0) == "=" ? 1 : 2;
15685
+ state.setext = state.header;
15686
+ } else {
15687
+ state.header = state.setext;
15688
+ state.setext = 0;
15666
15689
  stream.skipToEnd();
15667
- state.indentedCode = true;
15668
- return tokenTypes.code;
15669
- } else if (stream.eatSpace()) {
15670
- return null;
15671
- } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
15672
- state.quote = 0;
15673
- state.header = match[1].length;
15674
- state.thisLine.header = true;
15675
15690
  if (modeCfg.highlightFormatting) state.formatting = "header";
15676
- state.f = state.inline;
15677
- return getType(state);
15678
- } else if (state.indentation <= maxNonCodeIndentation && stream.eat(">")) {
15679
- state.quote = firstTokenOnLine ? 1 : state.quote + 1;
15680
- if (modeCfg.highlightFormatting) state.formatting = "quote";
15681
- stream.eatSpace();
15682
- return getType(state);
15683
- } else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
15684
- var listType = match[1] ? "ol" : "ul";
15685
- state.indentation = lineIndentation + stream.current().length;
15686
- state.list = true;
15687
- state.quote = 0;
15688
- state.listStack.push(state.indentation);
15689
- state.em = false;
15690
- state.strong = false;
15691
- state.code = false;
15692
- state.strikethrough = false;
15693
- if (modeCfg.taskLists && stream.match(taskListRE, false)) {
15694
- state.taskList = true;
15695
- }
15696
- state.f = state.inline;
15697
- if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
15698
- return getType(state);
15699
- } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
15700
- state.quote = 0;
15701
- state.fencedEndRE = new RegExp(match[1] + "+ *$");
15702
- state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2] || modeCfg.fencedCodeBlockDefaultMode);
15703
- if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
15704
- state.f = state.block = local;
15705
- if (modeCfg.highlightFormatting) state.formatting = "code-block";
15706
- state.code = -1;
15707
- return getType(state);
15708
- } else if (
15709
- // if setext set, indicates line after ---/===
15710
- state.setext || // line before ---/===
15711
- (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false && !state.code && !isHr && !linkDefRE.test(stream.string) && (match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
15712
- ) {
15713
- if (!state.setext) {
15714
- state.header = match[0].charAt(0) == "=" ? 1 : 2;
15715
- state.setext = state.header;
15716
- } else {
15717
- state.header = state.setext;
15718
- state.setext = 0;
15719
- stream.skipToEnd();
15720
- if (modeCfg.highlightFormatting) state.formatting = "header";
15721
- }
15722
- state.thisLine.header = true;
15723
- state.f = state.inline;
15724
- return getType(state);
15725
- } else if (isHr) {
15726
- stream.skipToEnd();
15727
- state.hr = true;
15728
- state.thisLine.hr = true;
15729
- return tokenTypes.hr;
15730
- } else if (stream.peek() === "[") {
15731
- return switchInline(stream, state, footnoteLink);
15732
15691
  }
15733
- return switchInline(stream, state, state.inline);
15734
- }
15735
- function htmlBlock(stream, state) {
15736
- var style = htmlMode.token(stream, state.htmlState);
15737
- if (!htmlModeMissing) {
15738
- var inner = CodeMirror.innerMode(htmlMode, state.htmlState);
15739
- if (inner.mode.name == "xml" && inner.state.tagStart === null && (!inner.state.context && inner.state.tokenize.isInText) || state.md_inside && stream.current().indexOf(">") > -1) {
15740
- state.f = inlineNormal;
15741
- state.block = blockNormal;
15742
- state.htmlState = null;
15743
- }
15692
+ state.thisLine.header = true;
15693
+ state.f = state.inline;
15694
+ return getType(state);
15695
+ } else if (isHr) {
15696
+ stream.skipToEnd();
15697
+ state.hr = true;
15698
+ state.thisLine.hr = true;
15699
+ return tokenTypes.hr;
15700
+ } else if (stream.peek() === "[") {
15701
+ return switchInline(stream, state, footnoteLink);
15702
+ }
15703
+ return switchInline(stream, state, state.inline);
15704
+ }
15705
+ function htmlBlock(stream, state) {
15706
+ var style = htmlMode.token(stream, state.htmlState);
15707
+ if (!htmlModeMissing) {
15708
+ var inner = CodeMirror.innerMode(htmlMode, state.htmlState);
15709
+ if (inner.mode.name == "xml" && inner.state.tagStart === null && (!inner.state.context && inner.state.tokenize.isInText) || state.md_inside && stream.current().indexOf(">") > -1) {
15710
+ state.f = inlineNormal;
15711
+ state.block = blockNormal;
15712
+ state.htmlState = null;
15744
15713
  }
15745
- return style;
15746
15714
  }
15747
- function local(stream, state) {
15748
- var currListInd = state.listStack[state.listStack.length - 1] || 0;
15749
- var hasExitedList = state.indentation < currListInd;
15750
- var maxFencedEndInd = currListInd + 3;
15751
- if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
15752
- if (modeCfg.highlightFormatting) state.formatting = "code-block";
15753
- var returnType;
15754
- if (!hasExitedList) returnType = getType(state);
15755
- state.localMode = state.localState = null;
15756
- state.block = blockNormal;
15757
- state.f = inlineNormal;
15758
- state.fencedEndRE = null;
15759
- state.code = 0;
15760
- state.thisLine.fencedCodeEnd = true;
15761
- if (hasExitedList) return switchBlock(stream, state, state.block);
15762
- return returnType;
15763
- } else if (state.localMode) {
15764
- return state.localMode.token(stream, state.localState);
15765
- } else {
15766
- stream.skipToEnd();
15767
- return tokenTypes.code;
15768
- }
15769
- }
15770
- function getType(state) {
15771
- var styles = [];
15772
- if (state.formatting) {
15773
- styles.push(tokenTypes.formatting);
15774
- if (typeof state.formatting === "string") state.formatting = [state.formatting];
15775
- for (var i = 0; i < state.formatting.length; i++) {
15776
- styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
15777
- if (state.formatting[i] === "header") {
15778
- styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
15779
- }
15780
- if (state.formatting[i] === "quote") {
15781
- if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
15782
- styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
15783
- } else {
15784
- styles.push("error");
15785
- }
15715
+ return style;
15716
+ }
15717
+ function local(stream, state) {
15718
+ var currListInd = state.listStack[state.listStack.length - 1] || 0;
15719
+ var hasExitedList = state.indentation < currListInd;
15720
+ var maxFencedEndInd = currListInd + 3;
15721
+ if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
15722
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
15723
+ var returnType;
15724
+ if (!hasExitedList) returnType = getType(state);
15725
+ state.localMode = state.localState = null;
15726
+ state.block = blockNormal;
15727
+ state.f = inlineNormal;
15728
+ state.fencedEndRE = null;
15729
+ state.code = 0;
15730
+ state.thisLine.fencedCodeEnd = true;
15731
+ if (hasExitedList) return switchBlock(stream, state, state.block);
15732
+ return returnType;
15733
+ } else if (state.localMode) {
15734
+ return state.localMode.token(stream, state.localState);
15735
+ } else {
15736
+ stream.skipToEnd();
15737
+ return tokenTypes.code;
15738
+ }
15739
+ }
15740
+ function getType(state) {
15741
+ var styles = [];
15742
+ if (state.formatting) {
15743
+ styles.push(tokenTypes.formatting);
15744
+ if (typeof state.formatting === "string") state.formatting = [state.formatting];
15745
+ for (var i = 0; i < state.formatting.length; i++) {
15746
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
15747
+ if (state.formatting[i] === "header") {
15748
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
15749
+ }
15750
+ if (state.formatting[i] === "quote") {
15751
+ if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
15752
+ styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
15753
+ } else {
15754
+ styles.push("error");
15786
15755
  }
15787
15756
  }
15788
15757
  }
15789
- if (state.taskOpen) {
15790
- styles.push("meta");
15791
- return styles.length ? styles.join(" ") : null;
15792
- }
15793
- if (state.taskClosed) {
15794
- styles.push("property");
15795
- return styles.length ? styles.join(" ") : null;
15796
- }
15797
- if (state.linkHref) {
15798
- styles.push(tokenTypes.linkHref, "url");
15799
- } else {
15800
- if (state.strong) {
15801
- styles.push(tokenTypes.strong);
15802
- }
15803
- if (state.em) {
15804
- styles.push(tokenTypes.em);
15805
- }
15806
- if (state.strikethrough) {
15807
- styles.push(tokenTypes.strikethrough);
15808
- }
15809
- if (state.emoji) {
15810
- styles.push(tokenTypes.emoji);
15811
- }
15812
- if (state.linkText) {
15813
- styles.push(tokenTypes.linkText);
15814
- }
15815
- if (state.code) {
15816
- styles.push(tokenTypes.code);
15817
- }
15818
- if (state.image) {
15819
- styles.push(tokenTypes.image);
15820
- }
15821
- if (state.imageAltText) {
15822
- styles.push(tokenTypes.imageAltText, "link");
15823
- }
15824
- if (state.imageMarker) {
15825
- styles.push(tokenTypes.imageMarker);
15826
- }
15827
- }
15828
- if (state.header) {
15829
- styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header);
15830
- }
15831
- if (state.quote) {
15832
- styles.push(tokenTypes.quote);
15833
- if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
15834
- styles.push(tokenTypes.quote + "-" + state.quote);
15835
- } else {
15836
- styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
15837
- }
15838
- }
15839
- if (state.list !== false) {
15840
- var listMod = (state.listStack.length - 1) % 3;
15841
- if (!listMod) {
15842
- styles.push(tokenTypes.list1);
15843
- } else if (listMod === 1) {
15844
- styles.push(tokenTypes.list2);
15845
- } else {
15846
- styles.push(tokenTypes.list3);
15847
- }
15848
- }
15849
- if (state.trailingSpaceNewLine) {
15850
- styles.push("trailing-space-new-line");
15851
- } else if (state.trailingSpace) {
15852
- styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
15853
- }
15758
+ }
15759
+ if (state.taskOpen) {
15760
+ styles.push("meta");
15854
15761
  return styles.length ? styles.join(" ") : null;
15855
15762
  }
15856
- function handleText(stream, state) {
15857
- if (stream.match(textRE, true)) {
15858
- return getType(state);
15859
- }
15860
- return void 0;
15763
+ if (state.taskClosed) {
15764
+ styles.push("property");
15765
+ return styles.length ? styles.join(" ") : null;
15861
15766
  }
15862
- function inlineNormal(stream, state) {
15863
- var style = state.text(stream, state);
15864
- if (typeof style !== "undefined")
15865
- return style;
15866
- if (state.list) {
15867
- state.list = null;
15868
- return getType(state);
15767
+ if (state.linkHref) {
15768
+ styles.push(tokenTypes.linkHref, "url");
15769
+ } else {
15770
+ if (state.strong) {
15771
+ styles.push(tokenTypes.strong);
15869
15772
  }
15870
- if (state.taskList) {
15871
- var taskOpen = stream.match(taskListRE, true)[1] === " ";
15872
- if (taskOpen) state.taskOpen = true;
15873
- else state.taskClosed = true;
15874
- if (modeCfg.highlightFormatting) state.formatting = "task";
15875
- state.taskList = false;
15876
- return getType(state);
15773
+ if (state.em) {
15774
+ styles.push(tokenTypes.em);
15877
15775
  }
15878
- state.taskOpen = false;
15879
- state.taskClosed = false;
15880
- if (state.header && stream.match(/^#+$/, true)) {
15881
- if (modeCfg.highlightFormatting) state.formatting = "header";
15882
- return getType(state);
15776
+ if (state.strikethrough) {
15777
+ styles.push(tokenTypes.strikethrough);
15883
15778
  }
15884
- var ch = stream.next();
15885
- if (state.linkTitle) {
15886
- state.linkTitle = false;
15887
- var matchCh = ch;
15888
- if (ch === "(") {
15889
- matchCh = ")";
15890
- }
15891
- matchCh = (matchCh + "").replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
15892
- var regex = "^\\s*(?:[^" + matchCh + "\\\\]+|\\\\\\\\|\\\\.)" + matchCh;
15893
- if (stream.match(new RegExp(regex), true)) {
15894
- return tokenTypes.linkHref;
15895
- }
15896
- }
15897
- if (ch === "`") {
15898
- var previousFormatting = state.formatting;
15899
- if (modeCfg.highlightFormatting) state.formatting = "code";
15900
- stream.eatWhile("`");
15901
- var count = stream.current().length;
15902
- if (state.code == 0 && (!state.quote || count == 1)) {
15903
- state.code = count;
15904
- return getType(state);
15905
- } else if (count == state.code) {
15906
- var t = getType(state);
15907
- state.code = 0;
15908
- return t;
15909
- } else {
15910
- state.formatting = previousFormatting;
15911
- return getType(state);
15912
- }
15913
- } else if (state.code) {
15914
- return getType(state);
15779
+ if (state.emoji) {
15780
+ styles.push(tokenTypes.emoji);
15781
+ }
15782
+ if (state.linkText) {
15783
+ styles.push(tokenTypes.linkText);
15915
15784
  }
15916
- if (ch === "\\") {
15917
- stream.next();
15918
- if (modeCfg.highlightFormatting) {
15919
- var type = getType(state);
15920
- var formattingEscape = tokenTypes.formatting + "-escape";
15921
- return type ? type + " " + formattingEscape : formattingEscape;
15922
- }
15785
+ if (state.code) {
15786
+ styles.push(tokenTypes.code);
15923
15787
  }
15924
- if (ch === "!" && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
15925
- state.imageMarker = true;
15926
- state.image = true;
15927
- if (modeCfg.highlightFormatting) state.formatting = "image";
15928
- return getType(state);
15788
+ if (state.image) {
15789
+ styles.push(tokenTypes.image);
15929
15790
  }
15930
- if (ch === "[" && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
15931
- state.imageMarker = false;
15932
- state.imageAltText = true;
15933
- if (modeCfg.highlightFormatting) state.formatting = "image";
15934
- return getType(state);
15791
+ if (state.imageAltText) {
15792
+ styles.push(tokenTypes.imageAltText, "link");
15935
15793
  }
15936
- if (ch === "]" && state.imageAltText) {
15937
- if (modeCfg.highlightFormatting) state.formatting = "image";
15938
- var type = getType(state);
15939
- state.imageAltText = false;
15940
- state.image = false;
15941
- state.inline = state.f = linkHref;
15942
- return type;
15943
- }
15944
- if (ch === "[" && !state.image) {
15945
- if (state.linkText && stream.match(/^.*?\]/)) return getType(state);
15946
- state.linkText = true;
15947
- if (modeCfg.highlightFormatting) state.formatting = "link";
15794
+ if (state.imageMarker) {
15795
+ styles.push(tokenTypes.imageMarker);
15796
+ }
15797
+ }
15798
+ if (state.header) {
15799
+ styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header);
15800
+ }
15801
+ if (state.quote) {
15802
+ styles.push(tokenTypes.quote);
15803
+ if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
15804
+ styles.push(tokenTypes.quote + "-" + state.quote);
15805
+ } else {
15806
+ styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
15807
+ }
15808
+ }
15809
+ if (state.list !== false) {
15810
+ var listMod = (state.listStack.length - 1) % 3;
15811
+ if (!listMod) {
15812
+ styles.push(tokenTypes.list1);
15813
+ } else if (listMod === 1) {
15814
+ styles.push(tokenTypes.list2);
15815
+ } else {
15816
+ styles.push(tokenTypes.list3);
15817
+ }
15818
+ }
15819
+ if (state.trailingSpaceNewLine) {
15820
+ styles.push("trailing-space-new-line");
15821
+ } else if (state.trailingSpace) {
15822
+ styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
15823
+ }
15824
+ return styles.length ? styles.join(" ") : null;
15825
+ }
15826
+ function handleText(stream, state) {
15827
+ if (stream.match(textRE, true)) {
15828
+ return getType(state);
15829
+ }
15830
+ return void 0;
15831
+ }
15832
+ function inlineNormal(stream, state) {
15833
+ var style = state.text(stream, state);
15834
+ if (typeof style !== "undefined")
15835
+ return style;
15836
+ if (state.list) {
15837
+ state.list = null;
15838
+ return getType(state);
15839
+ }
15840
+ if (state.taskList) {
15841
+ var taskOpen = stream.match(taskListRE, true)[1] === " ";
15842
+ if (taskOpen) state.taskOpen = true;
15843
+ else state.taskClosed = true;
15844
+ if (modeCfg.highlightFormatting) state.formatting = "task";
15845
+ state.taskList = false;
15846
+ return getType(state);
15847
+ }
15848
+ state.taskOpen = false;
15849
+ state.taskClosed = false;
15850
+ if (state.header && stream.match(/^#+$/, true)) {
15851
+ if (modeCfg.highlightFormatting) state.formatting = "header";
15852
+ return getType(state);
15853
+ }
15854
+ var ch = stream.next();
15855
+ if (state.linkTitle) {
15856
+ state.linkTitle = false;
15857
+ var matchCh = ch;
15858
+ if (ch === "(") {
15859
+ matchCh = ")";
15860
+ }
15861
+ matchCh = (matchCh + "").replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
15862
+ var regex = "^\\s*(?:[^" + matchCh + "\\\\]+|\\\\\\\\|\\\\.)" + matchCh;
15863
+ if (stream.match(new RegExp(regex), true)) {
15864
+ return tokenTypes.linkHref;
15865
+ }
15866
+ }
15867
+ if (ch === "`") {
15868
+ var previousFormatting = state.formatting;
15869
+ if (modeCfg.highlightFormatting) state.formatting = "code";
15870
+ stream.eatWhile("`");
15871
+ var count = stream.current().length;
15872
+ if (state.code == 0 && (!state.quote || count == 1)) {
15873
+ state.code = count;
15874
+ return getType(state);
15875
+ } else if (count == state.code) {
15876
+ var t = getType(state);
15877
+ state.code = 0;
15878
+ return t;
15879
+ } else {
15880
+ state.formatting = previousFormatting;
15948
15881
  return getType(state);
15949
15882
  }
15950
- if (ch === "]" && state.linkText) {
15951
- if (modeCfg.highlightFormatting) state.formatting = "link";
15883
+ } else if (state.code) {
15884
+ return getType(state);
15885
+ }
15886
+ if (ch === "\\") {
15887
+ stream.next();
15888
+ if (modeCfg.highlightFormatting) {
15952
15889
  var type = getType(state);
15953
- state.linkText = false;
15954
- state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal;
15955
- return type;
15890
+ var formattingEscape = tokenTypes.formatting + "-escape";
15891
+ return type ? type + " " + formattingEscape : formattingEscape;
15956
15892
  }
15957
- if (ch === "<" && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
15958
- state.f = state.inline = linkInline;
15959
- if (modeCfg.highlightFormatting) state.formatting = "link";
15960
- var type = getType(state);
15961
- if (type) {
15962
- type += " ";
15893
+ }
15894
+ if (ch === "!" && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
15895
+ state.imageMarker = true;
15896
+ state.image = true;
15897
+ if (modeCfg.highlightFormatting) state.formatting = "image";
15898
+ return getType(state);
15899
+ }
15900
+ if (ch === "[" && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
15901
+ state.imageMarker = false;
15902
+ state.imageAltText = true;
15903
+ if (modeCfg.highlightFormatting) state.formatting = "image";
15904
+ return getType(state);
15905
+ }
15906
+ if (ch === "]" && state.imageAltText) {
15907
+ if (modeCfg.highlightFormatting) state.formatting = "image";
15908
+ var type = getType(state);
15909
+ state.imageAltText = false;
15910
+ state.image = false;
15911
+ state.inline = state.f = linkHref;
15912
+ return type;
15913
+ }
15914
+ if (ch === "[" && !state.image) {
15915
+ if (state.linkText && stream.match(/^.*?\]/)) return getType(state);
15916
+ state.linkText = true;
15917
+ if (modeCfg.highlightFormatting) state.formatting = "link";
15918
+ return getType(state);
15919
+ }
15920
+ if (ch === "]" && state.linkText) {
15921
+ if (modeCfg.highlightFormatting) state.formatting = "link";
15922
+ var type = getType(state);
15923
+ state.linkText = false;
15924
+ state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal;
15925
+ return type;
15926
+ }
15927
+ if (ch === "<" && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
15928
+ state.f = state.inline = linkInline;
15929
+ if (modeCfg.highlightFormatting) state.formatting = "link";
15930
+ var type = getType(state);
15931
+ if (type) {
15932
+ type += " ";
15933
+ } else {
15934
+ type = "";
15935
+ }
15936
+ return type + tokenTypes.linkInline;
15937
+ }
15938
+ if (ch === "<" && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
15939
+ state.f = state.inline = linkInline;
15940
+ if (modeCfg.highlightFormatting) state.formatting = "link";
15941
+ var type = getType(state);
15942
+ if (type) {
15943
+ type += " ";
15944
+ } else {
15945
+ type = "";
15946
+ }
15947
+ return type + tokenTypes.linkEmail;
15948
+ }
15949
+ if (modeCfg.xml && ch === "<" && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
15950
+ var end = stream.string.indexOf(">", stream.pos);
15951
+ if (end != -1) {
15952
+ var atts = stream.string.substring(stream.start, end);
15953
+ if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
15954
+ }
15955
+ stream.backUp(1);
15956
+ state.htmlState = CodeMirror.startState(htmlMode);
15957
+ return switchBlock(stream, state, htmlBlock);
15958
+ }
15959
+ if (modeCfg.xml && ch === "<" && stream.match(/^\/\w*?>/)) {
15960
+ state.md_inside = false;
15961
+ return "tag";
15962
+ } else if (ch === "*" || ch === "_") {
15963
+ var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2);
15964
+ while (len < 3 && stream.eat(ch)) len++;
15965
+ var after = stream.peek() || " ";
15966
+ var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before));
15967
+ var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after));
15968
+ var setEm = null, setStrong = null;
15969
+ if (len % 2) {
15970
+ if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
15971
+ setEm = true;
15972
+ else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
15973
+ setEm = false;
15974
+ }
15975
+ if (len > 1) {
15976
+ if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
15977
+ setStrong = true;
15978
+ else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
15979
+ setStrong = false;
15980
+ }
15981
+ if (setStrong != null || setEm != null) {
15982
+ if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em";
15983
+ if (setEm === true) state.em = ch;
15984
+ if (setStrong === true) state.strong = ch;
15985
+ var t = getType(state);
15986
+ if (setEm === false) state.em = false;
15987
+ if (setStrong === false) state.strong = false;
15988
+ return t;
15989
+ }
15990
+ } else if (ch === " ") {
15991
+ if (stream.eat("*") || stream.eat("_")) {
15992
+ if (stream.peek() === " ") {
15993
+ return getType(state);
15963
15994
  } else {
15964
- type = "";
15995
+ stream.backUp(1);
15965
15996
  }
15966
- return type + tokenTypes.linkInline;
15967
15997
  }
15968
- if (ch === "<" && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
15969
- state.f = state.inline = linkInline;
15970
- if (modeCfg.highlightFormatting) state.formatting = "link";
15971
- var type = getType(state);
15972
- if (type) {
15973
- type += " ";
15974
- } else {
15975
- type = "";
15976
- }
15977
- return type + tokenTypes.linkEmail;
15978
- }
15979
- if (modeCfg.xml && ch === "<" && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
15980
- var end = stream.string.indexOf(">", stream.pos);
15981
- if (end != -1) {
15982
- var atts = stream.string.substring(stream.start, end);
15983
- if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
15984
- }
15985
- stream.backUp(1);
15986
- state.htmlState = CodeMirror.startState(htmlMode);
15987
- return switchBlock(stream, state, htmlBlock);
15988
- }
15989
- if (modeCfg.xml && ch === "<" && stream.match(/^\/\w*?>/)) {
15990
- state.md_inside = false;
15991
- return "tag";
15992
- } else if (ch === "*" || ch === "_") {
15993
- var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2);
15994
- while (len < 3 && stream.eat(ch)) len++;
15995
- var after = stream.peek() || " ";
15996
- var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before));
15997
- var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after));
15998
- var setEm = null, setStrong = null;
15999
- if (len % 2) {
16000
- if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
16001
- setEm = true;
16002
- else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
16003
- setEm = false;
16004
- }
16005
- if (len > 1) {
16006
- if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
16007
- setStrong = true;
16008
- else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
16009
- setStrong = false;
16010
- }
16011
- if (setStrong != null || setEm != null) {
16012
- if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em";
16013
- if (setEm === true) state.em = ch;
16014
- if (setStrong === true) state.strong = ch;
15998
+ }
15999
+ if (modeCfg.strikethrough) {
16000
+ if (ch === "~" && stream.eatWhile(ch)) {
16001
+ if (state.strikethrough) {
16002
+ if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
16015
16003
  var t = getType(state);
16016
- if (setEm === false) state.em = false;
16017
- if (setStrong === false) state.strong = false;
16004
+ state.strikethrough = false;
16018
16005
  return t;
16006
+ } else if (stream.match(/^[^\s]/, false)) {
16007
+ state.strikethrough = true;
16008
+ if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
16009
+ return getType(state);
16019
16010
  }
16020
16011
  } else if (ch === " ") {
16021
- if (stream.eat("*") || stream.eat("_")) {
16012
+ if (stream.match("~~", true)) {
16022
16013
  if (stream.peek() === " ") {
16023
16014
  return getType(state);
16024
16015
  } else {
16025
- stream.backUp(1);
16026
- }
16027
- }
16028
- }
16029
- if (modeCfg.strikethrough) {
16030
- if (ch === "~" && stream.eatWhile(ch)) {
16031
- if (state.strikethrough) {
16032
- if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
16033
- var t = getType(state);
16034
- state.strikethrough = false;
16035
- return t;
16036
- } else if (stream.match(/^[^\s]/, false)) {
16037
- state.strikethrough = true;
16038
- if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
16039
- return getType(state);
16040
- }
16041
- } else if (ch === " ") {
16042
- if (stream.match("~~", true)) {
16043
- if (stream.peek() === " ") {
16044
- return getType(state);
16045
- } else {
16046
- stream.backUp(2);
16047
- }
16016
+ stream.backUp(2);
16048
16017
  }
16049
16018
  }
16050
16019
  }
16051
- if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
16052
- state.emoji = true;
16053
- if (modeCfg.highlightFormatting) state.formatting = "emoji";
16054
- var retType = getType(state);
16055
- state.emoji = false;
16056
- return retType;
16020
+ }
16021
+ if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
16022
+ state.emoji = true;
16023
+ if (modeCfg.highlightFormatting) state.formatting = "emoji";
16024
+ var retType = getType(state);
16025
+ state.emoji = false;
16026
+ return retType;
16027
+ }
16028
+ if (ch === " ") {
16029
+ if (stream.match(/^ +$/, false)) {
16030
+ state.trailingSpace++;
16031
+ } else if (state.trailingSpace) {
16032
+ state.trailingSpaceNewLine = true;
16057
16033
  }
16058
- if (ch === " ") {
16059
- if (stream.match(/^ +$/, false)) {
16060
- state.trailingSpace++;
16061
- } else if (state.trailingSpace) {
16062
- state.trailingSpaceNewLine = true;
16063
- }
16034
+ }
16035
+ return getType(state);
16036
+ }
16037
+ function linkInline(stream, state) {
16038
+ var ch = stream.next();
16039
+ if (ch === ">") {
16040
+ state.f = state.inline = inlineNormal;
16041
+ if (modeCfg.highlightFormatting) state.formatting = "link";
16042
+ var type = getType(state);
16043
+ if (type) {
16044
+ type += " ";
16045
+ } else {
16046
+ type = "";
16064
16047
  }
16048
+ return type + tokenTypes.linkInline;
16049
+ }
16050
+ stream.match(/^[^>]+/, true);
16051
+ return tokenTypes.linkInline;
16052
+ }
16053
+ function linkHref(stream, state) {
16054
+ if (stream.eatSpace()) {
16055
+ return null;
16056
+ }
16057
+ var ch = stream.next();
16058
+ if (ch === "(" || ch === "[") {
16059
+ state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
16060
+ if (modeCfg.highlightFormatting) state.formatting = "link-string";
16061
+ state.linkHref = true;
16065
16062
  return getType(state);
16066
16063
  }
16067
- function linkInline(stream, state) {
16064
+ return "error";
16065
+ }
16066
+ var linkRE = {
16067
+ ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
16068
+ "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
16069
+ };
16070
+ function getLinkHrefInside(endChar) {
16071
+ return function(stream, state) {
16068
16072
  var ch = stream.next();
16069
- if (ch === ">") {
16073
+ if (ch === endChar) {
16070
16074
  state.f = state.inline = inlineNormal;
16071
- if (modeCfg.highlightFormatting) state.formatting = "link";
16072
- var type = getType(state);
16073
- if (type) {
16074
- type += " ";
16075
- } else {
16076
- type = "";
16077
- }
16078
- return type + tokenTypes.linkInline;
16079
- }
16080
- stream.match(/^[^>]+/, true);
16081
- return tokenTypes.linkInline;
16082
- }
16083
- function linkHref(stream, state) {
16084
- if (stream.eatSpace()) {
16085
- return null;
16086
- }
16087
- var ch = stream.next();
16088
- if (ch === "(" || ch === "[") {
16089
- state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
16090
16075
  if (modeCfg.highlightFormatting) state.formatting = "link-string";
16091
- state.linkHref = true;
16092
- return getType(state);
16076
+ var returnState = getType(state);
16077
+ state.linkHref = false;
16078
+ return returnState;
16093
16079
  }
16094
- return "error";
16095
- }
16096
- var linkRE = {
16097
- ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
16098
- "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
16080
+ stream.match(linkRE[endChar]);
16081
+ state.linkHref = true;
16082
+ return getType(state);
16099
16083
  };
16100
- function getLinkHrefInside(endChar) {
16101
- return function(stream, state) {
16102
- var ch = stream.next();
16103
- if (ch === endChar) {
16104
- state.f = state.inline = inlineNormal;
16105
- if (modeCfg.highlightFormatting) state.formatting = "link-string";
16106
- var returnState = getType(state);
16107
- state.linkHref = false;
16108
- return returnState;
16109
- }
16110
- stream.match(linkRE[endChar]);
16111
- state.linkHref = true;
16112
- return getType(state);
16113
- };
16084
+ }
16085
+ function footnoteLink(stream, state) {
16086
+ if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
16087
+ state.f = footnoteLinkInside;
16088
+ stream.next();
16089
+ if (modeCfg.highlightFormatting) state.formatting = "link";
16090
+ state.linkText = true;
16091
+ return getType(state);
16114
16092
  }
16115
- function footnoteLink(stream, state) {
16116
- if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
16117
- state.f = footnoteLinkInside;
16118
- stream.next();
16119
- if (modeCfg.highlightFormatting) state.formatting = "link";
16120
- state.linkText = true;
16121
- return getType(state);
16122
- }
16123
- return switchInline(stream, state, inlineNormal);
16093
+ return switchInline(stream, state, inlineNormal);
16094
+ }
16095
+ function footnoteLinkInside(stream, state) {
16096
+ if (stream.match("]:", true)) {
16097
+ state.f = state.inline = footnoteUrl;
16098
+ if (modeCfg.highlightFormatting) state.formatting = "link";
16099
+ var returnType = getType(state);
16100
+ state.linkText = false;
16101
+ return returnType;
16124
16102
  }
16125
- function footnoteLinkInside(stream, state) {
16126
- if (stream.match("]:", true)) {
16127
- state.f = state.inline = footnoteUrl;
16128
- if (modeCfg.highlightFormatting) state.formatting = "link";
16129
- var returnType = getType(state);
16130
- state.linkText = false;
16131
- return returnType;
16132
- }
16133
- stream.match(/^([^\]\\]|\\.)+/, true);
16134
- return tokenTypes.linkText;
16103
+ stream.match(/^([^\]\\]|\\.)+/, true);
16104
+ return tokenTypes.linkText;
16105
+ }
16106
+ function footnoteUrl(stream, state) {
16107
+ if (stream.eatSpace()) {
16108
+ return null;
16135
16109
  }
16136
- function footnoteUrl(stream, state) {
16137
- if (stream.eatSpace()) {
16138
- return null;
16139
- }
16140
- stream.match(/^[^\s]+/, true);
16141
- if (stream.peek() === void 0) {
16142
- state.linkTitle = true;
16143
- } else {
16144
- stream.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/, true);
16145
- }
16146
- state.f = state.inline = inlineNormal;
16147
- return tokenTypes.linkHref + " url";
16110
+ stream.match(/^[^\s]+/, true);
16111
+ if (stream.peek() === void 0) {
16112
+ state.linkTitle = true;
16113
+ } else {
16114
+ stream.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/, true);
16148
16115
  }
16149
- var mode = {
16150
- startState: function() {
16151
- return {
16152
- f: blockNormal,
16153
- prevLine: { stream: null },
16154
- thisLine: { stream: null },
16155
- block: blockNormal,
16156
- htmlState: null,
16157
- indentation: 0,
16158
- inline: inlineNormal,
16159
- text: handleText,
16160
- formatting: false,
16161
- linkText: false,
16162
- linkHref: false,
16163
- linkTitle: false,
16164
- code: 0,
16165
- em: false,
16166
- strong: false,
16167
- header: 0,
16168
- setext: 0,
16169
- hr: false,
16170
- taskList: false,
16171
- list: false,
16172
- listStack: [],
16173
- quote: 0,
16174
- trailingSpace: 0,
16175
- trailingSpaceNewLine: false,
16176
- strikethrough: false,
16177
- emoji: false,
16178
- fencedEndRE: null
16179
- };
16180
- },
16181
- copyState: function(s) {
16182
- return {
16183
- f: s.f,
16184
- prevLine: s.prevLine,
16185
- thisLine: s.thisLine,
16186
- block: s.block,
16187
- htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
16188
- indentation: s.indentation,
16189
- localMode: s.localMode,
16190
- localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
16191
- inline: s.inline,
16192
- text: s.text,
16193
- formatting: false,
16194
- linkText: s.linkText,
16195
- linkTitle: s.linkTitle,
16196
- linkHref: s.linkHref,
16197
- code: s.code,
16198
- em: s.em,
16199
- strong: s.strong,
16200
- strikethrough: s.strikethrough,
16201
- emoji: s.emoji,
16202
- header: s.header,
16203
- setext: s.setext,
16204
- hr: s.hr,
16205
- taskList: s.taskList,
16206
- list: s.list,
16207
- listStack: s.listStack.slice(0),
16208
- quote: s.quote,
16209
- indentedCode: s.indentedCode,
16210
- trailingSpace: s.trailingSpace,
16211
- trailingSpaceNewLine: s.trailingSpaceNewLine,
16212
- md_inside: s.md_inside,
16213
- fencedEndRE: s.fencedEndRE
16214
- };
16215
- },
16216
- token: function(stream, state) {
16217
- state.formatting = false;
16218
- if (stream != state.thisLine.stream) {
16219
- state.header = 0;
16220
- state.hr = false;
16221
- if (stream.match(/^\s*$/, true)) {
16222
- blankLine(state);
16223
- return null;
16224
- }
16225
- state.prevLine = state.thisLine;
16226
- state.thisLine = { stream };
16227
- state.taskList = false;
16228
- state.trailingSpace = 0;
16229
- state.trailingSpaceNewLine = false;
16230
- if (!state.localState) {
16231
- state.f = state.block;
16232
- if (state.f != htmlBlock) {
16233
- var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
16234
- state.indentation = indentation;
16235
- state.indentationDiff = null;
16236
- if (indentation > 0) return null;
16237
- }
16116
+ state.f = state.inline = inlineNormal;
16117
+ return tokenTypes.linkHref + " url";
16118
+ }
16119
+ var mode = {
16120
+ startState: function() {
16121
+ return {
16122
+ f: blockNormal,
16123
+ prevLine: { stream: null },
16124
+ thisLine: { stream: null },
16125
+ block: blockNormal,
16126
+ htmlState: null,
16127
+ indentation: 0,
16128
+ inline: inlineNormal,
16129
+ text: handleText,
16130
+ formatting: false,
16131
+ linkText: false,
16132
+ linkHref: false,
16133
+ linkTitle: false,
16134
+ code: 0,
16135
+ em: false,
16136
+ strong: false,
16137
+ header: 0,
16138
+ setext: 0,
16139
+ hr: false,
16140
+ taskList: false,
16141
+ list: false,
16142
+ listStack: [],
16143
+ quote: 0,
16144
+ trailingSpace: 0,
16145
+ trailingSpaceNewLine: false,
16146
+ strikethrough: false,
16147
+ emoji: false,
16148
+ fencedEndRE: null
16149
+ };
16150
+ },
16151
+ copyState: function(s) {
16152
+ return {
16153
+ f: s.f,
16154
+ prevLine: s.prevLine,
16155
+ thisLine: s.thisLine,
16156
+ block: s.block,
16157
+ htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
16158
+ indentation: s.indentation,
16159
+ localMode: s.localMode,
16160
+ localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
16161
+ inline: s.inline,
16162
+ text: s.text,
16163
+ formatting: false,
16164
+ linkText: s.linkText,
16165
+ linkTitle: s.linkTitle,
16166
+ linkHref: s.linkHref,
16167
+ code: s.code,
16168
+ em: s.em,
16169
+ strong: s.strong,
16170
+ strikethrough: s.strikethrough,
16171
+ emoji: s.emoji,
16172
+ header: s.header,
16173
+ setext: s.setext,
16174
+ hr: s.hr,
16175
+ taskList: s.taskList,
16176
+ list: s.list,
16177
+ listStack: s.listStack.slice(0),
16178
+ quote: s.quote,
16179
+ indentedCode: s.indentedCode,
16180
+ trailingSpace: s.trailingSpace,
16181
+ trailingSpaceNewLine: s.trailingSpaceNewLine,
16182
+ md_inside: s.md_inside,
16183
+ fencedEndRE: s.fencedEndRE
16184
+ };
16185
+ },
16186
+ token: function(stream, state) {
16187
+ state.formatting = false;
16188
+ if (stream != state.thisLine.stream) {
16189
+ state.header = 0;
16190
+ state.hr = false;
16191
+ if (stream.match(/^\s*$/, true)) {
16192
+ blankLine(state);
16193
+ return null;
16194
+ }
16195
+ state.prevLine = state.thisLine;
16196
+ state.thisLine = { stream };
16197
+ state.taskList = false;
16198
+ state.trailingSpace = 0;
16199
+ state.trailingSpaceNewLine = false;
16200
+ if (!state.localState) {
16201
+ state.f = state.block;
16202
+ if (state.f != htmlBlock) {
16203
+ var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
16204
+ state.indentation = indentation;
16205
+ state.indentationDiff = null;
16206
+ if (indentation > 0) return null;
16238
16207
  }
16239
16208
  }
16240
- return state.f(stream, state);
16241
- },
16242
- innerMode: function(state) {
16243
- if (state.block == htmlBlock) return { state: state.htmlState, mode: htmlMode };
16244
- if (state.localState) return { state: state.localState, mode: state.localMode };
16245
- return { state, mode };
16246
- },
16247
- indent: function(state, textAfter, line) {
16248
- if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line);
16249
- if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line);
16250
- return CodeMirror.Pass;
16251
- },
16252
- blankLine,
16253
- getType,
16254
- blockCommentStart: "<!--",
16255
- blockCommentEnd: "-->",
16256
- closeBrackets: "()[]{}''\"\"``",
16257
- fold: "markdown"
16258
- };
16259
- return mode;
16260
- }, "xml");
16261
- CodeMirror.defineMIME("text/markdown", "markdown");
16262
- CodeMirror.defineMIME("text/x-markdown", "markdown");
16263
- });
16264
- })();
16265
- return markdown.exports;
16266
- }
16267
- requireMarkdown();
16268
- var placeholder = { exports: {} };
16269
- var hasRequiredPlaceholder;
16270
- function requirePlaceholder() {
16271
- if (hasRequiredPlaceholder) return placeholder.exports;
16272
- hasRequiredPlaceholder = 1;
16273
- (function(module, exports) {
16274
- (function(mod) {
16275
- mod(requireCodemirror());
16276
- })(function(CodeMirror) {
16277
- CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
16278
- var prev = old && old != CodeMirror.Init;
16279
- if (val && !prev) {
16280
- cm.on("blur", onBlur);
16281
- cm.on("change", onChange);
16282
- cm.on("swapDoc", onChange);
16283
- CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = function() {
16284
- onComposition(cm);
16285
- });
16286
- onChange(cm);
16287
- } else if (!val && prev) {
16288
- cm.off("blur", onBlur);
16289
- cm.off("change", onChange);
16290
- cm.off("swapDoc", onChange);
16291
- CodeMirror.off(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose);
16292
- clearPlaceholder(cm);
16293
- var wrapper = cm.getWrapperElement();
16294
- wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
16295
- }
16296
- if (val && !cm.hasFocus()) onBlur(cm);
16297
- });
16298
- function clearPlaceholder(cm) {
16299
- if (cm.state.placeholder) {
16300
- cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
16301
- cm.state.placeholder = null;
16302
- }
16303
- }
16304
- function setPlaceholder(cm) {
16305
- clearPlaceholder(cm);
16306
- var elt = cm.state.placeholder = document.createElement("pre");
16307
- elt.style.cssText = "height: 0; overflow: visible";
16308
- elt.style.direction = cm.getOption("direction");
16309
- elt.className = "CodeMirror-placeholder CodeMirror-line-like";
16310
- var placeHolder = cm.getOption("placeholder");
16311
- if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder);
16312
- elt.appendChild(placeHolder);
16313
- cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
16314
- }
16315
- function onComposition(cm) {
16316
- setTimeout(function() {
16317
- var empty = false;
16318
- if (cm.lineCount() == 1) {
16319
- var input = cm.getInputField();
16320
- empty = input.nodeName == "TEXTAREA" ? !cm.getLine(0).length : !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent);
16321
16209
  }
16322
- if (empty) setPlaceholder(cm);
16323
- else clearPlaceholder(cm);
16324
- }, 20);
16325
- }
16326
- function onBlur(cm) {
16327
- if (isEmpty(cm)) setPlaceholder(cm);
16328
- }
16329
- function onChange(cm) {
16330
- var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
16331
- wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
16332
- if (empty) setPlaceholder(cm);
16333
- else clearPlaceholder(cm);
16334
- }
16335
- function isEmpty(cm) {
16336
- return cm.lineCount() === 1 && cm.getLine(0) === "";
16337
- }
16338
- });
16339
- })();
16340
- return placeholder.exports;
16341
- }
16342
- requirePlaceholder();
16343
- var simple = { exports: {} };
16344
- var hasRequiredSimple;
16345
- function requireSimple() {
16346
- if (hasRequiredSimple) return simple.exports;
16347
- hasRequiredSimple = 1;
16348
- (function(module, exports) {
16349
- (function(mod) {
16350
- mod(requireCodemirror());
16351
- })(function(CodeMirror) {
16352
- CodeMirror.defineSimpleMode = function(name, states) {
16353
- CodeMirror.defineMode(name, function(config) {
16354
- return CodeMirror.simpleMode(config, states);
16355
- });
16210
+ return state.f(stream, state);
16211
+ },
16212
+ innerMode: function(state) {
16213
+ if (state.block == htmlBlock) return { state: state.htmlState, mode: htmlMode };
16214
+ if (state.localState) return { state: state.localState, mode: state.localMode };
16215
+ return { state, mode };
16216
+ },
16217
+ indent: function(state, textAfter, line) {
16218
+ if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line);
16219
+ if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line);
16220
+ return CodeMirror.Pass;
16221
+ },
16222
+ blankLine,
16223
+ getType,
16224
+ blockCommentStart: "<!--",
16225
+ blockCommentEnd: "-->",
16226
+ closeBrackets: "()[]{}''\"\"``",
16227
+ fold: "markdown"
16356
16228
  };
16357
- CodeMirror.simpleMode = function(config, states) {
16358
- ensureState(states, "start");
16359
- var states_ = {}, meta2 = states.meta || {}, hasIndentation = false;
16360
- for (var state in states) if (state != meta2 && states.hasOwnProperty(state)) {
16361
- var list = states_[state] = [], orig = states[state];
16362
- for (var i = 0; i < orig.length; i++) {
16363
- var data = orig[i];
16364
- list.push(new Rule(data, states));
16365
- if (data.indent || data.dedent) hasIndentation = true;
16366
- }
16367
- }
16368
- var mode = {
16369
- startState: function() {
16370
- return {
16371
- state: "start",
16372
- pending: null,
16373
- local: null,
16374
- localState: null,
16375
- indent: hasIndentation ? [] : null
16376
- };
16377
- },
16378
- copyState: function(state2) {
16379
- var s = {
16380
- state: state2.state,
16381
- pending: state2.pending,
16382
- local: state2.local,
16383
- localState: null,
16384
- indent: state2.indent && state2.indent.slice(0)
16229
+ return mode;
16230
+ }, "xml");
16231
+ CodeMirror.defineMIME("text/markdown", "markdown");
16232
+ CodeMirror.defineMIME("text/x-markdown", "markdown");
16233
+ });
16234
+ })();
16235
+ (function(module, exports) {
16236
+ (function(mod) {
16237
+ mod(requireCodemirror());
16238
+ })(function(CodeMirror) {
16239
+ CodeMirror.defineSimpleMode = function(name, states) {
16240
+ CodeMirror.defineMode(name, function(config) {
16241
+ return CodeMirror.simpleMode(config, states);
16242
+ });
16243
+ };
16244
+ CodeMirror.simpleMode = function(config, states) {
16245
+ ensureState(states, "start");
16246
+ var states_ = {}, meta2 = states.meta || {}, hasIndentation = false;
16247
+ for (var state in states) if (state != meta2 && states.hasOwnProperty(state)) {
16248
+ var list = states_[state] = [], orig = states[state];
16249
+ for (var i = 0; i < orig.length; i++) {
16250
+ var data = orig[i];
16251
+ list.push(new Rule(data, states));
16252
+ if (data.indent || data.dedent) hasIndentation = true;
16253
+ }
16254
+ }
16255
+ var mode = {
16256
+ startState: function() {
16257
+ return {
16258
+ state: "start",
16259
+ pending: null,
16260
+ local: null,
16261
+ localState: null,
16262
+ indent: hasIndentation ? [] : null
16263
+ };
16264
+ },
16265
+ copyState: function(state2) {
16266
+ var s = {
16267
+ state: state2.state,
16268
+ pending: state2.pending,
16269
+ local: state2.local,
16270
+ localState: null,
16271
+ indent: state2.indent && state2.indent.slice(0)
16272
+ };
16273
+ if (state2.localState)
16274
+ s.localState = CodeMirror.copyState(state2.local.mode, state2.localState);
16275
+ if (state2.stack)
16276
+ s.stack = state2.stack.slice(0);
16277
+ for (var pers = state2.persistentStates; pers; pers = pers.next)
16278
+ s.persistentStates = {
16279
+ mode: pers.mode,
16280
+ spec: pers.spec,
16281
+ state: pers.state == state2.localState ? s.localState : CodeMirror.copyState(pers.mode, pers.state),
16282
+ next: s.persistentStates
16385
16283
  };
16386
- if (state2.localState)
16387
- s.localState = CodeMirror.copyState(state2.local.mode, state2.localState);
16388
- if (state2.stack)
16389
- s.stack = state2.stack.slice(0);
16390
- for (var pers = state2.persistentStates; pers; pers = pers.next)
16391
- s.persistentStates = {
16392
- mode: pers.mode,
16393
- spec: pers.spec,
16394
- state: pers.state == state2.localState ? s.localState : CodeMirror.copyState(pers.mode, pers.state),
16395
- next: s.persistentStates
16396
- };
16397
- return s;
16398
- },
16399
- token: tokenFunction(states_, config),
16400
- innerMode: function(state2) {
16401
- return state2.local && { mode: state2.local.mode, state: state2.localState };
16402
- },
16403
- indent: indentFunction(states_, meta2)
16404
- };
16405
- if (meta2) {
16406
- for (var prop in meta2) if (meta2.hasOwnProperty(prop))
16407
- mode[prop] = meta2[prop];
16408
- }
16409
- return mode;
16284
+ return s;
16285
+ },
16286
+ token: tokenFunction(states_, config),
16287
+ innerMode: function(state2) {
16288
+ return state2.local && { mode: state2.local.mode, state: state2.localState };
16289
+ },
16290
+ indent: indentFunction(states_, meta2)
16410
16291
  };
16411
- function ensureState(states, name) {
16412
- if (!states.hasOwnProperty(name))
16413
- throw new Error("Undefined state " + name + " in simple mode");
16414
- }
16415
- function toRegex(val, caret) {
16416
- if (!val) return /(?:)/;
16417
- var flags = "";
16418
- if (val instanceof RegExp) {
16419
- if (val.ignoreCase) flags = "i";
16420
- if (val.unicode) flags += "u";
16421
- val = val.source;
16422
- } else {
16423
- val = String(val);
16424
- }
16425
- return new RegExp((caret === false ? "" : "^") + "(?:" + val + ")", flags);
16426
- }
16427
- function asToken(val) {
16428
- if (!val) return null;
16429
- if (val.apply) return val;
16430
- if (typeof val == "string") return val.replace(/\./g, " ");
16431
- var result = [];
16432
- for (var i = 0; i < val.length; i++)
16433
- result.push(val[i] && val[i].replace(/\./g, " "));
16434
- return result;
16435
- }
16436
- function Rule(data, states) {
16437
- if (data.next || data.push) ensureState(states, data.next || data.push);
16438
- this.regex = toRegex(data.regex);
16439
- this.token = asToken(data.token);
16440
- this.data = data;
16441
- }
16442
- function tokenFunction(states, config) {
16443
- return function(stream, state) {
16444
- if (state.pending) {
16445
- var pend = state.pending.shift();
16446
- if (state.pending.length == 0) state.pending = null;
16447
- stream.pos += pend.text.length;
16448
- return pend.token;
16449
- }
16450
- if (state.local) {
16451
- if (state.local.end && stream.match(state.local.end)) {
16452
- var tok = state.local.endToken || null;
16453
- state.local = state.localState = null;
16454
- return tok;
16292
+ if (meta2) {
16293
+ for (var prop in meta2) if (meta2.hasOwnProperty(prop))
16294
+ mode[prop] = meta2[prop];
16295
+ }
16296
+ return mode;
16297
+ };
16298
+ function ensureState(states, name) {
16299
+ if (!states.hasOwnProperty(name))
16300
+ throw new Error("Undefined state " + name + " in simple mode");
16301
+ }
16302
+ function toRegex(val, caret) {
16303
+ if (!val) return /(?:)/;
16304
+ var flags = "";
16305
+ if (val instanceof RegExp) {
16306
+ if (val.ignoreCase) flags = "i";
16307
+ if (val.unicode) flags += "u";
16308
+ val = val.source;
16309
+ } else {
16310
+ val = String(val);
16311
+ }
16312
+ return new RegExp((caret === false ? "" : "^") + "(?:" + val + ")", flags);
16313
+ }
16314
+ function asToken(val) {
16315
+ if (!val) return null;
16316
+ if (val.apply) return val;
16317
+ if (typeof val == "string") return val.replace(/\./g, " ");
16318
+ var result = [];
16319
+ for (var i = 0; i < val.length; i++)
16320
+ result.push(val[i] && val[i].replace(/\./g, " "));
16321
+ return result;
16322
+ }
16323
+ function Rule(data, states) {
16324
+ if (data.next || data.push) ensureState(states, data.next || data.push);
16325
+ this.regex = toRegex(data.regex);
16326
+ this.token = asToken(data.token);
16327
+ this.data = data;
16328
+ }
16329
+ function tokenFunction(states, config) {
16330
+ return function(stream, state) {
16331
+ if (state.pending) {
16332
+ var pend = state.pending.shift();
16333
+ if (state.pending.length == 0) state.pending = null;
16334
+ stream.pos += pend.text.length;
16335
+ return pend.token;
16336
+ }
16337
+ if (state.local) {
16338
+ if (state.local.end && stream.match(state.local.end)) {
16339
+ var tok = state.local.endToken || null;
16340
+ state.local = state.localState = null;
16341
+ return tok;
16342
+ } else {
16343
+ var tok = state.local.mode.token(stream, state.localState), m;
16344
+ if (state.local.endScan && (m = state.local.endScan.exec(stream.current())))
16345
+ stream.pos = stream.start + m.index;
16346
+ return tok;
16347
+ }
16348
+ }
16349
+ var curState = states[state.state];
16350
+ for (var i = 0; i < curState.length; i++) {
16351
+ var rule = curState[i];
16352
+ var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex);
16353
+ if (matches) {
16354
+ if (rule.data.next) {
16355
+ state.state = rule.data.next;
16356
+ } else if (rule.data.push) {
16357
+ (state.stack || (state.stack = [])).push(state.state);
16358
+ state.state = rule.data.push;
16359
+ } else if (rule.data.pop && state.stack && state.stack.length) {
16360
+ state.state = state.stack.pop();
16361
+ }
16362
+ if (rule.data.mode)
16363
+ enterLocalMode(config, state, rule.data.mode, rule.token);
16364
+ if (rule.data.indent)
16365
+ state.indent.push(stream.indentation() + config.indentUnit);
16366
+ if (rule.data.dedent)
16367
+ state.indent.pop();
16368
+ var token = rule.token;
16369
+ if (token && token.apply) token = token(matches);
16370
+ if (matches.length > 2 && rule.token && typeof rule.token != "string") {
16371
+ for (var j = 2; j < matches.length; j++)
16372
+ if (matches[j])
16373
+ (state.pending || (state.pending = [])).push({ text: matches[j], token: rule.token[j - 1] });
16374
+ stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0));
16375
+ return token[0];
16376
+ } else if (token && token.join) {
16377
+ return token[0];
16455
16378
  } else {
16456
- var tok = state.local.mode.token(stream, state.localState), m;
16457
- if (state.local.endScan && (m = state.local.endScan.exec(stream.current())))
16458
- stream.pos = stream.start + m.index;
16459
- return tok;
16460
- }
16461
- }
16462
- var curState = states[state.state];
16463
- for (var i = 0; i < curState.length; i++) {
16464
- var rule = curState[i];
16465
- var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex);
16466
- if (matches) {
16467
- if (rule.data.next) {
16468
- state.state = rule.data.next;
16469
- } else if (rule.data.push) {
16470
- (state.stack || (state.stack = [])).push(state.state);
16471
- state.state = rule.data.push;
16472
- } else if (rule.data.pop && state.stack && state.stack.length) {
16473
- state.state = state.stack.pop();
16474
- }
16475
- if (rule.data.mode)
16476
- enterLocalMode(config, state, rule.data.mode, rule.token);
16477
- if (rule.data.indent)
16478
- state.indent.push(stream.indentation() + config.indentUnit);
16479
- if (rule.data.dedent)
16480
- state.indent.pop();
16481
- var token = rule.token;
16482
- if (token && token.apply) token = token(matches);
16483
- if (matches.length > 2 && rule.token && typeof rule.token != "string") {
16484
- for (var j = 2; j < matches.length; j++)
16485
- if (matches[j])
16486
- (state.pending || (state.pending = [])).push({ text: matches[j], token: rule.token[j - 1] });
16487
- stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0));
16488
- return token[0];
16489
- } else if (token && token.join) {
16490
- return token[0];
16491
- } else {
16492
- return token;
16493
- }
16379
+ return token;
16494
16380
  }
16495
16381
  }
16496
- stream.next();
16497
- return null;
16498
- };
16499
- }
16500
- function cmp(a, b) {
16501
- if (a === b) return true;
16502
- if (!a || typeof a != "object" || !b || typeof b != "object") return false;
16503
- var props = 0;
16504
- for (var prop in a) if (a.hasOwnProperty(prop)) {
16505
- if (!b.hasOwnProperty(prop) || !cmp(a[prop], b[prop])) return false;
16506
- props++;
16507
- }
16508
- for (var prop in b) if (b.hasOwnProperty(prop)) props--;
16509
- return props == 0;
16510
- }
16511
- function enterLocalMode(config, state, spec, token) {
16512
- var pers;
16513
- if (spec.persistent) {
16514
- for (var p = state.persistentStates; p && !pers; p = p.next)
16515
- if (spec.spec ? cmp(spec.spec, p.spec) : spec.mode == p.mode) pers = p;
16516
- }
16517
- var mode = pers ? pers.mode : spec.mode || CodeMirror.getMode(config, spec.spec);
16518
- var lState = pers ? pers.state : CodeMirror.startState(mode);
16519
- if (spec.persistent && !pers)
16520
- state.persistentStates = { mode, spec: spec.spec, state: lState, next: state.persistentStates };
16521
- state.localState = lState;
16522
- state.local = {
16523
- mode,
16524
- end: spec.end && toRegex(spec.end),
16525
- endScan: spec.end && spec.forceEnd !== false && toRegex(spec.end, false),
16526
- endToken: token && token.join ? token[token.length - 1] : token
16527
- };
16528
- }
16529
- function indexOf(val, arr) {
16530
- for (var i = 0; i < arr.length; i++) if (arr[i] === val) return true;
16531
- }
16532
- function indentFunction(states, meta2) {
16533
- return function(state, textAfter, line) {
16534
- if (state.local && state.local.mode.indent)
16535
- return state.local.mode.indent(state.localState, textAfter, line);
16536
- if (state.indent == null || state.local || meta2.dontIndentStates && indexOf(state.state, meta2.dontIndentStates) > -1)
16537
- return CodeMirror.Pass;
16538
- var pos = state.indent.length - 1, rules = states[state.state];
16539
- scan: for (; ; ) {
16540
- for (var i = 0; i < rules.length; i++) {
16541
- var rule = rules[i];
16542
- if (rule.data.dedent && rule.data.dedentIfLineStart !== false) {
16543
- var m = rule.regex.exec(textAfter);
16544
- if (m && m[0]) {
16545
- pos--;
16546
- if (rule.next || rule.push) rules = states[rule.next || rule.push];
16547
- textAfter = textAfter.slice(m[0].length);
16548
- continue scan;
16549
- }
16382
+ }
16383
+ stream.next();
16384
+ return null;
16385
+ };
16386
+ }
16387
+ function cmp(a, b) {
16388
+ if (a === b) return true;
16389
+ if (!a || typeof a != "object" || !b || typeof b != "object") return false;
16390
+ var props = 0;
16391
+ for (var prop in a) if (a.hasOwnProperty(prop)) {
16392
+ if (!b.hasOwnProperty(prop) || !cmp(a[prop], b[prop])) return false;
16393
+ props++;
16394
+ }
16395
+ for (var prop in b) if (b.hasOwnProperty(prop)) props--;
16396
+ return props == 0;
16397
+ }
16398
+ function enterLocalMode(config, state, spec, token) {
16399
+ var pers;
16400
+ if (spec.persistent) {
16401
+ for (var p = state.persistentStates; p && !pers; p = p.next)
16402
+ if (spec.spec ? cmp(spec.spec, p.spec) : spec.mode == p.mode) pers = p;
16403
+ }
16404
+ var mode = pers ? pers.mode : spec.mode || CodeMirror.getMode(config, spec.spec);
16405
+ var lState = pers ? pers.state : CodeMirror.startState(mode);
16406
+ if (spec.persistent && !pers)
16407
+ state.persistentStates = { mode, spec: spec.spec, state: lState, next: state.persistentStates };
16408
+ state.localState = lState;
16409
+ state.local = {
16410
+ mode,
16411
+ end: spec.end && toRegex(spec.end),
16412
+ endScan: spec.end && spec.forceEnd !== false && toRegex(spec.end, false),
16413
+ endToken: token && token.join ? token[token.length - 1] : token
16414
+ };
16415
+ }
16416
+ function indexOf(val, arr) {
16417
+ for (var i = 0; i < arr.length; i++) if (arr[i] === val) return true;
16418
+ }
16419
+ function indentFunction(states, meta2) {
16420
+ return function(state, textAfter, line) {
16421
+ if (state.local && state.local.mode.indent)
16422
+ return state.local.mode.indent(state.localState, textAfter, line);
16423
+ if (state.indent == null || state.local || meta2.dontIndentStates && indexOf(state.state, meta2.dontIndentStates) > -1)
16424
+ return CodeMirror.Pass;
16425
+ var pos = state.indent.length - 1, rules = states[state.state];
16426
+ scan: for (; ; ) {
16427
+ for (var i = 0; i < rules.length; i++) {
16428
+ var rule = rules[i];
16429
+ if (rule.data.dedent && rule.data.dedentIfLineStart !== false) {
16430
+ var m = rule.regex.exec(textAfter);
16431
+ if (m && m[0]) {
16432
+ pos--;
16433
+ if (rule.next || rule.push) rules = states[rule.next || rule.push];
16434
+ textAfter = textAfter.slice(m[0].length);
16435
+ continue scan;
16550
16436
  }
16551
16437
  }
16552
- break;
16553
16438
  }
16554
- return pos < 0 ? 0 : state.indent[pos];
16555
- };
16556
- }
16557
- });
16558
- })();
16559
- return simple.exports;
16560
- }
16561
- requireSimple();
16562
- var yaml = { exports: {} };
16563
- var hasRequiredYaml;
16564
- function requireYaml() {
16565
- if (hasRequiredYaml) return yaml.exports;
16566
- hasRequiredYaml = 1;
16567
- (function(module, exports) {
16568
- (function(mod) {
16569
- mod(requireCodemirror());
16570
- })(function(CodeMirror) {
16571
- CodeMirror.defineMode("yaml", function() {
16572
- var cons = ["true", "false", "on", "off", "yes", "no"];
16573
- var keywordRegex = new RegExp("\\b((" + cons.join(")|(") + "))$", "i");
16574
- return {
16575
- token: function(stream, state) {
16576
- var ch = stream.peek();
16577
- var esc = state.escaped;
16578
- state.escaped = false;
16579
- if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) {
16580
- stream.skipToEnd();
16581
- return "comment";
16582
- }
16583
- if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))
16584
- return "string";
16585
- if (state.literal && stream.indentation() > state.keyCol) {
16586
- stream.skipToEnd();
16587
- return "string";
16588
- } else if (state.literal) {
16589
- state.literal = false;
16590
- }
16591
- if (stream.sol()) {
16592
- state.keyCol = 0;
16593
- state.pair = false;
16594
- state.pairStart = false;
16595
- if (stream.match("---")) {
16596
- return "def";
16597
- }
16598
- if (stream.match("...")) {
16599
- return "def";
16600
- }
16601
- if (stream.match(/\s*-\s+/)) {
16602
- return "meta";
16603
- }
16604
- }
16605
- if (stream.match(/^(\{|\}|\[|\])/)) {
16606
- if (ch == "{")
16607
- state.inlinePairs++;
16608
- else if (ch == "}")
16609
- state.inlinePairs--;
16610
- else if (ch == "[")
16611
- state.inlineList++;
16612
- else
16613
- state.inlineList--;
16614
- return "meta";
16615
- }
16616
- if (state.inlineList > 0 && !esc && ch == ",") {
16617
- stream.next();
16618
- return "meta";
16619
- }
16620
- if (state.inlinePairs > 0 && !esc && ch == ",") {
16621
- state.keyCol = 0;
16622
- state.pair = false;
16623
- state.pairStart = false;
16624
- stream.next();
16625
- return "meta";
16626
- }
16627
- if (state.pairStart) {
16628
- if (stream.match(/^\s*(\||\>)\s*/)) {
16629
- state.literal = true;
16630
- return "meta";
16631
- }
16632
- if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) {
16633
- return "variable-2";
16634
- }
16635
- if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) {
16636
- return "number";
16637
- }
16638
- if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) {
16639
- return "number";
16640
- }
16641
- if (stream.match(keywordRegex)) {
16642
- return "keyword";
16643
- }
16644
- }
16645
- if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^\s,\[\]{}#&*!|>'"%@`])[^#:]*(?=:($|\s))/)) {
16646
- state.pair = true;
16647
- state.keyCol = stream.indentation();
16648
- return "atom";
16649
- }
16650
- if (state.pair && stream.match(/^:\s*/)) {
16651
- state.pairStart = true;
16652
- return "meta";
16653
- }
16654
- state.pairStart = false;
16655
- state.escaped = ch == "\\";
16656
- stream.next();
16657
- return null;
16658
- },
16659
- startState: function() {
16660
- return {
16661
- pair: false,
16662
- pairStart: false,
16663
- keyCol: 0,
16664
- inlinePairs: 0,
16665
- inlineList: 0,
16666
- literal: false,
16667
- escaped: false
16668
- };
16669
- },
16670
- lineComment: "#",
16671
- fold: "indent"
16672
- };
16673
- });
16674
- CodeMirror.defineMIME("text/x-yaml", "yaml");
16675
- CodeMirror.defineMIME("text/yaml", "yaml");
16676
- });
16677
- })();
16678
- return yaml.exports;
16679
- }
16680
- requireYaml();
16439
+ break;
16440
+ }
16441
+ return pos < 0 ? 0 : state.indent[pos];
16442
+ };
16443
+ }
16444
+ });
16445
+ })();
16681
16446
  export {
16682
16447
  codemirror as default
16683
16448
  };
16684
- //# sourceMappingURL=codeMirrorModule-CB-2okZ8.js.map
16449
+ //# sourceMappingURL=codeMirrorModule-DblsdhjA.js.map