@dangl/angular-material-shared 2.2.0 → 2.3.0-beta0037

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 (172) hide show
  1. package/{esm2015/dangl-angular-material-shared.js → esm2020/dangl-angular-material-shared.mjs} +0 -0
  2. package/esm2020/lib/angular-material-shared.module.mjs +38 -0
  3. package/esm2020/lib/components/footer/footer.component.mjs +33 -0
  4. package/esm2020/lib/components/header/header.component.mjs +80 -0
  5. package/esm2020/lib/components/tiny-mce/tiny-mce.component.mjs +104 -0
  6. package/{esm2015/lib/models/footer-options.js → esm2020/lib/models/footer-options.mjs} +0 -0
  7. package/{esm2015/lib/utils/guid-generator.js → esm2020/lib/utils/guid-generator.mjs} +0 -0
  8. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  9. package/fesm2015/dangl-angular-material-shared.mjs +292 -0
  10. package/fesm2015/dangl-angular-material-shared.mjs.map +1 -0
  11. package/fesm2020/dangl-angular-material-shared.mjs +290 -0
  12. package/fesm2020/dangl-angular-material-shared.mjs.map +1 -0
  13. package/{dangl-angular-material-shared.d.ts → index.d.ts} +1 -0
  14. package/lib/angular-material-shared.module.d.ts +12 -0
  15. package/lib/components/footer/footer.component.d.ts +3 -0
  16. package/lib/components/header/header.component.d.ts +3 -0
  17. package/lib/components/tiny-mce/tiny-mce.component.d.ts +3 -0
  18. package/package.json +28 -16
  19. package/styles/material-style.scss +1 -1
  20. package/styles/material-theme.scss +4 -3
  21. package/styles/material-variables.scss +9 -8
  22. package/tinymce-assets/icons/default/icons.js +11 -1
  23. package/tinymce-assets/icons/default/icons.min.js +1 -1
  24. package/tinymce-assets/langs/cs.js +118 -75
  25. package/tinymce-assets/langs/cy.js +61 -18
  26. package/tinymce-assets/langs/da.js +60 -17
  27. package/tinymce-assets/langs/de.js +60 -17
  28. package/tinymce-assets/langs/eo.js +334 -138
  29. package/tinymce-assets/langs/es_ES.js +32 -2
  30. package/tinymce-assets/langs/fa.js +60 -17
  31. package/tinymce-assets/langs/fa_IR.js +31 -1
  32. package/tinymce-assets/langs/fr_FR.js +60 -17
  33. package/tinymce-assets/langs/hu_HU.js +60 -17
  34. package/tinymce-assets/langs/ja.js +60 -17
  35. package/tinymce-assets/langs/ko_KR.js +3 -3
  36. package/tinymce-assets/langs/nb_NO.js +61 -18
  37. package/tinymce-assets/langs/nl.js +60 -17
  38. package/tinymce-assets/langs/pl.js +60 -17
  39. package/tinymce-assets/langs/pt_BR.js +60 -17
  40. package/tinymce-assets/langs/pt_PT.js +60 -17
  41. package/tinymce-assets/langs/ro.js +60 -17
  42. package/tinymce-assets/langs/ro_RO.js +32 -2
  43. package/tinymce-assets/langs/ru.js +60 -17
  44. package/tinymce-assets/langs/ru_RU.js +445 -0
  45. package/tinymce-assets/langs/sl.js +59 -14
  46. package/tinymce-assets/langs/ta.js +60 -17
  47. package/tinymce-assets/langs/ta_IN.js +60 -17
  48. package/tinymce-assets/langs/th_TH.js +60 -17
  49. package/tinymce-assets/langs/tr_TR.js +81 -8
  50. package/tinymce-assets/langs/vi.js +179 -21
  51. package/tinymce-assets/langs/zh_CN.js +60 -17
  52. package/tinymce-assets/plugins/advlist/plugin.js +29 -48
  53. package/tinymce-assets/plugins/advlist/plugin.min.js +2 -2
  54. package/tinymce-assets/plugins/anchor/plugin.js +8 -8
  55. package/tinymce-assets/plugins/anchor/plugin.min.js +2 -2
  56. package/tinymce-assets/plugins/autolink/plugin.js +58 -30
  57. package/tinymce-assets/plugins/autolink/plugin.min.js +2 -2
  58. package/tinymce-assets/plugins/autoresize/plugin.js +25 -12
  59. package/tinymce-assets/plugins/autoresize/plugin.min.js +2 -2
  60. package/tinymce-assets/plugins/autosave/plugin.js +9 -9
  61. package/tinymce-assets/plugins/autosave/plugin.min.js +2 -2
  62. package/tinymce-assets/plugins/bbcode/plugin.js +6 -6
  63. package/tinymce-assets/plugins/bbcode/plugin.min.js +2 -2
  64. package/tinymce-assets/plugins/charmap/plugin.js +39 -49
  65. package/tinymce-assets/plugins/charmap/plugin.min.js +2 -2
  66. package/tinymce-assets/plugins/code/plugin.js +9 -10
  67. package/tinymce-assets/plugins/code/plugin.min.js +2 -2
  68. package/tinymce-assets/plugins/codesample/plugin.js +1921 -1914
  69. package/tinymce-assets/plugins/codesample/plugin.min.js +2 -2
  70. package/tinymce-assets/plugins/colorpicker/plugin.js +1 -2
  71. package/tinymce-assets/plugins/colorpicker/plugin.min.js +2 -2
  72. package/tinymce-assets/plugins/contextmenu/plugin.js +1 -2
  73. package/tinymce-assets/plugins/contextmenu/plugin.min.js +2 -2
  74. package/tinymce-assets/plugins/directionality/plugin.js +186 -53
  75. package/tinymce-assets/plugins/directionality/plugin.min.js +2 -2
  76. package/tinymce-assets/plugins/emoticons/js/emojiimages.js +1572 -1572
  77. package/tinymce-assets/plugins/emoticons/js/emojiimages.min.js +1 -1
  78. package/tinymce-assets/plugins/emoticons/js/emojis.js +1572 -1572
  79. package/tinymce-assets/plugins/emoticons/js/emojis.min.js +1 -1
  80. package/tinymce-assets/plugins/emoticons/plugin.js +231 -200
  81. package/tinymce-assets/plugins/emoticons/plugin.min.js +2 -2
  82. package/tinymce-assets/plugins/fullpage/plugin.js +42 -42
  83. package/tinymce-assets/plugins/fullpage/plugin.min.js +2 -2
  84. package/tinymce-assets/plugins/fullscreen/plugin.js +496 -129
  85. package/tinymce-assets/plugins/fullscreen/plugin.min.js +2 -2
  86. package/tinymce-assets/plugins/help/plugin.js +101 -122
  87. package/tinymce-assets/plugins/help/plugin.min.js +2 -2
  88. package/tinymce-assets/plugins/hr/plugin.js +9 -10
  89. package/tinymce-assets/plugins/hr/plugin.min.js +2 -2
  90. package/tinymce-assets/plugins/image/plugin.js +78 -73
  91. package/tinymce-assets/plugins/image/plugin.min.js +2 -2
  92. package/tinymce-assets/plugins/imagetools/plugin.js +484 -307
  93. package/tinymce-assets/plugins/imagetools/plugin.min.js +2 -2
  94. package/tinymce-assets/plugins/importcss/plugin.js +50 -51
  95. package/tinymce-assets/plugins/importcss/plugin.min.js +2 -2
  96. package/tinymce-assets/plugins/insertdatetime/plugin.js +22 -17
  97. package/tinymce-assets/plugins/insertdatetime/plugin.min.js +2 -2
  98. package/tinymce-assets/plugins/legacyoutput/plugin.js +8 -8
  99. package/tinymce-assets/plugins/legacyoutput/plugin.min.js +2 -2
  100. package/tinymce-assets/plugins/link/plugin.js +131 -125
  101. package/tinymce-assets/plugins/link/plugin.min.js +2 -2
  102. package/tinymce-assets/plugins/lists/plugin.js +256 -229
  103. package/tinymce-assets/plugins/lists/plugin.min.js +2 -2
  104. package/tinymce-assets/plugins/media/plugin.js +124 -147
  105. package/tinymce-assets/plugins/media/plugin.min.js +2 -2
  106. package/tinymce-assets/plugins/nonbreaking/plugin.js +13 -14
  107. package/tinymce-assets/plugins/nonbreaking/plugin.min.js +2 -2
  108. package/tinymce-assets/plugins/noneditable/plugin.js +6 -6
  109. package/tinymce-assets/plugins/noneditable/plugin.min.js +2 -2
  110. package/tinymce-assets/plugins/pagebreak/plugin.js +16 -17
  111. package/tinymce-assets/plugins/pagebreak/plugin.min.js +2 -2
  112. package/tinymce-assets/plugins/paste/plugin.js +196 -157
  113. package/tinymce-assets/plugins/paste/plugin.min.js +2 -2
  114. package/tinymce-assets/plugins/preview/plugin.js +13 -14
  115. package/tinymce-assets/plugins/preview/plugin.min.js +2 -2
  116. package/tinymce-assets/plugins/print/plugin.js +13 -14
  117. package/tinymce-assets/plugins/print/plugin.min.js +2 -2
  118. package/tinymce-assets/plugins/quickbars/plugin.js +33 -48
  119. package/tinymce-assets/plugins/quickbars/plugin.min.js +2 -2
  120. package/tinymce-assets/plugins/save/plugin.js +9 -8
  121. package/tinymce-assets/plugins/save/plugin.min.js +2 -2
  122. package/tinymce-assets/plugins/searchreplace/plugin.js +73 -70
  123. package/tinymce-assets/plugins/searchreplace/plugin.min.js +2 -2
  124. package/tinymce-assets/plugins/spellchecker/plugin.js +22 -23
  125. package/tinymce-assets/plugins/spellchecker/plugin.min.js +2 -2
  126. package/tinymce-assets/plugins/tabfocus/plugin.js +21 -20
  127. package/tinymce-assets/plugins/tabfocus/plugin.min.js +2 -2
  128. package/tinymce-assets/plugins/table/plugin.js +2831 -2264
  129. package/tinymce-assets/plugins/table/plugin.min.js +2 -2
  130. package/tinymce-assets/plugins/template/plugin.js +84 -70
  131. package/tinymce-assets/plugins/template/plugin.min.js +2 -2
  132. package/tinymce-assets/plugins/textcolor/plugin.js +1 -2
  133. package/tinymce-assets/plugins/textcolor/plugin.min.js +2 -2
  134. package/tinymce-assets/plugins/textpattern/plugin.js +76 -96
  135. package/tinymce-assets/plugins/textpattern/plugin.min.js +2 -2
  136. package/tinymce-assets/plugins/toc/plugin.js +31 -29
  137. package/tinymce-assets/plugins/toc/plugin.min.js +2 -2
  138. package/tinymce-assets/plugins/visualblocks/plugin.js +10 -11
  139. package/tinymce-assets/plugins/visualblocks/plugin.min.js +2 -2
  140. package/tinymce-assets/plugins/visualchars/plugin.js +52 -67
  141. package/tinymce-assets/plugins/visualchars/plugin.min.js +2 -2
  142. package/tinymce-assets/plugins/wordcount/plugin.js +67 -58
  143. package/tinymce-assets/plugins/wordcount/plugin.min.js +2 -2
  144. package/tinymce-assets/skins/ui/oxide/content.css +1 -1
  145. package/tinymce-assets/skins/ui/oxide/content.inline.css +1 -1
  146. package/tinymce-assets/skins/ui/oxide/content.inline.min.css +1 -1
  147. package/tinymce-assets/skins/ui/oxide/content.min.css +1 -1
  148. package/tinymce-assets/skins/ui/oxide/skin.css +35 -22
  149. package/tinymce-assets/skins/ui/oxide/skin.min.css +1 -1
  150. package/tinymce-assets/skins/ui/oxide/skin.shadowdom.css +7 -7
  151. package/tinymce-assets/skins/ui/oxide/skin.shadowdom.min.css +1 -1
  152. package/tinymce-assets/skins/ui/oxide-dark/content.css +1 -1
  153. package/tinymce-assets/skins/ui/oxide-dark/content.inline.css +1 -1
  154. package/tinymce-assets/skins/ui/oxide-dark/content.inline.min.css +1 -1
  155. package/tinymce-assets/skins/ui/oxide-dark/content.min.css +1 -1
  156. package/tinymce-assets/skins/ui/oxide-dark/skin.css +35 -22
  157. package/tinymce-assets/skins/ui/oxide-dark/skin.min.css +1 -1
  158. package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.css +7 -7
  159. package/tinymce-assets/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -1
  160. package/tinymce-assets/themes/mobile/theme.js +2798 -3255
  161. package/tinymce-assets/themes/mobile/theme.min.js +2 -2
  162. package/tinymce-assets/themes/silver/theme.js +25400 -25371
  163. package/tinymce-assets/themes/silver/theme.min.js +2 -2
  164. package/bundles/dangl-angular-material-shared.umd.js +0 -285
  165. package/bundles/dangl-angular-material-shared.umd.js.map +0 -1
  166. package/dangl-angular-material-shared.metadata.json +0 -1
  167. package/esm2015/lib/angular-material-shared.module.js +0 -25
  168. package/esm2015/lib/components/footer/footer.component.js +0 -27
  169. package/esm2015/lib/components/header/header.component.js +0 -67
  170. package/esm2015/lib/components/tiny-mce/tiny-mce.component.js +0 -100
  171. package/fesm2015/dangl-angular-material-shared.js +0 -259
  172. package/fesm2015/dangl-angular-material-shared.js.map +0 -1
@@ -4,12 +4,12 @@
4
4
  * For LGPL see License.txt in the project root for license information.
5
5
  * For commercial licenses see https://www.tiny.cloud/
6
6
  *
7
- * Version: 5.8.2 (2021-06-23)
7
+ * Version: 5.10.3 (2022-02-09)
8
8
  */
9
9
  (function () {
10
10
  'use strict';
11
11
 
12
- var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
12
+ var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');
13
13
 
14
14
  var noop = function () {
15
15
  };
@@ -18,6 +18,9 @@
18
18
  return value;
19
19
  };
20
20
  };
21
+ var identity = function (x) {
22
+ return x;
23
+ };
21
24
  var never = constant(false);
22
25
  var always = constant(true);
23
26
 
@@ -25,20 +28,14 @@
25
28
  return NONE;
26
29
  };
27
30
  var NONE = function () {
28
- var eq = function (o) {
29
- return o.isNone();
30
- };
31
31
  var call = function (thunk) {
32
32
  return thunk();
33
33
  };
34
- var id = function (n) {
35
- return n;
36
- };
34
+ var id = identity;
37
35
  var me = {
38
36
  fold: function (n, _s) {
39
37
  return n();
40
38
  },
41
- is: never,
42
39
  isSome: never,
43
40
  isNone: always,
44
41
  getOr: id,
@@ -55,9 +52,9 @@
55
52
  bind: none,
56
53
  exists: never,
57
54
  forall: always,
58
- filter: none,
59
- equals: eq,
60
- equals_: eq,
55
+ filter: function () {
56
+ return none();
57
+ },
61
58
  toArray: function () {
62
59
  return [];
63
60
  },
@@ -77,9 +74,6 @@
77
74
  fold: function (n, s) {
78
75
  return s(a);
79
76
  },
80
- is: function (v) {
81
- return a === v;
82
- },
83
77
  isSome: always,
84
78
  isNone: never,
85
79
  getOr: constant_a,
@@ -106,14 +100,6 @@
106
100
  },
107
101
  toString: function () {
108
102
  return 'some(' + a + ')';
109
- },
110
- equals: function (o) {
111
- return o.is(a);
112
- },
113
- equals_: function (o, elementEq) {
114
- return o.fold(never, function (b) {
115
- return elementEq(a, b);
116
- });
117
103
  }
118
104
  };
119
105
  return me;
@@ -127,11 +113,15 @@
127
113
  from: from
128
114
  };
129
115
 
130
- var get = function (xs, i) {
116
+ var get$1 = function (xs, i) {
131
117
  return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
132
118
  };
133
119
  var head = function (xs) {
134
- return get(xs, 0);
120
+ return get$1(xs, 0);
121
+ };
122
+
123
+ var someIf = function (b, a) {
124
+ return b ? Optional.some(a) : Optional.none();
135
125
  };
136
126
 
137
127
  var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
@@ -147,1966 +137,1988 @@
147
137
 
148
138
  var Global = typeof window !== 'undefined' ? window : Function('return this;')();
149
139
 
150
- var exports$1 = {}, module = { exports: exports$1 }, global$2 = {};
140
+ var exports$1 = {}, module = { exports: exports$1 }, global = {};
151
141
  (function (define, exports, module, require) {
152
142
  var oldprism = window.Prism;
153
143
  window.Prism = { manual: true };
154
- (function (f) {
155
- if (typeof exports === 'object' && typeof module !== 'undefined') {
156
- module.exports = f();
157
- } else if (typeof define === 'function' && define.amd) {
158
- define([], f);
159
- } else {
160
- var g;
161
- if (typeof window !== 'undefined') {
162
- g = window;
163
- } else if (typeof global$2 !== 'undefined') {
164
- g = global$2;
165
- } else if (typeof self !== 'undefined') {
166
- g = self;
167
- } else {
168
- g = this;
169
- }
170
- g.EphoxContactWrapper = f();
171
- }
172
- }(function () {
173
- return function () {
174
- function r(e, n, t) {
175
- function o(i, f) {
176
- if (!n[i]) {
177
- if (!e[i]) {
178
- var c = 'function' == typeof require && require;
179
- if (!f && c)
180
- return c(i, !0);
181
- if (u)
182
- return u(i, !0);
183
- var a = new Error('Cannot find module \'' + i + '\'');
184
- throw a.code = 'MODULE_NOT_FOUND', a;
185
- }
186
- var p = n[i] = { exports: {} };
187
- e[i][0].call(p.exports, function (r) {
188
- var n = e[i][1][r];
189
- return o(n || r);
190
- }, p, p.exports, r, e, n, t);
191
- }
192
- return n[i].exports;
193
- }
194
- for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++)
195
- o(t[i]);
196
- return o;
197
- }
198
- return r;
199
- }()({
200
- 1: [
201
- function (require, module, exports) {
202
- Prism.languages.c = Prism.languages.extend('clike', {
203
- 'comment': {
204
- pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
205
- greedy: true
144
+ (function (global, factory) {
145
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EphoxContactWrapper = factory());
146
+ }(this, function () {
147
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
148
+ var prismCore = { exports: {} };
149
+ (function (module) {
150
+ var _self = typeof window !== 'undefined' ? window : typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self : {};
151
+ var Prism = function (_self) {
152
+ var lang = /\blang(?:uage)?-([\w-]+)\b/i;
153
+ var uniqueId = 0;
154
+ var plainTextGrammar = {};
155
+ var _ = {
156
+ manual: _self.Prism && _self.Prism.manual,
157
+ disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
158
+ util: {
159
+ encode: function encode(tokens) {
160
+ if (tokens instanceof Token) {
161
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
162
+ } else if (Array.isArray(tokens)) {
163
+ return tokens.map(encode);
164
+ } else {
165
+ return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
166
+ }
206
167
  },
207
- 'class-name': {
208
- pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
209
- lookbehind: true
168
+ type: function (o) {
169
+ return Object.prototype.toString.call(o).slice(8, -1);
210
170
  },
211
- 'keyword': /\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
212
- 'function': /[a-z_]\w*(?=\s*\()/i,
213
- 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
214
- 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
215
- });
216
- Prism.languages.insertBefore('c', 'string', {
217
- 'macro': {
218
- pattern: /(^\s*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
219
- lookbehind: true,
220
- greedy: true,
221
- alias: 'property',
222
- inside: {
223
- 'string': [
224
- {
225
- pattern: /^(#\s*include\s*)<[^>]+>/,
226
- lookbehind: true
227
- },
228
- Prism.languages.c['string']
229
- ],
230
- 'comment': Prism.languages.c['comment'],
231
- 'macro-name': [
232
- {
233
- pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
234
- lookbehind: true
235
- },
236
- {
237
- pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
238
- lookbehind: true,
239
- alias: 'function'
171
+ objId: function (obj) {
172
+ if (!obj['__id']) {
173
+ Object.defineProperty(obj, '__id', { value: ++uniqueId });
174
+ }
175
+ return obj['__id'];
176
+ },
177
+ clone: function deepClone(o, visited) {
178
+ visited = visited || {};
179
+ var clone;
180
+ var id;
181
+ switch (_.util.type(o)) {
182
+ case 'Object':
183
+ id = _.util.objId(o);
184
+ if (visited[id]) {
185
+ return visited[id];
186
+ }
187
+ clone = {};
188
+ visited[id] = clone;
189
+ for (var key in o) {
190
+ if (o.hasOwnProperty(key)) {
191
+ clone[key] = deepClone(o[key], visited);
240
192
  }
241
- ],
242
- 'directive': {
243
- pattern: /^(#\s*)[a-z]+/,
244
- lookbehind: true,
245
- alias: 'keyword'
246
- },
247
- 'directive-hash': /^#/,
248
- 'punctuation': /##|\\(?=[\r\n])/,
249
- 'expression': {
250
- pattern: /\S[\s\S]*/,
251
- inside: Prism.languages.c
252
193
  }
194
+ return clone;
195
+ case 'Array':
196
+ id = _.util.objId(o);
197
+ if (visited[id]) {
198
+ return visited[id];
199
+ }
200
+ clone = [];
201
+ visited[id] = clone;
202
+ o.forEach(function (v, i) {
203
+ clone[i] = deepClone(v, visited);
204
+ });
205
+ return clone;
206
+ default:
207
+ return o;
253
208
  }
254
209
  },
255
- 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
256
- });
257
- delete Prism.languages.c['boolean'];
258
- },
259
- {}
260
- ],
261
- 2: [
262
- function (require, module, exports) {
263
- Prism.languages.clike = {
264
- 'comment': [
265
- {
266
- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
267
- lookbehind: true,
268
- greedy: true
269
- },
270
- {
271
- pattern: /(^|[^\\:])\/\/.*/,
272
- lookbehind: true,
273
- greedy: true
210
+ getLanguage: function (element) {
211
+ while (element && !lang.test(element.className)) {
212
+ element = element.parentElement;
274
213
  }
275
- ],
276
- 'string': {
277
- pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
278
- greedy: true
279
- },
280
- 'class-name': {
281
- pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,
282
- lookbehind: true,
283
- inside: { 'punctuation': /[.\\]/ }
214
+ if (element) {
215
+ return (element.className.match(lang) || [
216
+ ,
217
+ 'none'
218
+ ])[1].toLowerCase();
219
+ }
220
+ return 'none';
284
221
  },
285
- 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
286
- 'boolean': /\b(?:true|false)\b/,
287
- 'function': /\w+(?=\()/,
288
- 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
289
- 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
290
- 'punctuation': /[{}[\];(),.:]/
291
- };
292
- },
293
- {}
294
- ],
295
- 3: [
296
- function (require, module, exports) {
297
- (function (global) {
298
- (function () {
299
- var _self = typeof window !== 'undefined' ? window : typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self : {};
300
- var Prism = function (_self) {
301
- var lang = /\blang(?:uage)?-([\w-]+)\b/i;
302
- var uniqueId = 0;
303
- var _ = {
304
- manual: _self.Prism && _self.Prism.manual,
305
- disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
306
- util: {
307
- encode: function encode(tokens) {
308
- if (tokens instanceof Token) {
309
- return new Token(tokens.type, encode(tokens.content), tokens.alias);
310
- } else if (Array.isArray(tokens)) {
311
- return tokens.map(encode);
312
- } else {
313
- return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
314
- }
315
- },
316
- type: function (o) {
317
- return Object.prototype.toString.call(o).slice(8, -1);
318
- },
319
- objId: function (obj) {
320
- if (!obj['__id']) {
321
- Object.defineProperty(obj, '__id', { value: ++uniqueId });
322
- }
323
- return obj['__id'];
324
- },
325
- clone: function deepClone(o, visited) {
326
- visited = visited || {};
327
- var clone, id;
328
- switch (_.util.type(o)) {
329
- case 'Object':
330
- id = _.util.objId(o);
331
- if (visited[id]) {
332
- return visited[id];
333
- }
334
- clone = {};
335
- visited[id] = clone;
336
- for (var key in o) {
337
- if (o.hasOwnProperty(key)) {
338
- clone[key] = deepClone(o[key], visited);
339
- }
340
- }
341
- return clone;
342
- case 'Array':
343
- id = _.util.objId(o);
344
- if (visited[id]) {
345
- return visited[id];
346
- }
347
- clone = [];
348
- visited[id] = clone;
349
- o.forEach(function (v, i) {
350
- clone[i] = deepClone(v, visited);
351
- });
352
- return clone;
353
- default:
354
- return o;
355
- }
356
- },
357
- getLanguage: function (element) {
358
- while (element && !lang.test(element.className)) {
359
- element = element.parentElement;
360
- }
361
- if (element) {
362
- return (element.className.match(lang) || [
363
- ,
364
- 'none'
365
- ])[1].toLowerCase();
366
- }
367
- return 'none';
368
- },
369
- currentScript: function () {
370
- if (typeof document === 'undefined') {
371
- return null;
372
- }
373
- if ('currentScript' in document && 1 < 2) {
374
- return document.currentScript;
375
- }
376
- try {
377
- throw new Error();
378
- } catch (err) {
379
- var src = (/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(err.stack) || [])[1];
380
- if (src) {
381
- var scripts = document.getElementsByTagName('script');
382
- for (var i in scripts) {
383
- if (scripts[i].src == src) {
384
- return scripts[i];
385
- }
386
- }
387
- }
388
- return null;
389
- }
390
- },
391
- isActive: function (element, className, defaultActivation) {
392
- var no = 'no-' + className;
393
- while (element) {
394
- var classList = element.classList;
395
- if (classList.contains(className)) {
396
- return true;
397
- }
398
- if (classList.contains(no)) {
399
- return false;
400
- }
401
- element = element.parentElement;
402
- }
403
- return !!defaultActivation;
404
- }
405
- },
406
- languages: {
407
- extend: function (id, redef) {
408
- var lang = _.util.clone(_.languages[id]);
409
- for (var key in redef) {
410
- lang[key] = redef[key];
411
- }
412
- return lang;
413
- },
414
- insertBefore: function (inside, before, insert, root) {
415
- root = root || _.languages;
416
- var grammar = root[inside];
417
- var ret = {};
418
- for (var token in grammar) {
419
- if (grammar.hasOwnProperty(token)) {
420
- if (token == before) {
421
- for (var newToken in insert) {
422
- if (insert.hasOwnProperty(newToken)) {
423
- ret[newToken] = insert[newToken];
424
- }
425
- }
426
- }
427
- if (!insert.hasOwnProperty(token)) {
428
- ret[token] = grammar[token];
429
- }
430
- }
431
- }
432
- var old = root[inside];
433
- root[inside] = ret;
434
- _.languages.DFS(_.languages, function (key, value) {
435
- if (value === old && key != inside) {
436
- this[key] = ret;
437
- }
438
- });
439
- return ret;
440
- },
441
- DFS: function DFS(o, callback, type, visited) {
442
- visited = visited || {};
443
- var objId = _.util.objId;
444
- for (var i in o) {
445
- if (o.hasOwnProperty(i)) {
446
- callback.call(o, i, o[i], type || i);
447
- var property = o[i], propertyType = _.util.type(property);
448
- if (propertyType === 'Object' && !visited[objId(property)]) {
449
- visited[objId(property)] = true;
450
- DFS(property, callback, null, visited);
451
- } else if (propertyType === 'Array' && !visited[objId(property)]) {
452
- visited[objId(property)] = true;
453
- DFS(property, callback, i, visited);
454
- }
455
- }
456
- }
457
- }
458
- },
459
- plugins: {},
460
- highlightAll: function (async, callback) {
461
- _.highlightAllUnder(document, async, callback);
462
- },
463
- highlightAllUnder: function (container, async, callback) {
464
- var env = {
465
- callback: callback,
466
- container: container,
467
- selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
468
- };
469
- _.hooks.run('before-highlightall', env);
470
- env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
471
- _.hooks.run('before-all-elements-highlight', env);
472
- for (var i = 0, element; element = env.elements[i++];) {
473
- _.highlightElement(element, async === true, env.callback);
474
- }
475
- },
476
- highlightElement: function (element, async, callback) {
477
- var language = _.util.getLanguage(element);
478
- var grammar = _.languages[language];
479
- element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
480
- var parent = element.parentElement;
481
- if (parent && parent.nodeName.toLowerCase() === 'pre') {
482
- parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
483
- }
484
- var code = element.textContent;
485
- var env = {
486
- element: element,
487
- language: language,
488
- grammar: grammar,
489
- code: code
490
- };
491
- function insertHighlightedCode(highlightedCode) {
492
- env.highlightedCode = highlightedCode;
493
- _.hooks.run('before-insert', env);
494
- env.element.innerHTML = env.highlightedCode;
495
- _.hooks.run('after-highlight', env);
496
- _.hooks.run('complete', env);
497
- callback && callback.call(env.element);
498
- }
499
- _.hooks.run('before-sanity-check', env);
500
- if (!env.code) {
501
- _.hooks.run('complete', env);
502
- callback && callback.call(env.element);
503
- return;
504
- }
505
- _.hooks.run('before-highlight', env);
506
- if (!env.grammar) {
507
- insertHighlightedCode(_.util.encode(env.code));
508
- return;
509
- }
510
- if (async && _self.Worker) {
511
- var worker = new Worker(_.filename);
512
- worker.onmessage = function (evt) {
513
- insertHighlightedCode(evt.data);
514
- };
515
- worker.postMessage(JSON.stringify({
516
- language: env.language,
517
- code: env.code,
518
- immediateClose: true
519
- }));
520
- } else {
521
- insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
522
- }
523
- },
524
- highlight: function (text, grammar, language) {
525
- var env = {
526
- code: text,
527
- grammar: grammar,
528
- language: language
529
- };
530
- _.hooks.run('before-tokenize', env);
531
- env.tokens = _.tokenize(env.code, env.grammar);
532
- _.hooks.run('after-tokenize', env);
533
- return Token.stringify(_.util.encode(env.tokens), env.language);
534
- },
535
- tokenize: function (text, grammar) {
536
- var rest = grammar.rest;
537
- if (rest) {
538
- for (var token in rest) {
539
- grammar[token] = rest[token];
540
- }
541
- delete grammar.rest;
542
- }
543
- var tokenList = new LinkedList();
544
- addAfter(tokenList, tokenList.head, text);
545
- matchGrammar(text, tokenList, grammar, tokenList.head, 0);
546
- return toArray(tokenList);
547
- },
548
- hooks: {
549
- all: {},
550
- add: function (name, callback) {
551
- var hooks = _.hooks.all;
552
- hooks[name] = hooks[name] || [];
553
- hooks[name].push(callback);
554
- },
555
- run: function (name, env) {
556
- var callbacks = _.hooks.all[name];
557
- if (!callbacks || !callbacks.length) {
558
- return;
559
- }
560
- for (var i = 0, callback; callback = callbacks[i++];) {
561
- callback(env);
562
- }
222
+ currentScript: function () {
223
+ if (typeof document === 'undefined') {
224
+ return null;
225
+ }
226
+ if ('currentScript' in document && 1 < 2) {
227
+ return document.currentScript;
228
+ }
229
+ try {
230
+ throw new Error();
231
+ } catch (err) {
232
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
233
+ if (src) {
234
+ var scripts = document.getElementsByTagName('script');
235
+ for (var i in scripts) {
236
+ if (scripts[i].src == src) {
237
+ return scripts[i];
563
238
  }
564
- },
565
- Token: Token
566
- };
567
- _self.Prism = _;
568
- function Token(type, content, alias, matchedStr) {
569
- this.type = type;
570
- this.content = content;
571
- this.alias = alias;
572
- this.length = (matchedStr || '').length | 0;
573
- }
574
- Token.stringify = function stringify(o, language) {
575
- if (typeof o == 'string') {
576
- return o;
577
239
  }
578
- if (Array.isArray(o)) {
579
- var s = '';
580
- o.forEach(function (e) {
581
- s += stringify(e, language);
582
- });
583
- return s;
584
- }
585
- var env = {
586
- type: o.type,
587
- content: stringify(o.content, language),
588
- tag: 'span',
589
- classes: [
590
- 'token',
591
- o.type
592
- ],
593
- attributes: {},
594
- language: language
595
- };
596
- var aliases = o.alias;
597
- if (aliases) {
598
- if (Array.isArray(aliases)) {
599
- Array.prototype.push.apply(env.classes, aliases);
600
- } else {
601
- env.classes.push(aliases);
240
+ }
241
+ return null;
242
+ }
243
+ },
244
+ isActive: function (element, className, defaultActivation) {
245
+ var no = 'no-' + className;
246
+ while (element) {
247
+ var classList = element.classList;
248
+ if (classList.contains(className)) {
249
+ return true;
250
+ }
251
+ if (classList.contains(no)) {
252
+ return false;
253
+ }
254
+ element = element.parentElement;
255
+ }
256
+ return !!defaultActivation;
257
+ }
258
+ },
259
+ languages: {
260
+ plain: plainTextGrammar,
261
+ plaintext: plainTextGrammar,
262
+ text: plainTextGrammar,
263
+ txt: plainTextGrammar,
264
+ extend: function (id, redef) {
265
+ var lang = _.util.clone(_.languages[id]);
266
+ for (var key in redef) {
267
+ lang[key] = redef[key];
268
+ }
269
+ return lang;
270
+ },
271
+ insertBefore: function (inside, before, insert, root) {
272
+ root = root || _.languages;
273
+ var grammar = root[inside];
274
+ var ret = {};
275
+ for (var token in grammar) {
276
+ if (grammar.hasOwnProperty(token)) {
277
+ if (token == before) {
278
+ for (var newToken in insert) {
279
+ if (insert.hasOwnProperty(newToken)) {
280
+ ret[newToken] = insert[newToken];
281
+ }
602
282
  }
603
283
  }
604
- _.hooks.run('wrap', env);
605
- var attributes = '';
606
- for (var name in env.attributes) {
607
- attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
284
+ if (!insert.hasOwnProperty(token)) {
285
+ ret[token] = grammar[token];
608
286
  }
609
- return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
610
- };
611
- function matchPattern(pattern, pos, text, lookbehind) {
612
- pattern.lastIndex = pos;
613
- var match = pattern.exec(text);
614
- if (match && lookbehind && match[1]) {
615
- var lookbehindLength = match[1].length;
616
- match.index += lookbehindLength;
617
- match[0] = match[0].slice(lookbehindLength);
618
- }
619
- return match;
620
287
  }
621
- function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
622
- for (var token in grammar) {
623
- if (!grammar.hasOwnProperty(token) || !grammar[token]) {
624
- continue;
625
- }
626
- var patterns = grammar[token];
627
- patterns = Array.isArray(patterns) ? patterns : [patterns];
628
- for (var j = 0; j < patterns.length; ++j) {
629
- if (rematch && rematch.cause == token + ',' + j) {
630
- return;
631
- }
632
- var patternObj = patterns[j], inside = patternObj.inside, lookbehind = !!patternObj.lookbehind, greedy = !!patternObj.greedy, alias = patternObj.alias;
633
- if (greedy && !patternObj.pattern.global) {
634
- var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
635
- patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
636
- }
637
- var pattern = patternObj.pattern || patternObj;
638
- for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
639
- if (rematch && pos >= rematch.reach) {
640
- break;
641
- }
642
- var str = currentNode.value;
643
- if (tokenList.length > text.length) {
644
- return;
645
- }
646
- if (str instanceof Token) {
647
- continue;
648
- }
649
- var removeCount = 1;
650
- var match;
651
- if (greedy) {
652
- match = matchPattern(pattern, pos, text, lookbehind);
653
- if (!match) {
654
- break;
655
- }
656
- var from = match.index;
657
- var to = match.index + match[0].length;
658
- var p = pos;
659
- p += currentNode.value.length;
660
- while (from >= p) {
661
- currentNode = currentNode.next;
662
- p += currentNode.value.length;
663
- }
664
- p -= currentNode.value.length;
665
- pos = p;
666
- if (currentNode.value instanceof Token) {
667
- continue;
668
- }
669
- for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === 'string'); k = k.next) {
670
- removeCount++;
671
- p += k.value.length;
672
- }
673
- removeCount--;
674
- str = text.slice(pos, p);
675
- match.index -= pos;
676
- } else {
677
- match = matchPattern(pattern, 0, str, lookbehind);
678
- if (!match) {
679
- continue;
680
- }
681
- }
682
- var from = match.index, matchStr = match[0], before = str.slice(0, from), after = str.slice(from + matchStr.length);
683
- var reach = pos + str.length;
684
- if (rematch && reach > rematch.reach) {
685
- rematch.reach = reach;
686
- }
687
- var removeFrom = currentNode.prev;
688
- if (before) {
689
- removeFrom = addAfter(tokenList, removeFrom, before);
690
- pos += before.length;
691
- }
692
- removeRange(tokenList, removeFrom, removeCount);
693
- var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
694
- currentNode = addAfter(tokenList, removeFrom, wrapped);
695
- if (after) {
696
- addAfter(tokenList, currentNode, after);
697
- }
698
- if (removeCount > 1) {
699
- matchGrammar(text, tokenList, grammar, currentNode.prev, pos, {
700
- cause: token + ',' + j,
701
- reach: reach
702
- });
703
- }
704
- }
705
- }
288
+ }
289
+ var old = root[inside];
290
+ root[inside] = ret;
291
+ _.languages.DFS(_.languages, function (key, value) {
292
+ if (value === old && key != inside) {
293
+ this[key] = ret;
294
+ }
295
+ });
296
+ return ret;
297
+ },
298
+ DFS: function DFS(o, callback, type, visited) {
299
+ visited = visited || {};
300
+ var objId = _.util.objId;
301
+ for (var i in o) {
302
+ if (o.hasOwnProperty(i)) {
303
+ callback.call(o, i, o[i], type || i);
304
+ var property = o[i];
305
+ var propertyType = _.util.type(property);
306
+ if (propertyType === 'Object' && !visited[objId(property)]) {
307
+ visited[objId(property)] = true;
308
+ DFS(property, callback, null, visited);
309
+ } else if (propertyType === 'Array' && !visited[objId(property)]) {
310
+ visited[objId(property)] = true;
311
+ DFS(property, callback, i, visited);
706
312
  }
707
313
  }
708
- function LinkedList() {
709
- var head = {
710
- value: null,
711
- prev: null,
712
- next: null
713
- };
714
- var tail = {
715
- value: null,
716
- prev: head,
717
- next: null
718
- };
719
- head.next = tail;
720
- this.head = head;
721
- this.tail = tail;
722
- this.length = 0;
314
+ }
315
+ }
316
+ },
317
+ plugins: {},
318
+ highlightAll: function (async, callback) {
319
+ _.highlightAllUnder(document, async, callback);
320
+ },
321
+ highlightAllUnder: function (container, async, callback) {
322
+ var env = {
323
+ callback: callback,
324
+ container: container,
325
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
326
+ };
327
+ _.hooks.run('before-highlightall', env);
328
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
329
+ _.hooks.run('before-all-elements-highlight', env);
330
+ for (var i = 0, element; element = env.elements[i++];) {
331
+ _.highlightElement(element, async === true, env.callback);
332
+ }
333
+ },
334
+ highlightElement: function (element, async, callback) {
335
+ var language = _.util.getLanguage(element);
336
+ var grammar = _.languages[language];
337
+ element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
338
+ var parent = element.parentElement;
339
+ if (parent && parent.nodeName.toLowerCase() === 'pre') {
340
+ parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
341
+ }
342
+ var code = element.textContent;
343
+ var env = {
344
+ element: element,
345
+ language: language,
346
+ grammar: grammar,
347
+ code: code
348
+ };
349
+ function insertHighlightedCode(highlightedCode) {
350
+ env.highlightedCode = highlightedCode;
351
+ _.hooks.run('before-insert', env);
352
+ env.element.innerHTML = env.highlightedCode;
353
+ _.hooks.run('after-highlight', env);
354
+ _.hooks.run('complete', env);
355
+ callback && callback.call(env.element);
356
+ }
357
+ _.hooks.run('before-sanity-check', env);
358
+ parent = env.element.parentElement;
359
+ if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
360
+ parent.setAttribute('tabindex', '0');
361
+ }
362
+ if (!env.code) {
363
+ _.hooks.run('complete', env);
364
+ callback && callback.call(env.element);
365
+ return;
366
+ }
367
+ _.hooks.run('before-highlight', env);
368
+ if (!env.grammar) {
369
+ insertHighlightedCode(_.util.encode(env.code));
370
+ return;
371
+ }
372
+ if (async && _self.Worker) {
373
+ var worker = new Worker(_.filename);
374
+ worker.onmessage = function (evt) {
375
+ insertHighlightedCode(evt.data);
376
+ };
377
+ worker.postMessage(JSON.stringify({
378
+ language: env.language,
379
+ code: env.code,
380
+ immediateClose: true
381
+ }));
382
+ } else {
383
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
384
+ }
385
+ },
386
+ highlight: function (text, grammar, language) {
387
+ var env = {
388
+ code: text,
389
+ grammar: grammar,
390
+ language: language
391
+ };
392
+ _.hooks.run('before-tokenize', env);
393
+ env.tokens = _.tokenize(env.code, env.grammar);
394
+ _.hooks.run('after-tokenize', env);
395
+ return Token.stringify(_.util.encode(env.tokens), env.language);
396
+ },
397
+ tokenize: function (text, grammar) {
398
+ var rest = grammar.rest;
399
+ if (rest) {
400
+ for (var token in rest) {
401
+ grammar[token] = rest[token];
402
+ }
403
+ delete grammar.rest;
404
+ }
405
+ var tokenList = new LinkedList();
406
+ addAfter(tokenList, tokenList.head, text);
407
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
408
+ return toArray(tokenList);
409
+ },
410
+ hooks: {
411
+ all: {},
412
+ add: function (name, callback) {
413
+ var hooks = _.hooks.all;
414
+ hooks[name] = hooks[name] || [];
415
+ hooks[name].push(callback);
416
+ },
417
+ run: function (name, env) {
418
+ var callbacks = _.hooks.all[name];
419
+ if (!callbacks || !callbacks.length) {
420
+ return;
421
+ }
422
+ for (var i = 0, callback; callback = callbacks[i++];) {
423
+ callback(env);
424
+ }
425
+ }
426
+ },
427
+ Token: Token
428
+ };
429
+ _self.Prism = _;
430
+ function Token(type, content, alias, matchedStr) {
431
+ this.type = type;
432
+ this.content = content;
433
+ this.alias = alias;
434
+ this.length = (matchedStr || '').length | 0;
435
+ }
436
+ Token.stringify = function stringify(o, language) {
437
+ if (typeof o == 'string') {
438
+ return o;
439
+ }
440
+ if (Array.isArray(o)) {
441
+ var s = '';
442
+ o.forEach(function (e) {
443
+ s += stringify(e, language);
444
+ });
445
+ return s;
446
+ }
447
+ var env = {
448
+ type: o.type,
449
+ content: stringify(o.content, language),
450
+ tag: 'span',
451
+ classes: [
452
+ 'token',
453
+ o.type
454
+ ],
455
+ attributes: {},
456
+ language: language
457
+ };
458
+ var aliases = o.alias;
459
+ if (aliases) {
460
+ if (Array.isArray(aliases)) {
461
+ Array.prototype.push.apply(env.classes, aliases);
462
+ } else {
463
+ env.classes.push(aliases);
464
+ }
465
+ }
466
+ _.hooks.run('wrap', env);
467
+ var attributes = '';
468
+ for (var name in env.attributes) {
469
+ attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
470
+ }
471
+ return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
472
+ };
473
+ function matchPattern(pattern, pos, text, lookbehind) {
474
+ pattern.lastIndex = pos;
475
+ var match = pattern.exec(text);
476
+ if (match && lookbehind && match[1]) {
477
+ var lookbehindLength = match[1].length;
478
+ match.index += lookbehindLength;
479
+ match[0] = match[0].slice(lookbehindLength);
480
+ }
481
+ return match;
482
+ }
483
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
484
+ for (var token in grammar) {
485
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
486
+ continue;
487
+ }
488
+ var patterns = grammar[token];
489
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
490
+ for (var j = 0; j < patterns.length; ++j) {
491
+ if (rematch && rematch.cause == token + ',' + j) {
492
+ return;
493
+ }
494
+ var patternObj = patterns[j];
495
+ var inside = patternObj.inside;
496
+ var lookbehind = !!patternObj.lookbehind;
497
+ var greedy = !!patternObj.greedy;
498
+ var alias = patternObj.alias;
499
+ if (greedy && !patternObj.pattern.global) {
500
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
501
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
502
+ }
503
+ var pattern = patternObj.pattern || patternObj;
504
+ for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
505
+ if (rematch && pos >= rematch.reach) {
506
+ break;
723
507
  }
724
- function addAfter(list, node, value) {
725
- var next = node.next;
726
- var newNode = {
727
- value: value,
728
- prev: node,
729
- next: next
730
- };
731
- node.next = newNode;
732
- next.prev = newNode;
733
- list.length++;
734
- return newNode;
508
+ var str = currentNode.value;
509
+ if (tokenList.length > text.length) {
510
+ return;
735
511
  }
736
- function removeRange(list, node, count) {
737
- var next = node.next;
738
- for (var i = 0; i < count && next !== list.tail; i++) {
739
- next = next.next;
740
- }
741
- node.next = next;
742
- next.prev = node;
743
- list.length -= i;
512
+ if (str instanceof Token) {
513
+ continue;
744
514
  }
745
- function toArray(list) {
746
- var array = [];
747
- var node = list.head.next;
748
- while (node !== list.tail) {
749
- array.push(node.value);
750
- node = node.next;
515
+ var removeCount = 1;
516
+ var match;
517
+ if (greedy) {
518
+ match = matchPattern(pattern, pos, text, lookbehind);
519
+ if (!match) {
520
+ break;
751
521
  }
752
- return array;
753
- }
754
- if (!_self.document) {
755
- if (!_self.addEventListener) {
756
- return _;
522
+ var from = match.index;
523
+ var to = match.index + match[0].length;
524
+ var p = pos;
525
+ p += currentNode.value.length;
526
+ while (from >= p) {
527
+ currentNode = currentNode.next;
528
+ p += currentNode.value.length;
757
529
  }
758
- if (!_.disableWorkerMessageHandler) {
759
- _self.addEventListener('message', function (evt) {
760
- var message = JSON.parse(evt.data), lang = message.language, code = message.code, immediateClose = message.immediateClose;
761
- _self.postMessage(_.highlight(code, _.languages[lang], lang));
762
- if (immediateClose) {
763
- _self.close();
764
- }
765
- }, false);
530
+ p -= currentNode.value.length;
531
+ pos = p;
532
+ if (currentNode.value instanceof Token) {
533
+ continue;
766
534
  }
767
- return _;
768
- }
769
- var script = _.util.currentScript();
770
- if (script) {
771
- _.filename = script.src;
772
- if (script.hasAttribute('data-manual')) {
773
- _.manual = true;
535
+ for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === 'string'); k = k.next) {
536
+ removeCount++;
537
+ p += k.value.length;
774
538
  }
775
- }
776
- function highlightAutomaticallyCallback() {
777
- if (!_.manual) {
778
- _.highlightAll();
539
+ removeCount--;
540
+ str = text.slice(pos, p);
541
+ match.index -= pos;
542
+ } else {
543
+ match = matchPattern(pattern, 0, str, lookbehind);
544
+ if (!match) {
545
+ continue;
779
546
  }
780
547
  }
781
- if (!_.manual) {
782
- var readyState = document.readyState;
783
- if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
784
- document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
785
- } else {
786
- if (window.requestAnimationFrame) {
787
- window.requestAnimationFrame(highlightAutomaticallyCallback);
788
- } else {
789
- window.setTimeout(highlightAutomaticallyCallback, 16);
790
- }
548
+ var from = match.index;
549
+ var matchStr = match[0];
550
+ var before = str.slice(0, from);
551
+ var after = str.slice(from + matchStr.length);
552
+ var reach = pos + str.length;
553
+ if (rematch && reach > rematch.reach) {
554
+ rematch.reach = reach;
555
+ }
556
+ var removeFrom = currentNode.prev;
557
+ if (before) {
558
+ removeFrom = addAfter(tokenList, removeFrom, before);
559
+ pos += before.length;
560
+ }
561
+ removeRange(tokenList, removeFrom, removeCount);
562
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
563
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
564
+ if (after) {
565
+ addAfter(tokenList, currentNode, after);
566
+ }
567
+ if (removeCount > 1) {
568
+ var nestedRematch = {
569
+ cause: token + ',' + j,
570
+ reach: reach
571
+ };
572
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
573
+ if (rematch && nestedRematch.reach > rematch.reach) {
574
+ rematch.reach = nestedRematch.reach;
791
575
  }
792
576
  }
793
- return _;
794
- }(_self);
795
- if (typeof module !== 'undefined' && module.exports) {
796
- module.exports = Prism;
797
577
  }
798
- if (typeof global !== 'undefined') {
799
- global.Prism = Prism;
578
+ }
579
+ }
580
+ }
581
+ function LinkedList() {
582
+ var head = {
583
+ value: null,
584
+ prev: null,
585
+ next: null
586
+ };
587
+ var tail = {
588
+ value: null,
589
+ prev: head,
590
+ next: null
591
+ };
592
+ head.next = tail;
593
+ this.head = head;
594
+ this.tail = tail;
595
+ this.length = 0;
596
+ }
597
+ function addAfter(list, node, value) {
598
+ var next = node.next;
599
+ var newNode = {
600
+ value: value,
601
+ prev: node,
602
+ next: next
603
+ };
604
+ node.next = newNode;
605
+ next.prev = newNode;
606
+ list.length++;
607
+ return newNode;
608
+ }
609
+ function removeRange(list, node, count) {
610
+ var next = node.next;
611
+ for (var i = 0; i < count && next !== list.tail; i++) {
612
+ next = next.next;
613
+ }
614
+ node.next = next;
615
+ next.prev = node;
616
+ list.length -= i;
617
+ }
618
+ function toArray(list) {
619
+ var array = [];
620
+ var node = list.head.next;
621
+ while (node !== list.tail) {
622
+ array.push(node.value);
623
+ node = node.next;
624
+ }
625
+ return array;
626
+ }
627
+ if (!_self.document) {
628
+ if (!_self.addEventListener) {
629
+ return _;
630
+ }
631
+ if (!_.disableWorkerMessageHandler) {
632
+ _self.addEventListener('message', function (evt) {
633
+ var message = JSON.parse(evt.data);
634
+ var lang = message.language;
635
+ var code = message.code;
636
+ var immediateClose = message.immediateClose;
637
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
638
+ if (immediateClose) {
639
+ _self.close();
800
640
  }
801
- }.call(this));
802
- }.call(this, typeof global$2 !== 'undefined' ? global$2 : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {}));
641
+ }, false);
642
+ }
643
+ return _;
644
+ }
645
+ var script = _.util.currentScript();
646
+ if (script) {
647
+ _.filename = script.src;
648
+ if (script.hasAttribute('data-manual')) {
649
+ _.manual = true;
650
+ }
651
+ }
652
+ function highlightAutomaticallyCallback() {
653
+ if (!_.manual) {
654
+ _.highlightAll();
655
+ }
656
+ }
657
+ if (!_.manual) {
658
+ var readyState = document.readyState;
659
+ if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
660
+ document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
661
+ } else {
662
+ if (window.requestAnimationFrame) {
663
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
664
+ } else {
665
+ window.setTimeout(highlightAutomaticallyCallback, 16);
666
+ }
667
+ }
668
+ }
669
+ return _;
670
+ }(_self);
671
+ if (module.exports) {
672
+ module.exports = Prism;
673
+ }
674
+ if (typeof commonjsGlobal !== 'undefined') {
675
+ commonjsGlobal.Prism = Prism;
676
+ }
677
+ }(prismCore));
678
+ Prism.languages.clike = {
679
+ 'comment': [
680
+ {
681
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
682
+ lookbehind: true,
683
+ greedy: true
803
684
  },
804
- {}
685
+ {
686
+ pattern: /(^|[^\\:])\/\/.*/,
687
+ lookbehind: true,
688
+ greedy: true
689
+ }
805
690
  ],
806
- 4: [
807
- function (require, module, exports) {
808
- (function (Prism) {
809
- var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
810
- Prism.languages.cpp = Prism.languages.extend('c', {
811
- 'class-name': [
812
- {
813
- pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function () {
814
- return keyword.source;
815
- })),
816
- lookbehind: true
817
- },
818
- /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
819
- /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
820
- /\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
821
- ],
822
- 'keyword': keyword,
823
- 'number': {
824
- pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
825
- greedy: true
826
- },
827
- 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
828
- 'boolean': /\b(?:true|false)\b/
829
- });
830
- Prism.languages.insertBefore('cpp', 'string', {
831
- 'raw-string': {
832
- pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
833
- alias: 'string',
834
- greedy: true
691
+ 'string': {
692
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
693
+ greedy: true
694
+ },
695
+ 'class-name': {
696
+ pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,
697
+ lookbehind: true,
698
+ inside: { 'punctuation': /[.\\]/ }
699
+ },
700
+ 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
701
+ 'boolean': /\b(?:true|false)\b/,
702
+ 'function': /\b\w+(?=\()/,
703
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
704
+ 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
705
+ 'punctuation': /[{}[\];(),.:]/
706
+ };
707
+ (function (Prism) {
708
+ function getPlaceholder(language, index) {
709
+ return '___' + language.toUpperCase() + index + '___';
710
+ }
711
+ Object.defineProperties(Prism.languages['markup-templating'] = {}, {
712
+ buildPlaceholders: {
713
+ value: function (env, language, placeholderPattern, replaceFilter) {
714
+ if (env.language !== language) {
715
+ return;
716
+ }
717
+ var tokenStack = env.tokenStack = [];
718
+ env.code = env.code.replace(placeholderPattern, function (match) {
719
+ if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
720
+ return match;
835
721
  }
836
- });
837
- Prism.languages.insertBefore('cpp', 'class-name', {
838
- 'base-clause': {
839
- pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
840
- lookbehind: true,
841
- greedy: true,
842
- inside: Prism.languages.extend('cpp', {})
722
+ var i = tokenStack.length;
723
+ var placeholder;
724
+ while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {
725
+ ++i;
843
726
  }
727
+ tokenStack[i] = match;
728
+ return placeholder;
844
729
  });
845
- Prism.languages.insertBefore('inside', 'operator', { 'class-name': /\b[a-z_]\w*\b(?!\s*::)/i }, Prism.languages.cpp['base-clause']);
846
- }(Prism));
730
+ env.grammar = Prism.languages.markup;
731
+ }
847
732
  },
848
- {}
849
- ],
850
- 5: [
851
- function (require, module, exports) {
852
- (function (Prism) {
853
- function replace(pattern, replacements) {
854
- return pattern.replace(/<<(\d+)>>/g, function (m, index) {
855
- return '(?:' + replacements[+index] + ')';
856
- });
857
- }
858
- function re(pattern, replacements, flags) {
859
- return RegExp(replace(pattern, replacements), flags || '');
860
- }
861
- function nested(pattern, depthLog2) {
862
- for (var i = 0; i < depthLog2; i++) {
863
- pattern = pattern.replace(/<<self>>/g, function () {
864
- return '(?:' + pattern + ')';
865
- });
866
- }
867
- return pattern.replace(/<<self>>/g, '[^\\s\\S]');
868
- }
869
- var keywordKinds = {
870
- type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',
871
- typeDeclaration: 'class enum interface struct',
872
- contextual: 'add alias and ascending async await by descending from get global group into join let nameof not notnull on or orderby partial remove select set unmanaged value when where',
873
- other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
874
- };
875
- function keywordsToPattern(words) {
876
- return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
733
+ tokenizePlaceholders: {
734
+ value: function (env, language) {
735
+ if (env.language !== language || !env.tokenStack) {
736
+ return;
877
737
  }
878
- var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
879
- var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));
880
- var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);
881
- var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);
882
- var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
883
- var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
884
- var name = /@?\b[A-Za-z_]\w*\b/.source;
885
- var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [
886
- name,
887
- generic
888
- ]);
889
- var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [
890
- nonTypeKeywords,
891
- genericName
892
- ]);
893
- var array = /\[\s*(?:,\s*)*\]/.source;
894
- var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [
895
- identifier,
896
- array
897
- ]);
898
- var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [
899
- generic,
900
- nestedRound,
901
- array
902
- ]);
903
- var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
904
- var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [
905
- tuple,
906
- identifier,
907
- array
908
- ]);
909
- var typeInside = {
910
- 'keyword': keywords,
911
- 'punctuation': /[<>()?,.:[\]]/
912
- };
913
- var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
914
- var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
915
- var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
916
- Prism.languages.csharp = Prism.languages.extend('clike', {
917
- 'string': [
918
- {
919
- pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
920
- lookbehind: true,
921
- greedy: true
922
- },
923
- {
924
- pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
925
- lookbehind: true,
926
- greedy: true
927
- },
928
- {
929
- pattern: RegExp(character),
930
- greedy: true,
931
- alias: 'character'
738
+ env.grammar = Prism.languages[language];
739
+ var j = 0;
740
+ var keys = Object.keys(env.tokenStack);
741
+ function walkTokens(tokens) {
742
+ for (var i = 0; i < tokens.length; i++) {
743
+ if (j >= keys.length) {
744
+ break;
932
745
  }
933
- ],
934
- 'class-name': [
935
- {
936
- pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
937
- lookbehind: true,
938
- inside: typeInside
939
- },
940
- {
941
- pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [
942
- name,
943
- typeExpression
944
- ]),
945
- lookbehind: true,
946
- inside: typeInside
947
- },
948
- {
949
- pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
950
- lookbehind: true
951
- },
952
- {
953
- pattern: re(/(\b<<0>>\s+)<<1>>/.source, [
954
- typeDeclarationKeywords,
955
- genericName
956
- ]),
957
- lookbehind: true,
958
- inside: typeInside
959
- },
960
- {
961
- pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
962
- lookbehind: true,
963
- inside: typeInside
964
- },
965
- {
966
- pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
967
- lookbehind: true
968
- },
969
- {
970
- pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
971
- lookbehind: true,
972
- inside: typeInside
973
- },
974
- {
975
- pattern: re(/\b<<0>>(?=\s+(?!<<1>>)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [
976
- typeExpression,
977
- nonContextualKeywords,
978
- name
979
- ]),
980
- inside: typeInside
746
+ var token = tokens[i];
747
+ if (typeof token === 'string' || token.content && typeof token.content === 'string') {
748
+ var k = keys[j];
749
+ var t = env.tokenStack[k];
750
+ var s = typeof token === 'string' ? token : token.content;
751
+ var placeholder = getPlaceholder(language, k);
752
+ var index = s.indexOf(placeholder);
753
+ if (index > -1) {
754
+ ++j;
755
+ var before = s.substring(0, index);
756
+ var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
757
+ var after = s.substring(index + placeholder.length);
758
+ var replacement = [];
759
+ if (before) {
760
+ replacement.push.apply(replacement, walkTokens([before]));
761
+ }
762
+ replacement.push(middle);
763
+ if (after) {
764
+ replacement.push.apply(replacement, walkTokens([after]));
765
+ }
766
+ if (typeof token === 'string') {
767
+ tokens.splice.apply(tokens, [
768
+ i,
769
+ 1
770
+ ].concat(replacement));
771
+ } else {
772
+ token.content = replacement;
773
+ }
774
+ }
775
+ } else if (token.content) {
776
+ walkTokens(token.content);
981
777
  }
982
- ],
983
- 'keyword': keywords,
984
- 'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:ul|lu|[dflmu])?\b/i,
985
- 'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
986
- 'punctuation': /\?\.?|::|[{}[\];(),.:]/
987
- });
988
- Prism.languages.insertBefore('csharp', 'number', {
989
- 'range': {
990
- pattern: /\.\./,
991
- alias: 'operator'
992
- }
993
- });
994
- Prism.languages.insertBefore('csharp', 'punctuation', {
995
- 'named-parameter': {
996
- pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
997
- lookbehind: true,
998
- alias: 'punctuation'
999
778
  }
1000
- });
1001
- Prism.languages.insertBefore('csharp', 'class-name', {
1002
- 'namespace': {
1003
- pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
1004
- lookbehind: true,
1005
- inside: { 'punctuation': /\./ }
1006
- },
1007
- 'type-expression': {
1008
- pattern: re(/(\b(?:default|typeof|sizeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
1009
- lookbehind: true,
1010
- alias: 'class-name',
1011
- inside: typeInside
1012
- },
1013
- 'return-type': {
1014
- pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [
1015
- typeExpression,
1016
- identifier
1017
- ]),
1018
- inside: typeInside,
1019
- alias: 'class-name'
1020
- },
1021
- 'constructor-invocation': {
1022
- pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
1023
- lookbehind: true,
1024
- inside: typeInside,
1025
- alias: 'class-name'
1026
- },
1027
- 'generic-method': {
1028
- pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [
1029
- name,
1030
- generic
1031
- ]),
1032
- inside: {
1033
- 'function': re(/^<<0>>/.source, [name]),
1034
- 'generic': {
1035
- pattern: RegExp(generic),
1036
- alias: 'class-name',
1037
- inside: typeInside
1038
- }
1039
- }
1040
- },
1041
- 'type-list': {
1042
- pattern: re(/\b((?:<<0>>\s+<<1>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>)(?:\s*,\s*(?:<<3>>|<<4>>))*(?=\s*(?:where|[{;]|=>|$))/.source, [
1043
- typeDeclarationKeywords,
1044
- genericName,
1045
- name,
1046
- typeExpression,
1047
- keywords.source
1048
- ]),
1049
- lookbehind: true,
1050
- inside: {
1051
- 'keyword': keywords,
1052
- 'class-name': {
1053
- pattern: RegExp(typeExpression),
1054
- greedy: true,
1055
- inside: typeInside
1056
- },
1057
- 'punctuation': /,/
1058
- }
1059
- },
1060
- 'preprocessor': {
1061
- pattern: /(^\s*)#.*/m,
1062
- lookbehind: true,
1063
- alias: 'property',
1064
- inside: {
1065
- 'directive': {
1066
- pattern: /(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/,
1067
- lookbehind: true,
1068
- alias: 'keyword'
1069
- }
1070
- }
1071
- }
1072
- });
1073
- var regularStringOrCharacter = regularString + '|' + character;
1074
- var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
1075
- var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
1076
- var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
1077
- var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [
1078
- identifier,
1079
- roundExpression
1080
- ]);
1081
- Prism.languages.insertBefore('csharp', 'class-name', {
1082
- 'attribute': {
1083
- pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [
1084
- attrTarget,
1085
- attr
1086
- ]),
1087
- lookbehind: true,
1088
- greedy: true,
1089
- inside: {
1090
- 'target': {
1091
- pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
1092
- alias: 'keyword'
1093
- },
1094
- 'attribute-arguments': {
1095
- pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
1096
- inside: Prism.languages.csharp
1097
- },
1098
- 'class-name': {
1099
- pattern: RegExp(identifier),
1100
- inside: { 'punctuation': /\./ }
1101
- },
1102
- 'punctuation': /[:,]/
1103
- }
1104
- }
1105
- });
1106
- var formatString = /:[^}\r\n]+/.source;
1107
- var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
1108
- var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [
1109
- mInterpolationRound,
1110
- formatString
1111
- ]);
1112
- var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
1113
- var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [
1114
- sInterpolationRound,
1115
- formatString
1116
- ]);
1117
- function createInterpolationInside(interpolation, interpolationRound) {
1118
- return {
1119
- 'interpolation': {
1120
- pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
1121
- lookbehind: true,
1122
- inside: {
1123
- 'format-string': {
1124
- pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [
1125
- interpolationRound,
1126
- formatString
1127
- ]),
1128
- lookbehind: true,
1129
- inside: { 'punctuation': /^:/ }
1130
- },
1131
- 'punctuation': /^\{|\}$/,
1132
- 'expression': {
1133
- pattern: /[\s\S]+/,
1134
- alias: 'language-csharp',
1135
- inside: Prism.languages.csharp
1136
- }
1137
- }
1138
- },
1139
- 'string': /[\s\S]+/
1140
- };
779
+ return tokens;
1141
780
  }
1142
- Prism.languages.insertBefore('csharp', 'string', {
1143
- 'interpolation-string': [
1144
- {
1145
- pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
1146
- lookbehind: true,
1147
- greedy: true,
1148
- inside: createInterpolationInside(mInterpolation, mInterpolationRound)
1149
- },
1150
- {
1151
- pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
1152
- lookbehind: true,
1153
- greedy: true,
1154
- inside: createInterpolationInside(sInterpolation, sInterpolationRound)
1155
- }
1156
- ]
1157
- });
1158
- }(Prism));
1159
- Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
1160
- },
1161
- {}
1162
- ],
1163
- 6: [
1164
- function (require, module, exports) {
1165
- (function (Prism) {
1166
- var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
1167
- Prism.languages.css = {
1168
- 'comment': /\/\*[\s\S]*?\*\//,
1169
- 'atrule': {
1170
- pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
1171
- inside: {
1172
- 'rule': /^@[\w-]+/,
1173
- 'selector-function-argument': {
1174
- pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1175
- lookbehind: true,
1176
- alias: 'selector'
1177
- },
1178
- 'keyword': {
1179
- pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1180
- lookbehind: true
1181
- }
1182
- }
1183
- },
1184
- 'url': {
1185
- pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1186
- greedy: true,
1187
- inside: {
1188
- 'function': /^url/i,
1189
- 'punctuation': /^\(|\)$/,
1190
- 'string': {
1191
- pattern: RegExp('^' + string.source + '$'),
1192
- alias: 'url'
1193
- }
1194
- }
1195
- },
1196
- 'selector': RegExp('[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1197
- 'string': {
1198
- pattern: string,
1199
- greedy: true
1200
- },
1201
- 'property': /(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1202
- 'important': /!important\b/i,
1203
- 'function': /[-a-z0-9]+(?=\()/i,
1204
- 'punctuation': /[(){};:,]/
1205
- };
1206
- Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1207
- var markup = Prism.languages.markup;
1208
- if (markup) {
1209
- markup.tag.addInlined('style', 'css');
1210
- Prism.languages.insertBefore('inside', 'attr-value', {
1211
- 'style-attr': {
1212
- pattern: /(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,
1213
- lookbehind: true,
1214
- inside: {
1215
- 'attr-value': {
1216
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1217
- inside: {
1218
- 'style': {
1219
- pattern: /(["'])[\s\S]+(?=["']$)/,
1220
- lookbehind: true,
1221
- alias: 'language-css',
1222
- inside: Prism.languages.css
1223
- },
1224
- 'punctuation': [
1225
- {
1226
- pattern: /^=/,
1227
- alias: 'attr-equals'
1228
- },
1229
- /"|'/
1230
- ]
1231
- }
1232
- },
1233
- 'attr-name': /^style/i
1234
- }
1235
- }
1236
- }, markup.tag);
1237
- }
1238
- }(Prism));
1239
- },
1240
- {}
1241
- ],
1242
- 7: [
1243
- function (require, module, exports) {
1244
- (function (Prism) {
1245
- var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
1246
- var classNamePrefix = /(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
1247
- var className = {
1248
- pattern: RegExp(classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1249
- lookbehind: true,
1250
- inside: {
1251
- 'namespace': {
1252
- pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
1253
- inside: { 'punctuation': /\./ }
1254
- },
1255
- 'punctuation': /\./
1256
- }
1257
- };
1258
- Prism.languages.java = Prism.languages.extend('clike', {
1259
- 'class-name': [
1260
- className,
1261
- {
1262
- pattern: RegExp(classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=())])/.source),
1263
- lookbehind: true,
1264
- inside: className.inside
1265
- }
1266
- ],
1267
- 'keyword': keywords,
1268
- 'function': [
1269
- Prism.languages.clike.function,
1270
- {
1271
- pattern: /(\:\:\s*)[a-z_]\w*/,
1272
- lookbehind: true
1273
- }
1274
- ],
1275
- 'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
1276
- 'operator': {
1277
- pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
1278
- lookbehind: true
1279
- }
1280
- });
1281
- Prism.languages.insertBefore('java', 'string', {
1282
- 'triple-quoted-string': {
1283
- pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
1284
- greedy: true,
1285
- alias: 'string'
1286
- }
1287
- });
1288
- Prism.languages.insertBefore('java', 'class-name', {
1289
- 'annotation': {
1290
- pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
1291
- lookbehind: true,
1292
- alias: 'punctuation'
1293
- },
1294
- 'generics': {
1295
- pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,
1296
- inside: {
1297
- 'class-name': className,
1298
- 'keyword': keywords,
1299
- 'punctuation': /[<>(),.:]/,
1300
- 'operator': /[?&|]/
1301
- }
1302
- },
1303
- 'namespace': {
1304
- pattern: RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function () {
1305
- return keywords.source;
1306
- })),
1307
- lookbehind: true,
1308
- inside: { 'punctuation': /\./ }
1309
- }
1310
- });
1311
- }(Prism));
1312
- },
1313
- {}
1314
- ],
1315
- 8: [
1316
- function (require, module, exports) {
1317
- Prism.languages.javascript = Prism.languages.extend('clike', {
1318
- 'class-name': [
1319
- Prism.languages.clike['class-name'],
1320
- {
1321
- pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,
1322
- lookbehind: true
1323
- }
1324
- ],
1325
- 'keyword': [
1326
- {
1327
- pattern: /((?:^|})\s*)(?:catch|finally)\b/,
1328
- lookbehind: true
1329
- },
1330
- {
1331
- pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1332
- lookbehind: true
1333
- }
1334
- ],
1335
- 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1336
- 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
1337
- 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1338
- });
1339
- Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
1340
- Prism.languages.insertBefore('javascript', 'keyword', {
1341
- 'regex': {
1342
- pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,
1343
- lookbehind: true,
1344
- greedy: true,
1345
- inside: {
1346
- 'regex-source': {
1347
- pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1348
- lookbehind: true,
1349
- alias: 'language-regex',
1350
- inside: Prism.languages.regex
1351
- },
1352
- 'regex-flags': /[a-z]+$/,
1353
- 'regex-delimiter': /^\/|\/$/
1354
- }
781
+ walkTokens(env.tokens);
782
+ }
783
+ }
784
+ });
785
+ }(Prism));
786
+ Prism.languages.c = Prism.languages.extend('clike', {
787
+ 'comment': {
788
+ pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
789
+ greedy: true
790
+ },
791
+ 'class-name': {
792
+ pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
793
+ lookbehind: true
794
+ },
795
+ 'keyword': /\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
796
+ 'function': /\b[a-z_]\w*(?=\s*\()/i,
797
+ 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
798
+ 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
799
+ });
800
+ Prism.languages.insertBefore('c', 'string', {
801
+ 'macro': {
802
+ pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
803
+ lookbehind: true,
804
+ greedy: true,
805
+ alias: 'property',
806
+ inside: {
807
+ 'string': [
808
+ {
809
+ pattern: /^(#\s*include\s*)<[^>]+>/,
810
+ lookbehind: true
1355
811
  },
1356
- 'function-variable': {
1357
- pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1358
- alias: 'function'
812
+ Prism.languages.c['string']
813
+ ],
814
+ 'comment': Prism.languages.c['comment'],
815
+ 'macro-name': [
816
+ {
817
+ pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
818
+ lookbehind: true
1359
819
  },
1360
- 'parameter': [
1361
- {
1362
- pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1363
- lookbehind: true,
1364
- inside: Prism.languages.javascript
1365
- },
1366
- {
1367
- pattern: /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1368
- inside: Prism.languages.javascript
1369
- },
1370
- {
1371
- pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1372
- lookbehind: true,
1373
- inside: Prism.languages.javascript
1374
- },
1375
- {
1376
- pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1377
- lookbehind: true,
1378
- inside: Prism.languages.javascript
1379
- }
1380
- ],
1381
- 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1382
- });
1383
- Prism.languages.insertBefore('javascript', 'string', {
1384
- 'template-string': {
1385
- pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,
1386
- greedy: true,
1387
- inside: {
1388
- 'template-punctuation': {
1389
- pattern: /^`|`$/,
1390
- alias: 'string'
1391
- },
1392
- 'interpolation': {
1393
- pattern: /((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,
1394
- lookbehind: true,
1395
- inside: {
1396
- 'interpolation-punctuation': {
1397
- pattern: /^\${|}$/,
1398
- alias: 'punctuation'
1399
- },
1400
- rest: Prism.languages.javascript
1401
- }
1402
- },
1403
- 'string': /[\s\S]+/
1404
- }
820
+ {
821
+ pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
822
+ lookbehind: true,
823
+ alias: 'function'
1405
824
  }
1406
- });
1407
- if (Prism.languages.markup) {
1408
- Prism.languages.markup.tag.addInlined('script', 'javascript');
825
+ ],
826
+ 'directive': {
827
+ pattern: /^(#\s*)[a-z]+/,
828
+ lookbehind: true,
829
+ alias: 'keyword'
830
+ },
831
+ 'directive-hash': /^#/,
832
+ 'punctuation': /##|\\(?=[\r\n])/,
833
+ 'expression': {
834
+ pattern: /\S[\s\S]*/,
835
+ inside: Prism.languages.c
1409
836
  }
1410
- Prism.languages.js = Prism.languages.javascript;
837
+ }
838
+ },
839
+ 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
840
+ });
841
+ delete Prism.languages.c['boolean'];
842
+ (function (Prism) {
843
+ var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
844
+ var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function () {
845
+ return keyword.source;
846
+ });
847
+ Prism.languages.cpp = Prism.languages.extend('c', {
848
+ 'class-name': [
849
+ {
850
+ pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function () {
851
+ return keyword.source;
852
+ })),
853
+ lookbehind: true
854
+ },
855
+ /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
856
+ /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
857
+ /\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
858
+ ],
859
+ 'keyword': keyword,
860
+ 'number': {
861
+ pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
862
+ greedy: true
1411
863
  },
1412
- {}
1413
- ],
1414
- 9: [
1415
- function (require, module, exports) {
1416
- (function (Prism) {
1417
- function getPlaceholder(language, index) {
1418
- return '___' + language.toUpperCase() + index + '___';
1419
- }
1420
- Object.defineProperties(Prism.languages['markup-templating'] = {}, {
1421
- buildPlaceholders: {
1422
- value: function (env, language, placeholderPattern, replaceFilter) {
1423
- if (env.language !== language) {
1424
- return;
1425
- }
1426
- var tokenStack = env.tokenStack = [];
1427
- env.code = env.code.replace(placeholderPattern, function (match) {
1428
- if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
1429
- return match;
1430
- }
1431
- var i = tokenStack.length;
1432
- var placeholder;
1433
- while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1)
1434
- ++i;
1435
- tokenStack[i] = match;
1436
- return placeholder;
1437
- });
1438
- env.grammar = Prism.languages.markup;
1439
- }
1440
- },
1441
- tokenizePlaceholders: {
1442
- value: function (env, language) {
1443
- if (env.language !== language || !env.tokenStack) {
1444
- return;
1445
- }
1446
- env.grammar = Prism.languages[language];
1447
- var j = 0;
1448
- var keys = Object.keys(env.tokenStack);
1449
- function walkTokens(tokens) {
1450
- for (var i = 0; i < tokens.length; i++) {
1451
- if (j >= keys.length) {
1452
- break;
1453
- }
1454
- var token = tokens[i];
1455
- if (typeof token === 'string' || token.content && typeof token.content === 'string') {
1456
- var k = keys[j];
1457
- var t = env.tokenStack[k];
1458
- var s = typeof token === 'string' ? token : token.content;
1459
- var placeholder = getPlaceholder(language, k);
1460
- var index = s.indexOf(placeholder);
1461
- if (index > -1) {
1462
- ++j;
1463
- var before = s.substring(0, index);
1464
- var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
1465
- var after = s.substring(index + placeholder.length);
1466
- var replacement = [];
1467
- if (before) {
1468
- replacement.push.apply(replacement, walkTokens([before]));
1469
- }
1470
- replacement.push(middle);
1471
- if (after) {
1472
- replacement.push.apply(replacement, walkTokens([after]));
1473
- }
1474
- if (typeof token === 'string') {
1475
- tokens.splice.apply(tokens, [
1476
- i,
1477
- 1
1478
- ].concat(replacement));
1479
- } else {
1480
- token.content = replacement;
1481
- }
1482
- }
1483
- } else if (token.content) {
1484
- walkTokens(token.content);
1485
- }
1486
- }
1487
- return tokens;
1488
- }
1489
- walkTokens(env.tokens);
1490
- }
1491
- }
1492
- });
1493
- }(Prism));
864
+ 'operator': />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
865
+ 'boolean': /\b(?:true|false)\b/
866
+ });
867
+ Prism.languages.insertBefore('cpp', 'string', {
868
+ 'module': {
869
+ pattern: RegExp(/(\b(?:module|import)\s+)/.source + '(?:' + /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source + '|' + /<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function () {
870
+ return modName;
871
+ }) + ')'),
872
+ lookbehind: true,
873
+ greedy: true,
874
+ inside: {
875
+ 'string': /^[<"][\s\S]+/,
876
+ 'operator': /:/,
877
+ 'punctuation': /\./
878
+ }
1494
879
  },
1495
- {}
1496
- ],
1497
- 10: [
1498
- function (require, module, exports) {
1499
- Prism.languages.markup = {
1500
- 'comment': /<!--[\s\S]*?-->/,
1501
- 'prolog': /<\?[\s\S]+?\?>/,
1502
- 'doctype': {
1503
- pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1504
- greedy: true,
1505
- inside: {
1506
- 'internal-subset': {
1507
- pattern: /(\[)[\s\S]+(?=\]>$)/,
1508
- lookbehind: true,
1509
- greedy: true,
1510
- inside: null
1511
- },
1512
- 'string': {
1513
- pattern: /"[^"]*"|'[^']*'/,
1514
- greedy: true
1515
- },
1516
- 'punctuation': /^<!|>$|[[\]]/,
1517
- 'doctype-tag': /^DOCTYPE/,
1518
- 'name': /[^\s<>'"]+/
1519
- }
1520
- },
1521
- 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
1522
- 'tag': {
1523
- pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1524
- greedy: true,
1525
- inside: {
1526
- 'tag': {
1527
- pattern: /^<\/?[^\s>\/]+/,
1528
- inside: {
1529
- 'punctuation': /^<\/?/,
1530
- 'namespace': /^[^\s>\/:]+:/
1531
- }
1532
- },
1533
- 'attr-value': {
1534
- pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1535
- inside: {
1536
- 'punctuation': [
1537
- {
1538
- pattern: /^=/,
1539
- alias: 'attr-equals'
1540
- },
1541
- /"|'/
1542
- ]
1543
- }
1544
- },
1545
- 'punctuation': /\/?>/,
1546
- 'attr-name': {
1547
- pattern: /[^\s>\/]+/,
1548
- inside: { 'namespace': /^[^\s>\/:]+:/ }
1549
- }
1550
- }
1551
- },
1552
- 'entity': [
1553
- {
1554
- pattern: /&[\da-z]{1,8};/i,
1555
- alias: 'named-entity'
1556
- },
1557
- /&#x?[\da-f]{1,8};/i
1558
- ]
1559
- };
1560
- Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];
1561
- Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1562
- Prism.hooks.add('wrap', function (env) {
1563
- if (env.type === 'entity') {
1564
- env.attributes['title'] = env.content.replace(/&amp;/, '&');
1565
- }
1566
- });
1567
- Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1568
- value: function addInlined(tagName, lang) {
1569
- var includedCdataInside = {};
1570
- includedCdataInside['language-' + lang] = {
1571
- pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1572
- lookbehind: true,
1573
- inside: Prism.languages[lang]
1574
- };
1575
- includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1576
- var inside = {
1577
- 'included-cdata': {
1578
- pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1579
- inside: includedCdataInside
1580
- }
1581
- };
1582
- inside['language-' + lang] = {
1583
- pattern: /[\s\S]+/,
1584
- inside: Prism.languages[lang]
1585
- };
1586
- var def = {};
1587
- def[tagName] = {
1588
- pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
1589
- return tagName;
1590
- }), 'i'),
1591
- lookbehind: true,
1592
- greedy: true,
1593
- inside: inside
1594
- };
1595
- Prism.languages.insertBefore('markup', 'cdata', def);
880
+ 'raw-string': {
881
+ pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
882
+ alias: 'string',
883
+ greedy: true
884
+ }
885
+ });
886
+ Prism.languages.insertBefore('cpp', 'keyword', {
887
+ 'generic-function': {
888
+ pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
889
+ inside: {
890
+ 'function': /^\w+/,
891
+ 'generic': {
892
+ pattern: /<[\s\S]+/,
893
+ alias: 'class-name',
894
+ inside: Prism.languages.cpp
1596
895
  }
896
+ }
897
+ }
898
+ });
899
+ Prism.languages.insertBefore('cpp', 'operator', {
900
+ 'double-colon': {
901
+ pattern: /::/,
902
+ alias: 'punctuation'
903
+ }
904
+ });
905
+ Prism.languages.insertBefore('cpp', 'class-name', {
906
+ 'base-clause': {
907
+ pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
908
+ lookbehind: true,
909
+ greedy: true,
910
+ inside: Prism.languages.extend('cpp', {})
911
+ }
912
+ });
913
+ Prism.languages.insertBefore('inside', 'double-colon', { 'class-name': /\b[a-z_]\w*\b(?!\s*::)/i }, Prism.languages.cpp['base-clause']);
914
+ }(Prism));
915
+ (function (Prism) {
916
+ function replace(pattern, replacements) {
917
+ return pattern.replace(/<<(\d+)>>/g, function (m, index) {
918
+ return '(?:' + replacements[+index] + ')';
919
+ });
920
+ }
921
+ function re(pattern, replacements, flags) {
922
+ return RegExp(replace(pattern, replacements), flags || '');
923
+ }
924
+ function nested(pattern, depthLog2) {
925
+ for (var i = 0; i < depthLog2; i++) {
926
+ pattern = pattern.replace(/<<self>>/g, function () {
927
+ return '(?:' + pattern + ')';
1597
928
  });
1598
- Prism.languages.html = Prism.languages.markup;
1599
- Prism.languages.mathml = Prism.languages.markup;
1600
- Prism.languages.svg = Prism.languages.markup;
1601
- Prism.languages.xml = Prism.languages.extend('markup', {});
1602
- Prism.languages.ssml = Prism.languages.xml;
1603
- Prism.languages.atom = Prism.languages.xml;
1604
- Prism.languages.rss = Prism.languages.xml;
1605
- },
1606
- {}
1607
- ],
1608
- 11: [
1609
- function (require, module, exports) {
1610
- (function (Prism) {
1611
- var comment = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/;
1612
- var constant = [
1613
- {
1614
- pattern: /\b(?:false|true)\b/i,
1615
- alias: 'boolean'
1616
- },
1617
- /\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/,
1618
- /\b(?:null)\b/i
1619
- ];
1620
- var number = /\b0b[01]+\b|\b0x[\da-f]+\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+)(?:e[+-]?\d+)?/i;
1621
- var operator = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;
1622
- var punctuation = /[{}\[\](),:;]/;
1623
- Prism.languages.php = {
1624
- 'delimiter': {
1625
- pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
1626
- alias: 'important'
1627
- },
1628
- 'comment': comment,
1629
- 'variable': /\$+(?:\w+\b|(?={))/i,
1630
- 'package': {
1631
- pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1632
- lookbehind: true,
1633
- inside: { 'punctuation': /\\/ }
1634
- },
1635
- 'keyword': [
1636
- {
1637
- pattern: /(\(\s*)\b(?:bool|boolean|int|integer|float|string|object|array)\b(?=\s*\))/i,
1638
- alias: 'type-casting',
1639
- greedy: true,
1640
- lookbehind: true
1641
- },
1642
- {
1643
- pattern: /([(,?]\s*)\b(?:bool|int|float|string|object|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b(?=\s*\$)/i,
1644
- alias: 'type-hint',
1645
- greedy: true,
1646
- lookbehind: true
1647
- },
1648
- {
1649
- pattern: /([(,?]\s*[a-z0-9_|]\|\s*)(?:null|false)\b(?=\s*\$)/i,
1650
- alias: 'type-hint',
1651
- greedy: true,
1652
- lookbehind: true
1653
- },
1654
- {
1655
- pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b/i,
1656
- alias: 'return-type',
1657
- greedy: true,
1658
- lookbehind: true
1659
- },
1660
- {
1661
- pattern: /(\)\s*:\s*(?:\?\s*)?[a-z0-9_|]\|\s*)(?:null|false)\b/i,
1662
- alias: 'return-type',
1663
- greedy: true,
1664
- lookbehind: true
1665
- },
1666
- {
1667
- pattern: /\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|iterable|(?:null|false)(?=\s*\|))\b/i,
1668
- alias: 'type-declaration',
1669
- greedy: true
1670
- },
1671
- {
1672
- pattern: /(\|\s*)(?:null|false)\b/i,
1673
- alias: 'type-declaration',
1674
- greedy: true,
1675
- lookbehind: true
1676
- },
1677
- {
1678
- pattern: /\b(?:parent|self|static)(?=\s*::)/i,
1679
- alias: 'static-context',
1680
- greedy: true
1681
- },
1682
- /\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|match|new|or|parent|print|private|protected|public|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i
1683
- ],
1684
- 'argument-name': /\b[a-z_]\w*(?=\s*:(?!:))/i,
1685
- 'class-name': [
1686
- {
1687
- pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
1688
- greedy: true,
1689
- lookbehind: true
1690
- },
1691
- {
1692
- pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
1693
- greedy: true,
1694
- lookbehind: true
1695
- },
1696
- {
1697
- pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
1698
- greedy: true
1699
- },
1700
- {
1701
- pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
1702
- alias: 'class-name-fully-qualified',
1703
- greedy: true,
1704
- lookbehind: true,
1705
- inside: { 'punctuation': /\\/ }
1706
- },
1707
- {
1708
- pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
1709
- alias: 'class-name-fully-qualified',
1710
- greedy: true,
1711
- inside: { 'punctuation': /\\/ }
1712
- },
1713
- {
1714
- pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1715
- alias: 'class-name-fully-qualified',
1716
- greedy: true,
1717
- lookbehind: true,
1718
- inside: { 'punctuation': /\\/ }
1719
- },
1720
- {
1721
- pattern: /\b[a-z_]\w*(?=\s*\$)/i,
1722
- alias: 'type-declaration',
1723
- greedy: true
1724
- },
1725
- {
1726
- pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
1727
- alias: [
1728
- 'class-name-fully-qualified',
1729
- 'type-declaration'
1730
- ],
1731
- greedy: true,
1732
- inside: { 'punctuation': /\\/ }
1733
- },
1734
- {
1735
- pattern: /\b[a-z_]\w*(?=\s*::)/i,
1736
- alias: 'static-context',
1737
- greedy: true
1738
- },
1739
- {
1740
- pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
1741
- alias: [
1742
- 'class-name-fully-qualified',
1743
- 'static-context'
1744
- ],
1745
- greedy: true,
1746
- inside: { 'punctuation': /\\/ }
1747
- },
1748
- {
1749
- pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
1750
- alias: 'type-hint',
1751
- greedy: true,
1752
- lookbehind: true
1753
- },
1754
- {
1755
- pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
1756
- alias: [
1757
- 'class-name-fully-qualified',
1758
- 'type-hint'
1759
- ],
1760
- greedy: true,
1761
- lookbehind: true,
1762
- inside: { 'punctuation': /\\/ }
1763
- },
1764
- {
1765
- pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
1766
- alias: 'return-type',
1767
- greedy: true,
1768
- lookbehind: true
1769
- },
1770
- {
1771
- pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1772
- alias: [
1773
- 'class-name-fully-qualified',
1774
- 'return-type'
1775
- ],
1776
- greedy: true,
1777
- lookbehind: true,
1778
- inside: { 'punctuation': /\\/ }
1779
- }
1780
- ],
1781
- 'constant': constant,
1782
- 'function': /\w+\s*(?=\()/,
1783
- 'property': {
1784
- pattern: /(->)[\w]+/,
1785
- lookbehind: true
1786
- },
1787
- 'number': number,
1788
- 'operator': operator,
1789
- 'punctuation': punctuation
1790
- };
1791
- var string_interpolation = {
1792
- pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)*)/,
1793
- lookbehind: true,
1794
- inside: Prism.languages.php
1795
- };
1796
- var string = [
1797
- {
1798
- pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
1799
- alias: 'nowdoc-string',
1800
- greedy: true,
1801
- inside: {
1802
- 'delimiter': {
1803
- pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
1804
- alias: 'symbol',
1805
- inside: { 'punctuation': /^<<<'?|[';]$/ }
1806
- }
1807
- }
1808
- },
1809
- {
1810
- pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
1811
- alias: 'heredoc-string',
1812
- greedy: true,
1813
- inside: {
1814
- 'delimiter': {
1815
- pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
1816
- alias: 'symbol',
1817
- inside: { 'punctuation': /^<<<"?|[";]$/ }
1818
- },
1819
- 'interpolation': string_interpolation
1820
- }
1821
- },
1822
- {
1823
- pattern: /`(?:\\[\s\S]|[^\\`])*`/,
1824
- alias: 'backtick-quoted-string',
1825
- greedy: true
1826
- },
1827
- {
1828
- pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1829
- alias: 'single-quoted-string',
1830
- greedy: true
1831
- },
1832
- {
1833
- pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1834
- alias: 'double-quoted-string',
1835
- greedy: true,
1836
- inside: { 'interpolation': string_interpolation }
1837
- }
1838
- ];
1839
- Prism.languages.insertBefore('php', 'variable', { 'string': string });
1840
- Prism.languages.insertBefore('php', 'variable', {
1841
- 'attribute': {
1842
- pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/mi,
1843
- greedy: true,
1844
- inside: {
1845
- 'attribute-content': {
1846
- pattern: /^(#\[)[\s\S]+(?=]$)/,
1847
- lookbehind: true,
1848
- inside: {
1849
- 'comment': comment,
1850
- 'string': string,
1851
- 'attribute-class-name': [
1852
- {
1853
- pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
1854
- alias: 'class-name',
1855
- greedy: true,
1856
- lookbehind: true
1857
- },
1858
- {
1859
- pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
1860
- alias: [
1861
- 'class-name',
1862
- 'class-name-fully-qualified'
1863
- ],
1864
- greedy: true,
1865
- lookbehind: true,
1866
- inside: { 'punctuation': /\\/ }
1867
- }
1868
- ],
1869
- 'constant': constant,
1870
- 'number': number,
1871
- 'operator': operator,
1872
- 'punctuation': punctuation
1873
- }
1874
- },
1875
- 'delimiter': {
1876
- pattern: /^#\[|]$/,
1877
- alias: 'punctuation'
1878
- }
1879
- }
1880
- }
1881
- });
1882
- Prism.hooks.add('before-tokenize', function (env) {
1883
- if (!/<\?/.test(env.code)) {
1884
- return;
1885
- }
1886
- var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/ig;
1887
- Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
1888
- });
1889
- Prism.hooks.add('after-tokenize', function (env) {
1890
- Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
1891
- });
1892
- }(Prism));
929
+ }
930
+ return pattern.replace(/<<self>>/g, '[^\\s\\S]');
931
+ }
932
+ var keywordKinds = {
933
+ type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',
934
+ typeDeclaration: 'class enum interface record struct',
935
+ contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)',
936
+ other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
937
+ };
938
+ function keywordsToPattern(words) {
939
+ return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
940
+ }
941
+ var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
942
+ var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));
943
+ var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);
944
+ var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);
945
+ var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2);
946
+ var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
947
+ var name = /@?\b[A-Za-z_]\w*\b/.source;
948
+ var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [
949
+ name,
950
+ generic
951
+ ]);
952
+ var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [
953
+ nonTypeKeywords,
954
+ genericName
955
+ ]);
956
+ var array = /\[\s*(?:,\s*)*\]/.source;
957
+ var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [
958
+ identifier,
959
+ array
960
+ ]);
961
+ var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [
962
+ generic,
963
+ nestedRound,
964
+ array
965
+ ]);
966
+ var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
967
+ var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [
968
+ tuple,
969
+ identifier,
970
+ array
971
+ ]);
972
+ var typeInside = {
973
+ 'keyword': keywords,
974
+ 'punctuation': /[<>()?,.:[\]]/
975
+ };
976
+ var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source;
977
+ var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
978
+ var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
979
+ Prism.languages.csharp = Prism.languages.extend('clike', {
980
+ 'string': [
981
+ {
982
+ pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
983
+ lookbehind: true,
984
+ greedy: true
985
+ },
986
+ {
987
+ pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
988
+ lookbehind: true,
989
+ greedy: true
990
+ },
991
+ {
992
+ pattern: RegExp(character),
993
+ greedy: true,
994
+ alias: 'character'
995
+ }
996
+ ],
997
+ 'class-name': [
998
+ {
999
+ pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
1000
+ lookbehind: true,
1001
+ inside: typeInside
1002
+ },
1003
+ {
1004
+ pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [
1005
+ name,
1006
+ typeExpression
1007
+ ]),
1008
+ lookbehind: true,
1009
+ inside: typeInside
1010
+ },
1011
+ {
1012
+ pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
1013
+ lookbehind: true
1014
+ },
1015
+ {
1016
+ pattern: re(/(\b<<0>>\s+)<<1>>/.source, [
1017
+ typeDeclarationKeywords,
1018
+ genericName
1019
+ ]),
1020
+ lookbehind: true,
1021
+ inside: typeInside
1022
+ },
1023
+ {
1024
+ pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
1025
+ lookbehind: true,
1026
+ inside: typeInside
1027
+ },
1028
+ {
1029
+ pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
1030
+ lookbehind: true
1031
+ },
1032
+ {
1033
+ pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
1034
+ lookbehind: true,
1035
+ inside: typeInside
1036
+ },
1037
+ {
1038
+ pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [
1039
+ typeExpression,
1040
+ nonContextualKeywords,
1041
+ name
1042
+ ]),
1043
+ inside: typeInside
1044
+ }
1045
+ ],
1046
+ 'keyword': keywords,
1047
+ 'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:ul|lu|[dflmu])?\b/i,
1048
+ 'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
1049
+ 'punctuation': /\?\.?|::|[{}[\];(),.:]/
1050
+ });
1051
+ Prism.languages.insertBefore('csharp', 'number', {
1052
+ 'range': {
1053
+ pattern: /\.\./,
1054
+ alias: 'operator'
1055
+ }
1056
+ });
1057
+ Prism.languages.insertBefore('csharp', 'punctuation', {
1058
+ 'named-parameter': {
1059
+ pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
1060
+ lookbehind: true,
1061
+ alias: 'punctuation'
1062
+ }
1063
+ });
1064
+ Prism.languages.insertBefore('csharp', 'class-name', {
1065
+ 'namespace': {
1066
+ pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
1067
+ lookbehind: true,
1068
+ inside: { 'punctuation': /\./ }
1893
1069
  },
1894
- {}
1895
- ],
1896
- 12: [
1897
- function (require, module, exports) {
1898
- Prism.languages.python = {
1899
- 'comment': {
1900
- pattern: /(^|[^\\])#.*/,
1901
- lookbehind: true
1902
- },
1903
- 'string-interpolation': {
1904
- pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1070
+ 'type-expression': {
1071
+ pattern: re(/(\b(?:default|typeof|sizeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
1072
+ lookbehind: true,
1073
+ alias: 'class-name',
1074
+ inside: typeInside
1075
+ },
1076
+ 'return-type': {
1077
+ pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [
1078
+ typeExpression,
1079
+ identifier
1080
+ ]),
1081
+ inside: typeInside,
1082
+ alias: 'class-name'
1083
+ },
1084
+ 'constructor-invocation': {
1085
+ pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
1086
+ lookbehind: true,
1087
+ inside: typeInside,
1088
+ alias: 'class-name'
1089
+ },
1090
+ 'generic-method': {
1091
+ pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [
1092
+ name,
1093
+ generic
1094
+ ]),
1095
+ inside: {
1096
+ 'function': re(/^<<0>>/.source, [name]),
1097
+ 'generic': {
1098
+ pattern: RegExp(generic),
1099
+ alias: 'class-name',
1100
+ inside: typeInside
1101
+ }
1102
+ }
1103
+ },
1104
+ 'type-list': {
1105
+ pattern: re(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source, [
1106
+ typeDeclarationKeywords,
1107
+ genericName,
1108
+ name,
1109
+ typeExpression,
1110
+ keywords.source,
1111
+ nestedRound,
1112
+ /\bnew\s*\(\s*\)/.source
1113
+ ]),
1114
+ lookbehind: true,
1115
+ inside: {
1116
+ 'record-arguments': {
1117
+ pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [
1118
+ genericName,
1119
+ nestedRound
1120
+ ]),
1121
+ lookbehind: true,
1905
1122
  greedy: true,
1906
- inside: {
1907
- 'interpolation': {
1908
- pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/,
1909
- lookbehind: true,
1910
- inside: {
1911
- 'format-spec': {
1912
- pattern: /(:)[^:(){}]+(?=}$)/,
1913
- lookbehind: true
1914
- },
1915
- 'conversion-option': {
1916
- pattern: /![sra](?=[:}]$)/,
1917
- alias: 'punctuation'
1918
- },
1919
- rest: null
1920
- }
1921
- },
1922
- 'string': /[\s\S]+/
1923
- }
1123
+ inside: Prism.languages.csharp
1924
1124
  },
1925
- 'triple-quoted-string': {
1926
- pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]*?\1/i,
1125
+ 'keyword': keywords,
1126
+ 'class-name': {
1127
+ pattern: RegExp(typeExpression),
1927
1128
  greedy: true,
1928
- alias: 'string'
1129
+ inside: typeInside
1929
1130
  },
1930
- 'string': {
1931
- pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1932
- greedy: true
1131
+ 'punctuation': /[,()]/
1132
+ }
1133
+ },
1134
+ 'preprocessor': {
1135
+ pattern: /(^[\t ]*)#.*/m,
1136
+ lookbehind: true,
1137
+ alias: 'property',
1138
+ inside: {
1139
+ 'directive': {
1140
+ pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
1141
+ lookbehind: true,
1142
+ alias: 'keyword'
1143
+ }
1144
+ }
1145
+ }
1146
+ });
1147
+ var regularStringOrCharacter = regularString + '|' + character;
1148
+ var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
1149
+ var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
1150
+ var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
1151
+ var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [
1152
+ identifier,
1153
+ roundExpression
1154
+ ]);
1155
+ Prism.languages.insertBefore('csharp', 'class-name', {
1156
+ 'attribute': {
1157
+ pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [
1158
+ attrTarget,
1159
+ attr
1160
+ ]),
1161
+ lookbehind: true,
1162
+ greedy: true,
1163
+ inside: {
1164
+ 'target': {
1165
+ pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
1166
+ alias: 'keyword'
1933
1167
  },
1934
- 'function': {
1935
- pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
1936
- lookbehind: true
1168
+ 'attribute-arguments': {
1169
+ pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
1170
+ inside: Prism.languages.csharp
1937
1171
  },
1938
1172
  'class-name': {
1939
- pattern: /(\bclass\s+)\w+/i,
1940
- lookbehind: true
1173
+ pattern: RegExp(identifier),
1174
+ inside: { 'punctuation': /\./ }
1941
1175
  },
1942
- 'decorator': {
1943
- pattern: /(^\s*)@\w+(?:\.\w+)*/im,
1176
+ 'punctuation': /[:,]/
1177
+ }
1178
+ }
1179
+ });
1180
+ var formatString = /:[^}\r\n]+/.source;
1181
+ var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
1182
+ var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [
1183
+ mInterpolationRound,
1184
+ formatString
1185
+ ]);
1186
+ var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
1187
+ var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [
1188
+ sInterpolationRound,
1189
+ formatString
1190
+ ]);
1191
+ function createInterpolationInside(interpolation, interpolationRound) {
1192
+ return {
1193
+ 'interpolation': {
1194
+ pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
1195
+ lookbehind: true,
1196
+ inside: {
1197
+ 'format-string': {
1198
+ pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [
1199
+ interpolationRound,
1200
+ formatString
1201
+ ]),
1202
+ lookbehind: true,
1203
+ inside: { 'punctuation': /^:/ }
1204
+ },
1205
+ 'punctuation': /^\{|\}$/,
1206
+ 'expression': {
1207
+ pattern: /[\s\S]+/,
1208
+ alias: 'language-csharp',
1209
+ inside: Prism.languages.csharp
1210
+ }
1211
+ }
1212
+ },
1213
+ 'string': /[\s\S]+/
1214
+ };
1215
+ }
1216
+ Prism.languages.insertBefore('csharp', 'string', {
1217
+ 'interpolation-string': [
1218
+ {
1219
+ pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
1220
+ lookbehind: true,
1221
+ greedy: true,
1222
+ inside: createInterpolationInside(mInterpolation, mInterpolationRound)
1223
+ },
1224
+ {
1225
+ pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
1226
+ lookbehind: true,
1227
+ greedy: true,
1228
+ inside: createInterpolationInside(sInterpolation, sInterpolationRound)
1229
+ }
1230
+ ]
1231
+ });
1232
+ }(Prism));
1233
+ Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
1234
+ (function (Prism) {
1235
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1236
+ Prism.languages.css = {
1237
+ 'comment': /\/\*[\s\S]*?\*\//,
1238
+ 'atrule': {
1239
+ pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
1240
+ inside: {
1241
+ 'rule': /^@[\w-]+/,
1242
+ 'selector-function-argument': {
1243
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1944
1244
  lookbehind: true,
1945
- alias: [
1946
- 'annotation',
1947
- 'punctuation'
1948
- ],
1949
- inside: { 'punctuation': /\./ }
1245
+ alias: 'selector'
1950
1246
  },
1951
- 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
1952
- 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
1953
- 'boolean': /\b(?:True|False|None)\b/,
1954
- 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,
1955
- 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
1956
- 'punctuation': /[{}[\];(),.:]/
1957
- };
1958
- Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
1959
- Prism.languages.py = Prism.languages.python;
1247
+ 'keyword': {
1248
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1249
+ lookbehind: true
1250
+ }
1251
+ }
1252
+ },
1253
+ 'url': {
1254
+ pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1255
+ greedy: true,
1256
+ inside: {
1257
+ 'function': /^url/i,
1258
+ 'punctuation': /^\(|\)$/,
1259
+ 'string': {
1260
+ pattern: RegExp('^' + string.source + '$'),
1261
+ alias: 'url'
1262
+ }
1263
+ }
1264
+ },
1265
+ 'selector': {
1266
+ pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1267
+ lookbehind: true
1268
+ },
1269
+ 'string': {
1270
+ pattern: string,
1271
+ greedy: true
1272
+ },
1273
+ 'property': {
1274
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1275
+ lookbehind: true
1276
+ },
1277
+ 'important': /!important\b/i,
1278
+ 'function': {
1279
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1280
+ lookbehind: true
1281
+ },
1282
+ 'punctuation': /[(){};:,]/
1283
+ };
1284
+ Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1285
+ var markup = Prism.languages.markup;
1286
+ if (markup) {
1287
+ markup.tag.addInlined('style', 'css');
1288
+ markup.tag.addAttribute('style', 'css');
1289
+ }
1290
+ }(Prism));
1291
+ (function (Prism) {
1292
+ var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
1293
+ var classNamePrefix = /(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
1294
+ var className = {
1295
+ pattern: RegExp(classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
1296
+ lookbehind: true,
1297
+ inside: {
1298
+ 'namespace': {
1299
+ pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
1300
+ inside: { 'punctuation': /\./ }
1301
+ },
1302
+ 'punctuation': /\./
1303
+ }
1304
+ };
1305
+ Prism.languages.java = Prism.languages.extend('clike', {
1306
+ 'class-name': [
1307
+ className,
1308
+ {
1309
+ pattern: RegExp(classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source),
1310
+ lookbehind: true,
1311
+ inside: className.inside
1312
+ }
1313
+ ],
1314
+ 'keyword': keywords,
1315
+ 'function': [
1316
+ Prism.languages.clike.function,
1317
+ {
1318
+ pattern: /(::\s*)[a-z_]\w*/,
1319
+ lookbehind: true
1320
+ }
1321
+ ],
1322
+ 'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
1323
+ 'operator': {
1324
+ pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
1325
+ lookbehind: true
1326
+ }
1327
+ });
1328
+ Prism.languages.insertBefore('java', 'string', {
1329
+ 'triple-quoted-string': {
1330
+ pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
1331
+ greedy: true,
1332
+ alias: 'string'
1333
+ }
1334
+ });
1335
+ Prism.languages.insertBefore('java', 'class-name', {
1336
+ 'annotation': {
1337
+ pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
1338
+ lookbehind: true,
1339
+ alias: 'punctuation'
1340
+ },
1341
+ 'generics': {
1342
+ pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
1343
+ inside: {
1344
+ 'class-name': className,
1345
+ 'keyword': keywords,
1346
+ 'punctuation': /[<>(),.:]/,
1347
+ 'operator': /[?&|]/
1348
+ }
1349
+ },
1350
+ 'namespace': {
1351
+ pattern: RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g, function () {
1352
+ return keywords.source;
1353
+ })),
1354
+ lookbehind: true,
1355
+ inside: { 'punctuation': /\./ }
1356
+ }
1357
+ });
1358
+ }(Prism));
1359
+ Prism.languages.javascript = Prism.languages.extend('clike', {
1360
+ 'class-name': [
1361
+ Prism.languages.clike['class-name'],
1362
+ {
1363
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,
1364
+ lookbehind: true
1365
+ }
1366
+ ],
1367
+ 'keyword': [
1368
+ {
1369
+ pattern: /((?:^|\})\s*)catch\b/,
1370
+ lookbehind: true
1960
1371
  },
1961
- {}
1372
+ {
1373
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1374
+ lookbehind: true
1375
+ }
1962
1376
  ],
1963
- 13: [
1964
- function (require, module, exports) {
1965
- (function (Prism) {
1966
- Prism.languages.ruby = Prism.languages.extend('clike', {
1967
- 'comment': [
1968
- /#.*/,
1969
- {
1970
- pattern: /^=begin\s[\s\S]*?^=end/m,
1971
- greedy: true
1972
- }
1973
- ],
1974
- 'class-name': {
1975
- pattern: /(\b(?:class)\s+|\bcatch\s+\()[\w.\\]+/i,
1976
- lookbehind: true,
1977
- inside: { 'punctuation': /[.\\]/ }
1377
+ 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1378
+ 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
1379
+ 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1380
+ });
1381
+ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
1382
+ Prism.languages.insertBefore('javascript', 'keyword', {
1383
+ 'regex': {
1384
+ pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,
1385
+ lookbehind: true,
1386
+ greedy: true,
1387
+ inside: {
1388
+ 'regex-source': {
1389
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1390
+ lookbehind: true,
1391
+ alias: 'language-regex',
1392
+ inside: Prism.languages.regex
1393
+ },
1394
+ 'regex-delimiter': /^\/|\/$/,
1395
+ 'regex-flags': /^[a-z]+$/
1396
+ }
1397
+ },
1398
+ 'function-variable': {
1399
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1400
+ alias: 'function'
1401
+ },
1402
+ 'parameter': [
1403
+ {
1404
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1405
+ lookbehind: true,
1406
+ inside: Prism.languages.javascript
1407
+ },
1408
+ {
1409
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1410
+ lookbehind: true,
1411
+ inside: Prism.languages.javascript
1412
+ },
1413
+ {
1414
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1415
+ lookbehind: true,
1416
+ inside: Prism.languages.javascript
1417
+ },
1418
+ {
1419
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1420
+ lookbehind: true,
1421
+ inside: Prism.languages.javascript
1422
+ }
1423
+ ],
1424
+ 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1425
+ });
1426
+ Prism.languages.insertBefore('javascript', 'string', {
1427
+ 'hashbang': {
1428
+ pattern: /^#!.*/,
1429
+ greedy: true,
1430
+ alias: 'comment'
1431
+ },
1432
+ 'template-string': {
1433
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1434
+ greedy: true,
1435
+ inside: {
1436
+ 'template-punctuation': {
1437
+ pattern: /^`|`$/,
1438
+ alias: 'string'
1439
+ },
1440
+ 'interpolation': {
1441
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1442
+ lookbehind: true,
1443
+ inside: {
1444
+ 'interpolation-punctuation': {
1445
+ pattern: /^\$\{|\}$/,
1446
+ alias: 'punctuation'
1978
1447
  },
1979
- 'keyword': /\b(?:alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|protected|private|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/
1980
- });
1981
- var interpolation = {
1982
- pattern: /#\{[^}]+\}/,
1983
- inside: {
1984
- 'delimiter': {
1985
- pattern: /^#\{|\}$/,
1986
- alias: 'tag'
1987
- },
1988
- rest: Prism.languages.ruby
1989
- }
1990
- };
1991
- delete Prism.languages.ruby.function;
1992
- Prism.languages.insertBefore('ruby', 'keyword', {
1993
- 'regex': [
1448
+ rest: Prism.languages.javascript
1449
+ }
1450
+ },
1451
+ 'string': /[\s\S]+/
1452
+ }
1453
+ }
1454
+ });
1455
+ if (Prism.languages.markup) {
1456
+ Prism.languages.markup.tag.addInlined('script', 'javascript');
1457
+ Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source, 'javascript');
1458
+ }
1459
+ Prism.languages.js = Prism.languages.javascript;
1460
+ Prism.languages.markup = {
1461
+ 'comment': {
1462
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1463
+ greedy: true
1464
+ },
1465
+ 'prolog': {
1466
+ pattern: /<\?[\s\S]+?\?>/,
1467
+ greedy: true
1468
+ },
1469
+ 'doctype': {
1470
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1471
+ greedy: true,
1472
+ inside: {
1473
+ 'internal-subset': {
1474
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1475
+ lookbehind: true,
1476
+ greedy: true,
1477
+ inside: null
1478
+ },
1479
+ 'string': {
1480
+ pattern: /"[^"]*"|'[^']*'/,
1481
+ greedy: true
1482
+ },
1483
+ 'punctuation': /^<!|>$|[[\]]/,
1484
+ 'doctype-tag': /^DOCTYPE/i,
1485
+ 'name': /[^\s<>'"]+/
1486
+ }
1487
+ },
1488
+ 'cdata': {
1489
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1490
+ greedy: true
1491
+ },
1492
+ 'tag': {
1493
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1494
+ greedy: true,
1495
+ inside: {
1496
+ 'tag': {
1497
+ pattern: /^<\/?[^\s>\/]+/,
1498
+ inside: {
1499
+ 'punctuation': /^<\/?/,
1500
+ 'namespace': /^[^\s>\/:]+:/
1501
+ }
1502
+ },
1503
+ 'special-attr': [],
1504
+ 'attr-value': {
1505
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1506
+ inside: {
1507
+ 'punctuation': [
1994
1508
  {
1995
- pattern: RegExp(/%r/.source + '(?:' + [
1996
- /([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1[gim]{0,3}/.source,
1997
- /\((?:[^()\\]|\\[\s\S])*\)[gim]{0,3}/.source,
1998
- /\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}[gim]{0,3}/.source,
1999
- /\[(?:[^\[\]\\]|\\[\s\S])*\][gim]{0,3}/.source,
2000
- /<(?:[^<>\\]|\\[\s\S])*>[gim]{0,3}/.source
2001
- ].join('|') + ')'),
2002
- greedy: true,
2003
- inside: { 'interpolation': interpolation }
1509
+ pattern: /^=/,
1510
+ alias: 'attr-equals'
2004
1511
  },
2005
- {
2006
- pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[gim]{0,3}(?=\s*(?:$|[\r\n,.;})]))/,
1512
+ /"|'/
1513
+ ]
1514
+ }
1515
+ },
1516
+ 'punctuation': /\/?>/,
1517
+ 'attr-name': {
1518
+ pattern: /[^\s>\/]+/,
1519
+ inside: { 'namespace': /^[^\s>\/:]+:/ }
1520
+ }
1521
+ }
1522
+ },
1523
+ 'entity': [
1524
+ {
1525
+ pattern: /&[\da-z]{1,8};/i,
1526
+ alias: 'named-entity'
1527
+ },
1528
+ /&#x?[\da-f]{1,8};/i
1529
+ ]
1530
+ };
1531
+ Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];
1532
+ Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1533
+ Prism.hooks.add('wrap', function (env) {
1534
+ if (env.type === 'entity') {
1535
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
1536
+ }
1537
+ });
1538
+ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1539
+ value: function addInlined(tagName, lang) {
1540
+ var includedCdataInside = {};
1541
+ includedCdataInside['language-' + lang] = {
1542
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1543
+ lookbehind: true,
1544
+ inside: Prism.languages[lang]
1545
+ };
1546
+ includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1547
+ var inside = {
1548
+ 'included-cdata': {
1549
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1550
+ inside: includedCdataInside
1551
+ }
1552
+ };
1553
+ inside['language-' + lang] = {
1554
+ pattern: /[\s\S]+/,
1555
+ inside: Prism.languages[lang]
1556
+ };
1557
+ var def = {};
1558
+ def[tagName] = {
1559
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
1560
+ return tagName;
1561
+ }), 'i'),
1562
+ lookbehind: true,
1563
+ greedy: true,
1564
+ inside: inside
1565
+ };
1566
+ Prism.languages.insertBefore('markup', 'cdata', def);
1567
+ }
1568
+ });
1569
+ Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1570
+ value: function (attrName, lang) {
1571
+ Prism.languages.markup.tag.inside['special-attr'].push({
1572
+ pattern: RegExp(/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source, 'i'),
1573
+ lookbehind: true,
1574
+ inside: {
1575
+ 'attr-name': /^[^\s=]+/,
1576
+ 'attr-value': {
1577
+ pattern: /=[\s\S]+/,
1578
+ inside: {
1579
+ 'value': {
1580
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
2007
1581
  lookbehind: true,
2008
- greedy: true
2009
- }
2010
- ],
2011
- 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
2012
- 'symbol': {
2013
- pattern: /(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/,
1582
+ alias: [
1583
+ lang,
1584
+ 'language-' + lang
1585
+ ],
1586
+ inside: Prism.languages[lang]
1587
+ },
1588
+ 'punctuation': [
1589
+ {
1590
+ pattern: /^=/,
1591
+ alias: 'attr-equals'
1592
+ },
1593
+ /"|'/
1594
+ ]
1595
+ }
1596
+ }
1597
+ }
1598
+ });
1599
+ }
1600
+ });
1601
+ Prism.languages.html = Prism.languages.markup;
1602
+ Prism.languages.mathml = Prism.languages.markup;
1603
+ Prism.languages.svg = Prism.languages.markup;
1604
+ Prism.languages.xml = Prism.languages.extend('markup', {});
1605
+ Prism.languages.ssml = Prism.languages.xml;
1606
+ Prism.languages.atom = Prism.languages.xml;
1607
+ Prism.languages.rss = Prism.languages.xml;
1608
+ (function (Prism) {
1609
+ var comment = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/;
1610
+ var constant = [
1611
+ {
1612
+ pattern: /\b(?:false|true)\b/i,
1613
+ alias: 'boolean'
1614
+ },
1615
+ {
1616
+ pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,
1617
+ greedy: true,
1618
+ lookbehind: true
1619
+ },
1620
+ {
1621
+ pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,
1622
+ greedy: true,
1623
+ lookbehind: true
1624
+ },
1625
+ /\b(?:null)\b/i,
1626
+ /\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/
1627
+ ];
1628
+ var number = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i;
1629
+ var operator = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;
1630
+ var punctuation = /[{}\[\](),:;]/;
1631
+ Prism.languages.php = {
1632
+ 'delimiter': {
1633
+ pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
1634
+ alias: 'important'
1635
+ },
1636
+ 'comment': comment,
1637
+ 'variable': /\$+(?:\w+\b|(?=\{))/i,
1638
+ 'package': {
1639
+ pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1640
+ lookbehind: true,
1641
+ inside: { 'punctuation': /\\/ }
1642
+ },
1643
+ 'class-name-definition': {
1644
+ pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
1645
+ lookbehind: true,
1646
+ alias: 'class-name'
1647
+ },
1648
+ 'function-definition': {
1649
+ pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
1650
+ lookbehind: true,
1651
+ alias: 'function'
1652
+ },
1653
+ 'keyword': [
1654
+ {
1655
+ pattern: /(\(\s*)\b(?:bool|boolean|int|integer|float|string|object|array)\b(?=\s*\))/i,
1656
+ alias: 'type-casting',
1657
+ greedy: true,
1658
+ lookbehind: true
1659
+ },
1660
+ {
1661
+ pattern: /([(,?]\s*)\b(?:bool|int|float|string|object|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b(?=\s*\$)/i,
1662
+ alias: 'type-hint',
1663
+ greedy: true,
1664
+ lookbehind: true
1665
+ },
1666
+ {
1667
+ pattern: /([(,?]\s*[\w|]\|\s*)(?:null|false)\b(?=\s*\$)/i,
1668
+ alias: 'type-hint',
1669
+ greedy: true,
1670
+ lookbehind: true
1671
+ },
1672
+ {
1673
+ pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b/i,
1674
+ alias: 'return-type',
1675
+ greedy: true,
1676
+ lookbehind: true
1677
+ },
1678
+ {
1679
+ pattern: /(\)\s*:\s*(?:\?\s*)?[\w|]\|\s*)(?:null|false)\b/i,
1680
+ alias: 'return-type',
1681
+ greedy: true,
1682
+ lookbehind: true
1683
+ },
1684
+ {
1685
+ pattern: /\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|iterable|(?:null|false)(?=\s*\|))\b/i,
1686
+ alias: 'type-declaration',
1687
+ greedy: true
1688
+ },
1689
+ {
1690
+ pattern: /(\|\s*)(?:null|false)\b/i,
1691
+ alias: 'type-declaration',
1692
+ greedy: true,
1693
+ lookbehind: true
1694
+ },
1695
+ {
1696
+ pattern: /\b(?:parent|self|static)(?=\s*::)/i,
1697
+ alias: 'static-context',
1698
+ greedy: true
1699
+ },
1700
+ {
1701
+ pattern: /(\byield\s+)from\b/i,
1702
+ lookbehind: true
1703
+ },
1704
+ /\bclass\b/i,
1705
+ {
1706
+ pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|match|new|or|parent|print|private|protected|public|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,
1707
+ lookbehind: true
1708
+ }
1709
+ ],
1710
+ 'argument-name': {
1711
+ pattern: /([(,]\s+)\b[a-z_]\w*(?=\s*:(?!:))/i,
1712
+ lookbehind: true
1713
+ },
1714
+ 'class-name': [
1715
+ {
1716
+ pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
1717
+ greedy: true,
1718
+ lookbehind: true
1719
+ },
1720
+ {
1721
+ pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
1722
+ greedy: true,
1723
+ lookbehind: true
1724
+ },
1725
+ {
1726
+ pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
1727
+ greedy: true
1728
+ },
1729
+ {
1730
+ pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
1731
+ alias: 'class-name-fully-qualified',
1732
+ greedy: true,
1733
+ lookbehind: true,
1734
+ inside: { 'punctuation': /\\/ }
1735
+ },
1736
+ {
1737
+ pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
1738
+ alias: 'class-name-fully-qualified',
1739
+ greedy: true,
1740
+ inside: { 'punctuation': /\\/ }
1741
+ },
1742
+ {
1743
+ pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1744
+ alias: 'class-name-fully-qualified',
1745
+ greedy: true,
1746
+ lookbehind: true,
1747
+ inside: { 'punctuation': /\\/ }
1748
+ },
1749
+ {
1750
+ pattern: /\b[a-z_]\w*(?=\s*\$)/i,
1751
+ alias: 'type-declaration',
1752
+ greedy: true
1753
+ },
1754
+ {
1755
+ pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
1756
+ alias: [
1757
+ 'class-name-fully-qualified',
1758
+ 'type-declaration'
1759
+ ],
1760
+ greedy: true,
1761
+ inside: { 'punctuation': /\\/ }
1762
+ },
1763
+ {
1764
+ pattern: /\b[a-z_]\w*(?=\s*::)/i,
1765
+ alias: 'static-context',
1766
+ greedy: true
1767
+ },
1768
+ {
1769
+ pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
1770
+ alias: [
1771
+ 'class-name-fully-qualified',
1772
+ 'static-context'
1773
+ ],
1774
+ greedy: true,
1775
+ inside: { 'punctuation': /\\/ }
1776
+ },
1777
+ {
1778
+ pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
1779
+ alias: 'type-hint',
1780
+ greedy: true,
1781
+ lookbehind: true
1782
+ },
1783
+ {
1784
+ pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
1785
+ alias: [
1786
+ 'class-name-fully-qualified',
1787
+ 'type-hint'
1788
+ ],
1789
+ greedy: true,
1790
+ lookbehind: true,
1791
+ inside: { 'punctuation': /\\/ }
1792
+ },
1793
+ {
1794
+ pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
1795
+ alias: 'return-type',
1796
+ greedy: true,
1797
+ lookbehind: true
1798
+ },
1799
+ {
1800
+ pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
1801
+ alias: [
1802
+ 'class-name-fully-qualified',
1803
+ 'return-type'
1804
+ ],
1805
+ greedy: true,
1806
+ lookbehind: true,
1807
+ inside: { 'punctuation': /\\/ }
1808
+ }
1809
+ ],
1810
+ 'constant': constant,
1811
+ 'function': {
1812
+ pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
1813
+ lookbehind: true,
1814
+ inside: { 'punctuation': /\\/ }
1815
+ },
1816
+ 'property': {
1817
+ pattern: /(->\s*)\w+/,
1818
+ lookbehind: true
1819
+ },
1820
+ 'number': number,
1821
+ 'operator': operator,
1822
+ 'punctuation': punctuation
1823
+ };
1824
+ var string_interpolation = {
1825
+ pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,
1826
+ lookbehind: true,
1827
+ inside: Prism.languages.php
1828
+ };
1829
+ var string = [
1830
+ {
1831
+ pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
1832
+ alias: 'nowdoc-string',
1833
+ greedy: true,
1834
+ inside: {
1835
+ 'delimiter': {
1836
+ pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
1837
+ alias: 'symbol',
1838
+ inside: { 'punctuation': /^<<<'?|[';]$/ }
1839
+ }
1840
+ }
1841
+ },
1842
+ {
1843
+ pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
1844
+ alias: 'heredoc-string',
1845
+ greedy: true,
1846
+ inside: {
1847
+ 'delimiter': {
1848
+ pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
1849
+ alias: 'symbol',
1850
+ inside: { 'punctuation': /^<<<"?|[";]$/ }
1851
+ },
1852
+ 'interpolation': string_interpolation
1853
+ }
1854
+ },
1855
+ {
1856
+ pattern: /`(?:\\[\s\S]|[^\\`])*`/,
1857
+ alias: 'backtick-quoted-string',
1858
+ greedy: true
1859
+ },
1860
+ {
1861
+ pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1862
+ alias: 'single-quoted-string',
1863
+ greedy: true
1864
+ },
1865
+ {
1866
+ pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1867
+ alias: 'double-quoted-string',
1868
+ greedy: true,
1869
+ inside: { 'interpolation': string_interpolation }
1870
+ }
1871
+ ];
1872
+ Prism.languages.insertBefore('php', 'variable', {
1873
+ 'string': string,
1874
+ 'attribute': {
1875
+ pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,
1876
+ greedy: true,
1877
+ inside: {
1878
+ 'attribute-content': {
1879
+ pattern: /^(#\[)[\s\S]+(?=\]$)/,
1880
+ lookbehind: true,
1881
+ inside: {
1882
+ 'comment': comment,
1883
+ 'string': string,
1884
+ 'attribute-class-name': [
1885
+ {
1886
+ pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
1887
+ alias: 'class-name',
1888
+ greedy: true,
1889
+ lookbehind: true
1890
+ },
1891
+ {
1892
+ pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
1893
+ alias: [
1894
+ 'class-name',
1895
+ 'class-name-fully-qualified'
1896
+ ],
1897
+ greedy: true,
1898
+ lookbehind: true,
1899
+ inside: { 'punctuation': /\\/ }
1900
+ }
1901
+ ],
1902
+ 'constant': constant,
1903
+ 'number': number,
1904
+ 'operator': operator,
1905
+ 'punctuation': punctuation
1906
+ }
1907
+ },
1908
+ 'delimiter': {
1909
+ pattern: /^#\[|\]$/,
1910
+ alias: 'punctuation'
1911
+ }
1912
+ }
1913
+ }
1914
+ });
1915
+ Prism.hooks.add('before-tokenize', function (env) {
1916
+ if (!/<\?/.test(env.code)) {
1917
+ return;
1918
+ }
1919
+ var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/gi;
1920
+ Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
1921
+ });
1922
+ Prism.hooks.add('after-tokenize', function (env) {
1923
+ Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
1924
+ });
1925
+ }(Prism));
1926
+ Prism.languages.python = {
1927
+ 'comment': {
1928
+ pattern: /(^|[^\\])#.*/,
1929
+ lookbehind: true
1930
+ },
1931
+ 'string-interpolation': {
1932
+ pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
1933
+ greedy: true,
1934
+ inside: {
1935
+ 'interpolation': {
1936
+ pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
1937
+ lookbehind: true,
1938
+ inside: {
1939
+ 'format-spec': {
1940
+ pattern: /(:)[^:(){}]+(?=\}$)/,
2014
1941
  lookbehind: true
2015
1942
  },
2016
- 'method-definition': {
2017
- pattern: /(\bdef\s+)[\w.]+/,
2018
- lookbehind: true,
2019
- inside: {
2020
- 'function': /\w+$/,
2021
- rest: Prism.languages.ruby
2022
- }
2023
- }
2024
- });
2025
- Prism.languages.insertBefore('ruby', 'number', {
2026
- 'builtin': /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|Fixnum|Float|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
2027
- 'constant': /\b[A-Z]\w*(?:[?!]|\b)/
2028
- });
2029
- Prism.languages.ruby.string = [
2030
- {
2031
- pattern: RegExp(/%[qQiIwWxs]?/.source + '(?:' + [
2032
- /([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
2033
- /\((?:[^()\\]|\\[\s\S])*\)/.source,
2034
- /\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/.source,
2035
- /\[(?:[^\[\]\\]|\\[\s\S])*\]/.source,
2036
- /<(?:[^<>\\]|\\[\s\S])*>/.source
2037
- ].join('|') + ')'),
2038
- greedy: true,
2039
- inside: { 'interpolation': interpolation }
1943
+ 'conversion-option': {
1944
+ pattern: /![sra](?=[:}]$)/,
1945
+ alias: 'punctuation'
2040
1946
  },
2041
- {
2042
- pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
2043
- greedy: true,
2044
- inside: { 'interpolation': interpolation }
2045
- }
2046
- ];
2047
- Prism.languages.rb = Prism.languages.ruby;
2048
- }(Prism));
1947
+ rest: null
1948
+ }
1949
+ },
1950
+ 'string': /[\s\S]+/
1951
+ }
1952
+ },
1953
+ 'triple-quoted-string': {
1954
+ pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]*?\1/i,
1955
+ greedy: true,
1956
+ alias: 'string'
1957
+ },
1958
+ 'string': {
1959
+ pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
1960
+ greedy: true
1961
+ },
1962
+ 'function': {
1963
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
1964
+ lookbehind: true
1965
+ },
1966
+ 'class-name': {
1967
+ pattern: /(\bclass\s+)\w+/i,
1968
+ lookbehind: true
1969
+ },
1970
+ 'decorator': {
1971
+ pattern: /(^[\t ]*)@\w+(?:\.\w+)*/im,
1972
+ lookbehind: true,
1973
+ alias: [
1974
+ 'annotation',
1975
+ 'punctuation'
1976
+ ],
1977
+ inside: { 'punctuation': /\./ }
1978
+ },
1979
+ 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
1980
+ 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
1981
+ 'boolean': /\b(?:True|False|None)\b/,
1982
+ 'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?\b/i,
1983
+ 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
1984
+ 'punctuation': /[{}[\];(),.:]/
1985
+ };
1986
+ Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
1987
+ Prism.languages.py = Prism.languages.python;
1988
+ (function (Prism) {
1989
+ Prism.languages.ruby = Prism.languages.extend('clike', {
1990
+ 'comment': [
1991
+ /#.*/,
1992
+ {
1993
+ pattern: /^=begin\s[\s\S]*?^=end/m,
1994
+ greedy: true
1995
+ }
1996
+ ],
1997
+ 'class-name': {
1998
+ pattern: /(\b(?:class)\s+|\bcatch\s+\()[\w.\\]+/i,
1999
+ lookbehind: true,
2000
+ inside: { 'punctuation': /[.\\]/ }
2049
2001
  },
2050
- {}
2051
- ],
2052
- 14: [
2053
- function (require, module, exports) {
2054
- var Prism = require('prismjs/components/prism-core');
2055
- require('prismjs/components/prism-clike');
2056
- require('prismjs/components/prism-markup-templating');
2057
- require('prismjs/components/prism-c');
2058
- require('prismjs/components/prism-cpp');
2059
- require('prismjs/components/prism-csharp');
2060
- require('prismjs/components/prism-css');
2061
- require('prismjs/components/prism-java');
2062
- require('prismjs/components/prism-javascript');
2063
- require('prismjs/components/prism-markup');
2064
- require('prismjs/components/prism-php');
2065
- require('prismjs/components/prism-python');
2066
- require('prismjs/components/prism-ruby');
2067
- module.exports = { boltExport: Prism };
2002
+ 'keyword': /\b(?:alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|protected|private|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/
2003
+ });
2004
+ var interpolation = {
2005
+ pattern: /#\{[^}]+\}/,
2006
+ inside: {
2007
+ 'delimiter': {
2008
+ pattern: /^#\{|\}$/,
2009
+ alias: 'tag'
2010
+ },
2011
+ rest: Prism.languages.ruby
2012
+ }
2013
+ };
2014
+ delete Prism.languages.ruby.function;
2015
+ Prism.languages.insertBefore('ruby', 'keyword', {
2016
+ 'regex': [
2017
+ {
2018
+ pattern: RegExp(/%r/.source + '(?:' + [
2019
+ /([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
2020
+ /\((?:[^()\\]|\\[\s\S])*\)/.source,
2021
+ /\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/.source,
2022
+ /\[(?:[^\[\]\\]|\\[\s\S])*\]/.source,
2023
+ /<(?:[^<>\\]|\\[\s\S])*>/.source
2024
+ ].join('|') + ')' + /[egimnosux]{0,6}/.source),
2025
+ greedy: true,
2026
+ inside: { 'interpolation': interpolation }
2027
+ },
2028
+ {
2029
+ pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,
2030
+ lookbehind: true,
2031
+ greedy: true,
2032
+ inside: { 'interpolation': interpolation }
2033
+ }
2034
+ ],
2035
+ 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
2036
+ 'symbol': {
2037
+ pattern: /(^|[^:]):[a-zA-Z_]\w*(?:[?!]|\b)/,
2038
+ lookbehind: true
2039
+ },
2040
+ 'method-definition': {
2041
+ pattern: /(\bdef\s+)[\w.]+/,
2042
+ lookbehind: true,
2043
+ inside: {
2044
+ 'function': /\w+$/,
2045
+ rest: Prism.languages.ruby
2046
+ }
2047
+ }
2048
+ });
2049
+ Prism.languages.insertBefore('ruby', 'number', {
2050
+ 'builtin': /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|Fixnum|Float|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
2051
+ 'constant': /\b[A-Z]\w*(?:[?!]|\b)/
2052
+ });
2053
+ Prism.languages.ruby.string = [
2054
+ {
2055
+ pattern: RegExp(/%[qQiIwWxs]?/.source + '(?:' + [
2056
+ /([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
2057
+ /\((?:[^()\\]|\\[\s\S])*\)/.source,
2058
+ /\{(?:[^#{}\\]|#(?:\{[^}]+\})?|\\[\s\S])*\}/.source,
2059
+ /\[(?:[^\[\]\\]|\\[\s\S])*\]/.source,
2060
+ /<(?:[^<>\\]|\\[\s\S])*>/.source
2061
+ ].join('|') + ')'),
2062
+ greedy: true,
2063
+ inside: { 'interpolation': interpolation }
2068
2064
  },
2069
2065
  {
2070
- 'prismjs/components/prism-c': 1,
2071
- 'prismjs/components/prism-clike': 2,
2072
- 'prismjs/components/prism-core': 3,
2073
- 'prismjs/components/prism-cpp': 4,
2074
- 'prismjs/components/prism-csharp': 5,
2075
- 'prismjs/components/prism-css': 6,
2076
- 'prismjs/components/prism-java': 7,
2077
- 'prismjs/components/prism-javascript': 8,
2078
- 'prismjs/components/prism-markup': 10,
2079
- 'prismjs/components/prism-markup-templating': 9,
2080
- 'prismjs/components/prism-php': 11,
2081
- 'prismjs/components/prism-python': 12,
2082
- 'prismjs/components/prism-ruby': 13
2066
+ pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
2067
+ greedy: true,
2068
+ inside: { 'interpolation': interpolation }
2069
+ },
2070
+ {
2071
+ pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
2072
+ alias: 'heredoc-string',
2073
+ greedy: true,
2074
+ inside: {
2075
+ 'delimiter': {
2076
+ pattern: /^<<[-~]?[a-z_]\w*|[a-z_]\w*$/i,
2077
+ alias: 'symbol',
2078
+ inside: { 'punctuation': /^<<[-~]?/ }
2079
+ },
2080
+ 'interpolation': interpolation
2081
+ }
2082
+ },
2083
+ {
2084
+ pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
2085
+ alias: 'heredoc-string',
2086
+ greedy: true,
2087
+ inside: {
2088
+ 'delimiter': {
2089
+ pattern: /^<<[-~]?'[a-z_]\w*'|[a-z_]\w*$/i,
2090
+ alias: 'symbol',
2091
+ inside: { 'punctuation': /^<<[-~]?'|'$/ }
2092
+ }
2093
+ }
2083
2094
  }
2084
- ]
2085
- }, {}, [14])(14);
2095
+ ];
2096
+ Prism.languages.rb = Prism.languages.ruby;
2097
+ }(Prism));
2098
+ var Prism$1 = prismCore.exports;
2099
+ var prismjs = { boltExport: Prism$1 };
2100
+ return prismjs;
2086
2101
  }));
2087
2102
  var prism = window.Prism;
2088
2103
  window.Prism = oldprism;
2089
2104
  return prism;
2090
- }(undefined, exports$1, module, undefined));
2105
+ }(undefined, exports$1, module));
2091
2106
  var Prism$1 = module.exports.boltExport;
2092
2107
 
2093
- var getLanguages = function (editor) {
2108
+ var getLanguages$1 = function (editor) {
2094
2109
  return editor.getParam('codesample_languages');
2095
2110
  };
2096
2111
  var useGlobalPrismJS = function (editor) {
2097
2112
  return editor.getParam('codesample_global_prismjs', false, 'boolean');
2098
2113
  };
2099
2114
 
2100
- var get$1 = function (editor) {
2115
+ var get = function (editor) {
2101
2116
  return Global.Prism && useGlobalPrismJS(editor) ? Global.Prism : Prism$1;
2102
2117
  };
2103
2118
 
2104
2119
  var getSelectedCodeSample = function (editor) {
2105
2120
  var node = editor.selection ? editor.selection.getNode() : null;
2106
- if (isCodeSample(node)) {
2107
- return Optional.some(node);
2108
- }
2109
- return Optional.none();
2121
+ return someIf(isCodeSample(node), node);
2110
2122
  };
2111
2123
  var insertCodeSample = function (editor, language, code) {
2112
2124
  editor.undoManager.transact(function () {
@@ -2118,21 +2130,19 @@
2118
2130
  }, function (n) {
2119
2131
  editor.dom.setAttrib(n, 'class', 'language-' + language);
2120
2132
  n.innerHTML = code;
2121
- get$1(editor).highlightElement(n);
2133
+ get(editor).highlightElement(n);
2122
2134
  editor.selection.select(n);
2123
2135
  });
2124
2136
  });
2125
2137
  };
2126
2138
  var getCurrentCode = function (editor) {
2127
2139
  var node = getSelectedCodeSample(editor);
2128
- return node.fold(function () {
2129
- return '';
2130
- }, function (n) {
2140
+ return node.fold(constant(''), function (n) {
2131
2141
  return n.textContent;
2132
2142
  });
2133
2143
  };
2134
2144
 
2135
- var getLanguages$1 = function (editor) {
2145
+ var getLanguages = function (editor) {
2136
2146
  var defaultLanguages = [
2137
2147
  {
2138
2148
  text: 'HTML/XML',
@@ -2175,7 +2185,7 @@
2175
2185
  value: 'cpp'
2176
2186
  }
2177
2187
  ];
2178
- var customLanguages = getLanguages(editor);
2188
+ var customLanguages = getLanguages$1(editor);
2179
2189
  return customLanguages ? customLanguages : defaultLanguages;
2180
2190
  };
2181
2191
  var getCurrentLanguage = function (editor, fallback) {
@@ -2189,10 +2199,8 @@
2189
2199
  };
2190
2200
 
2191
2201
  var open = function (editor) {
2192
- var languages = getLanguages$1(editor);
2193
- var defaultLanguage = head(languages).fold(function () {
2194
- return '';
2195
- }, function (l) {
2202
+ var languages = getLanguages(editor);
2203
+ var defaultLanguage = head(languages).fold(constant(''), function (l) {
2196
2204
  return l.value;
2197
2205
  });
2198
2206
  var currentLanguage = getCurrentLanguage(editor, defaultLanguage);
@@ -2241,7 +2249,7 @@
2241
2249
  });
2242
2250
  };
2243
2251
 
2244
- var register = function (editor) {
2252
+ var register$1 = function (editor) {
2245
2253
  editor.addCommand('codesample', function () {
2246
2254
  var node = editor.selection.getNode();
2247
2255
  if (editor.selection.isCollapsed() || isCodeSample(node)) {
@@ -2276,7 +2284,7 @@
2276
2284
  });
2277
2285
  elm.contentEditable = 'false';
2278
2286
  elm.innerHTML = editor.dom.encode(elm.textContent);
2279
- get$1(editor).highlightElement(elm);
2287
+ get(editor).highlightElement(elm);
2280
2288
  elm.className = $.trim(elm.className);
2281
2289
  });
2282
2290
  });
@@ -2288,13 +2296,14 @@
2288
2296
  var node = editor.selection.getStart();
2289
2297
  return editor.dom.is(node, 'pre[class*="language-"]');
2290
2298
  };
2291
- var register$1 = function (editor) {
2299
+ var register = function (editor) {
2300
+ var onAction = function () {
2301
+ return editor.execCommand('codesample');
2302
+ };
2292
2303
  editor.ui.registry.addToggleButton('codesample', {
2293
2304
  icon: 'code-sample',
2294
2305
  tooltip: 'Insert/edit code sample',
2295
- onAction: function () {
2296
- return open(editor);
2297
- },
2306
+ onAction: onAction,
2298
2307
  onSetup: function (api) {
2299
2308
  var nodeChangeHandler = function () {
2300
2309
  api.setActive(isCodeSampleSelection(editor));
@@ -2308,17 +2317,15 @@
2308
2317
  editor.ui.registry.addMenuItem('codesample', {
2309
2318
  text: 'Code sample...',
2310
2319
  icon: 'code-sample',
2311
- onAction: function () {
2312
- return open(editor);
2313
- }
2320
+ onAction: onAction
2314
2321
  });
2315
2322
  };
2316
2323
 
2317
2324
  function Plugin () {
2318
- global.add('codesample', function (editor) {
2325
+ global$2.add('codesample', function (editor) {
2319
2326
  setup(editor);
2320
- register$1(editor);
2321
2327
  register(editor);
2328
+ register$1(editor);
2322
2329
  editor.on('dblclick', function (ev) {
2323
2330
  if (isCodeSample(ev.target)) {
2324
2331
  open(editor);