1/*! 2 * SyntaxHighlighter 3 * https://github.com/syntaxhighlighter/syntaxhighlighter 4 * 5 * SyntaxHighlighter is donationware. If you are using it, please donate. 6 * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 * 8 * @version 9 * 4.0.1 (Thu, 07 Apr 2016 06:36:42 GMT) 10 * 11 * @copyright 12 * Copyright (C) 2004-2016 Alex Gorbatchev. 13 * 14 * @license 15 * Dual licensed under the MIT and GPL licenses. 16 */ 17/******/ (function(modules) { // webpackBootstrap 18/******/ // The module cache 19/******/ var installedModules = {}; 20/******/ 21/******/ // The require function 22/******/ function __webpack_require__(moduleId) { 23/******/ 24/******/ // Check if module is in cache 25/******/ if(installedModules[moduleId]) 26/******/ return installedModules[moduleId].exports; 27/******/ 28/******/ // Create a new module (and put it into the cache) 29/******/ var module = installedModules[moduleId] = { 30/******/ exports: {}, 31/******/ id: moduleId, 32/******/ loaded: false 33/******/ }; 34/******/ 35/******/ // Execute the module function 36/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 37/******/ 38/******/ // Flag the module as loaded 39/******/ module.loaded = true; 40/******/ 41/******/ // Return the exports of the module 42/******/ return module.exports; 43/******/ } 44/******/ 45/******/ 46/******/ // expose the modules object (__webpack_modules__) 47/******/ __webpack_require__.m = modules; 48/******/ 49/******/ // expose the module cache 50/******/ __webpack_require__.c = installedModules; 51/******/ 52/******/ // __webpack_public_path__ 53/******/ __webpack_require__.p = ""; 54/******/ 55/******/ // Load entry module and return exports 56/******/ return __webpack_require__(0); 57/******/ }) 58/************************************************************************/ 59/******/ ([ 60/* 0 */ 61/***/ function(module, exports, __webpack_require__) { 62 63 'use strict'; 64 65 Object.defineProperty(exports, "__esModule", { 66 value: true 67 }); 68 69 var _core = __webpack_require__(1); 70 71 Object.keys(_core).forEach(function (key) { 72 if (key === "default") return; 73 Object.defineProperty(exports, key, { 74 enumerable: true, 75 get: function get() { 76 return _core[key]; 77 } 78 }); 79 }); 80 81 var _domready = __webpack_require__(52); 82 83 var _domready2 = _interopRequireDefault(_domready); 84 85 var _core2 = _interopRequireDefault(_core); 86 87 var _dasherize = __webpack_require__(53); 88 89 var dasherize = _interopRequireWildcard(_dasherize); 90 91 function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 92 93 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 94 95 // configured through the `--compat` parameter. 96 if (false) { 97 require('./compatibility_layer_v3'); 98 } 99 100 (0, _domready2.default)(function () { 101 return _core2.default.highlight(dasherize.object(window.syntaxhighlighterConfig || {})); 102 }); 103 104/***/ }, 105/* 1 */ 106/***/ function(module, exports, __webpack_require__) { 107 108 'use strict'; 109 110 Object.defineProperty(exports, "__esModule", { 111 value: true 112 }); 113 var optsParser = __webpack_require__(2), 114 match = __webpack_require__(5), 115 Renderer = __webpack_require__(9).default, 116 utils = __webpack_require__(10), 117 transformers = __webpack_require__(11), 118 dom = __webpack_require__(17), 119 config = __webpack_require__(18), 120 defaults = __webpack_require__(19), 121 HtmlScript = __webpack_require__(20); 122 123 var sh = { 124 Match: match.Match, 125 Highlighter: __webpack_require__(22), 126 127 config: __webpack_require__(18), 128 regexLib: __webpack_require__(3).commonRegExp, 129 130 /** Internal 'global' variables. */ 131 vars: { 132 discoveredBrushes: null, 133 highlighters: {} 134 }, 135 136 /** This object is populated by user included external brush files. */ 137 brushes: {}, 138 139 /** 140 * Finds all elements on the page which should be processes by SyntaxHighlighter. 141 * 142 * @param {Object} globalParams Optional parameters which override element's 143 * parameters. Only used if element is specified. 144 * 145 * @param {Object} element Optional element to highlight. If none is 146 * provided, all elements in the current document 147 * are returned which qualify. 148 * 149 * @return {Array} Returns list of <code>{ target: DOMElement, params: Object }</code> objects. 150 */ 151 findElements: function findElements(globalParams, element) { 152 var elements = element ? [element] : utils.toArray(document.getElementsByTagName(sh.config.tagName)), 153 conf = sh.config, 154 result = []; 155 156 // support for <SCRIPT TYPE="syntaxhighlighter" /> feature 157 elements = elements.concat(dom.getSyntaxHighlighterScriptTags()); 158 159 if (elements.length === 0) return result; 160 161 for (var i = 0, l = elements.length; i < l; i++) { 162 var item = { 163 target: elements[i], 164 // local params take precedence over globals 165 params: optsParser.defaults(optsParser.parse(elements[i].className), globalParams) 166 }; 167 168 if (item.params['brush'] == null) continue; 169 170 result.push(item); 171 } 172 173 return result; 174 }, 175 176 /** 177 * Shorthand to highlight all elements on the page that are marked as 178 * SyntaxHighlighter source code. 179 * 180 * @param {Object} globalParams Optional parameters which override element's 181 * parameters. Only used if element is specified. 182 * 183 * @param {Object} element Optional element to highlight. If none is 184 * provided, all elements in the current document 185 * are highlighted. 186 */ 187 highlight: function highlight(globalParams, element) { 188 var elements = sh.findElements(globalParams, element), 189 propertyName = 'innerHTML', 190 brush = null, 191 renderer, 192 conf = sh.config; 193 194 if (elements.length === 0) return; 195 196 for (var i = 0, l = elements.length; i < l; i++) { 197 var element = elements[i], 198 target = element.target, 199 params = element.params, 200 brushName = params.brush, 201 brush, 202 matches, 203 code; 204 205 if (brushName == null) continue; 206 207 brush = findBrush(brushName); 208 209 if (!brush) continue; 210 211 // local params take precedence over defaults 212 params = optsParser.defaults(params || {}, defaults); 213 params = optsParser.defaults(params, config); 214 215 // Instantiate a brush 216 if (params['html-script'] == true || defaults['html-script'] == true) { 217 brush = new HtmlScript(findBrush('xml'), brush); 218 brushName = 'htmlscript'; 219 } else { 220 brush = new brush(); 221 } 222 223 code = target[propertyName]; 224 225 // remove CDATA from <SCRIPT/> tags if it's present 226 if (conf.useScriptTags) code = stripCData(code); 227 228 // Inject title if the attribute is present 229 if ((target.title || '') != '') params.title = target.title; 230 231 params['brush'] = brushName; 232 233 code = transformers(code, params); 234 matches = match.applyRegexList(code, brush.regexList, params); 235 renderer = new Renderer(code, matches, params); 236 237 element = dom.create('div'); 238 element.innerHTML = renderer.getHtml(); 239 240 // id = utils.guid();
241 // element.id = highlighters.id(id); 242 // highlighters.set(id, element); 243 244 if (params.quickCode) dom.attachEvent(dom.findElement(element, '.code'), 'dblclick', dom.quickCodeHandler); 245 246 // carry over ID 247 if ((target.id || '') != '') element.id = target.id; 248 249 target.parentNode.replaceChild(element, target); 250 } 251 } 252 }; // end of sh 253 254 /** 255 * Displays an alert. 256 * @param {String} str String to display. 257 */ 258 function alert(str) { 259 window.alert('SyntaxHighlighter\n\n' + str); 260 }; 261 262 /** 263 * Finds a brush by its alias. 264 * 265 * @param {String} alias Brush alias. 266 * @param {Boolean} showAlert Suppresses the alert if false. 267 * @return {Brush} Returns bursh constructor if found, null otherwise. 268 */ 269 function findBrush(alias, showAlert) { 270 var brushes = sh.vars.discoveredBrushes, 271 result = null; 272 273 if (brushes == null) { 274 brushes = {}; 275 276 // Find all brushes 277 for (var brushName in sh.brushes) { 278 var brush = sh.brushes[brushName], 279 aliases = brush.aliases; 280 281 if (aliases == null) { 282 continue; 283 } 284 285 brush.className = brush.className || brush.aliases[0]; 286 brush.brushName = brush.className || brushName.toLowerCase(); 287 288 for (var i = 0, l = aliases.length; i < l; i++) { 289 brushes[aliases[i]] = brushName; 290 } 291 } 292 293 sh.vars.discoveredBrushes = brushes; 294 } 295 296 result = sh.brushes[brushes[alias]]; 297 298 if (result == null && showAlert) alert(sh.config.strings.noBrush + alias); 299 300 return result; 301 }; 302 303 /** 304 * Strips <![CDATA[]]> from <SCRIPT /> content because it should be used 305 * there in most cases for XHTML compliance. 306 * @param {String} original Input code. 307 * @return {String} Returns code without leading <![CDATA[]]> tags. 308 */ 309 function stripCData(original) { 310 var left = '<![CDATA[', 311 right = ']]>', 312 313 // for some reason IE inserts some leading blanks here 314 copy = utils.trim(original), 315 changed = false, 316 leftLength = left.length, 317 rightLength = right.length; 318 319 if (copy.indexOf(left) == 0) { 320 copy = copy.substring(leftLength); 321 changed = true; 322 } 323 324 var copyLength = copy.length; 325 326 if (copy.indexOf(right) == copyLength - rightLength) { 327 copy = copy.substring(0, copyLength - rightLength); 328 changed = true; 329 } 330 331 return changed ? copy : original; 332 }; 333 334 var brushCounter = 0; 335 336 exports.default = sh; 337 var registerBrush = exports.registerBrush = function registerBrush(brush) { 338 return sh.brushes['brush' + brushCounter++] = brush.default || brush; 339 }; 340 var clearRegisteredBrushes = exports.clearRegisteredBrushes = function clearRegisteredBrushes() { 341 sh.brushes = {}; 342 brushCounter = 0; 343 }; 344 345 /* an EJS hook for `gulp build --brushes` command 346 * */ 347 348 registerBrush(__webpack_require__(23)); 349 350 registerBrush(__webpack_require__(24)); 351 352 registerBrush(__webpack_require__(22)); 353 354 registerBrush(__webpack_require__(25)); 355 356 registerBrush(__webpack_require__(26)); 357 358 registerBrush(__webpack_require__(27)); 359 360 registerBrush(__webpack_require__(28)); 361 362 registerBrush(__webpack_require__(29)); 363 364 registerBrush(__webpack_require__(30)); 365 366 registerBrush(__webpack_require__(31)); 367 368 registerBrush(__webpack_require__(32)); 369 370 registerBrush(__webpack_require__(33)); 371 372 registerBrush(__webpack_require__(34)); 373 374 registerBrush(__webpack_require__(35)); 375 376 registerBrush(__webpack_require__(36)); 377 378 registerBrush(__webpack_require__(37)); 379 380 registerBrush(__webpack_require__(38)); 381 382 registerBrush(__webpack_require__(39)); 383 384 registerBrush(__webpack_require__(40)); 385 386 registerBrush(__webpack_require__(41)); 387 388 registerBrush(__webpack_require__(42)); 389 390 registerBrush(__webpack_require__(43)); 391 392 registerBrush(__webpack_require__(44)); 393 394 registerBrush(__webpack_require__(45)); 395 396 registerBrush(__webpack_require__(46)); 397 398 registerBrush(__webpack_require__(47)); 399 400 registerBrush(__webpack_require__(48)); 401 402 registerBrush(__webpack_require__(49)); 403 404 registerBrush(__webpack_require__(50)); 405 406 registerBrush(__webpack_require__(51)); 407 408 /* 409 410 */ 411 412/***/ }, 413/* 2 */ 414/***/ function(module, exports, __webpack_require__) { 415 416 'use strict'; 417
418 var XRegExp = __webpack_require__(3).XRegExp; 419 420 var BOOLEANS = { 'true': true, 'false': false }; 421 422 function camelize(key) { 423 return key.replace(/-(\w+)/g, function (match, word) { 424 return word.charAt(0).toUpperCase() + word.substr(1); 425 }); 426 } 427 428 function process(value) { 429 var result = BOOLEANS[value]; 430 return result == null ? value : result; 431 } 432 433 module.exports = { 434 defaults: function defaults(target, source) { 435 for (var key in source || {}) { 436 if (!target.hasOwnProperty(key)) target[key] = target[camelize(key)] = source[key]; 437 }return target; 438 }, 439 440 parse: function parse(str) { 441 var match, 442 key, 443 result = {}, 444 arrayRegex = XRegExp("^\\[(?<values>(.*?))\\]$"), 445 pos = 0, 446 regex = XRegExp("(?<name>[\\w-]+)" + "\\s*:\\s*" + "(?<value>" + "[\\w%#-]+|" + // word 447 "\\[.*?\\]|" + // [] array 448 '".*?"|' + // "" string 449 "'.*?'" + // '' string 450 ")\\s*;?", "g"); 451 452 while ((match = XRegExp.exec(str, regex, pos)) != null) { 453 var value = match.value.replace(/^['"]|['"]$/g, '') // strip quotes from end of strings 454 ; 455 456 // try to parse array value 457 if (value != null && arrayRegex.test(value)) { 458 var m = XRegExp.exec(value, arrayRegex); 459 value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : []; 460 } 461 462 value = process(value); 463 result[match.name] = result[camelize(match.name)] = value; 464 pos = match.index + match[0].length; 465 } 466 467 return result; 468 } 469 }; 470 471/***/ }, 472/* 3 */ 473/***/ function(module, exports, __webpack_require__) { 474 475 'use strict'; 476 477 Object.defineProperty(exports, "__esModule", { 478 value: true 479 }); 480 exports.commonRegExp = exports.XRegExp = undefined; 481 482 var _xregexp = __webpack_require__(4); 483 484 var _xregexp2 = _interopRequireDefault(_xregexp); 485 486 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 487 488 exports.XRegExp = _xregexp2.default; 489 var commonRegExp = exports.commonRegExp = { 490 multiLineCComments: (0, _xregexp2.default)('/\\*.*?\\*/', 'gs'), 491 singleLineCComments: /\/\/.*$/gm, 492 singleLinePerlComments: /#.*$/gm, 493 doubleQuotedString: /"([^\\"\n]|\\.)*"/g, 494 singleQuotedString: /'([^\\'\n]|\\.)*'/g, 495 multiLineDoubleQuotedString: (0, _xregexp2.default)('"([^\\\\"]|\\\\.)*"', 'gs'), 496 multiLineSingleQuotedString: (0, _xregexp2.default)("'([^\\\\']|\\\\.)*'", 'gs'), 497 xmlComments: (0, _xregexp2.default)('(<|<)!--.*?--(>|>)', 'gs'), 498 url: /\w+:\/\/[\w-.\/?%&=:@;#]*/g, 499 phpScriptTags: { left: /(<|<)\?(?:=|php)?/g, right: /\?(>|>)/g, 'eof': true }, 500 aspScriptTags: { left: /(<|<)%=?/g, right: /%(>|>)/g }, 501 scriptScriptTags: { left: /(<|<)\s*script.*?(>|>)/gi, right: /(<|<)\/\s*script\s*(>|>)/gi } 502 }; 503 504/***/ }, 505/* 4 */ 506/***/ function(module, exports) { 507 508 /*! 509 * XRegExp 3.1.0-dev 510 * <xregexp.com> 511 * Steven Levithan (c) 2007-2015 MIT License 512 */ 513 514 /** 515 * XRegExp provides augmented, extensible regular expressions. You get additional regex syntax and 516 * flags, beyond what browsers support natively. XRegExp is also a regex utility belt with tools to 517 * make your client-side grepping simpler and more powerful, while freeing you from related 518 * cross-browser inconsistencies. 519 */ 520 521 'use strict'; 522 523 /* ============================== 524 * Private variables 525 * ============================== */ 526 527 // Property name used for extended regex instance data 528 529 var REGEX_DATA = 'xregexp'; 530 // Optional features that can be installed and uninstalled 531 var features = { 532 astral: false, 533 natives: false 534 }; 535 // Native methods to use and restore ('native' is an ES3 reserved keyword) 536 var nativ = { 537 exec: RegExp.prototype.exec, 538 test: RegExp.prototype.test, 539 match: String.prototype.match, 540 replace: String.prototype.replace, 541 split: String.prototype.split 542 }; 543 // Storage for fixed/extended native methods 544 var fixed = {}; 545 // Storage for regexes cached by `XRegExp.cache` 546 var regexCache = {}; 547 // Storage for pattern details cached by the `XRegExp` constructor 548 var patternCache = {}; 549 // Storage for regex syntax tokens added internally or by `XRegExp.addToken` 550 var tokens = []; 551 // Token scopes 552 var defaultScope = 'default'; 553 var classScope = 'class'; 554 // Regexes that match native regex syntax, including octals 555 var nativeTokens = { 556 // Any native multicharacter token in default scope, or any single character 557 'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/, 558 // Any native multicharacter token in character class scope, or any single character 559 'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/ 560 }; 561 // Any backreference or dollar-prefixed character in replacement strings 562 var replacementToken = /\$(?:{([\w$]+)}|(\d\d?|[\s\S]))/g;
563 // Check for correct `exec` handling of nonparticipating capturing groups 564 var correctExecNpcg = nativ.exec.call(/()??/, '')[1] === undefined; 565 // Check for ES6 `u` flag support 566 var hasNativeU = function () { 567 var isSupported = true; 568 try { 569 new RegExp('', 'u'); 570 } catch (exception) { 571 isSupported = false; 572 } 573 return isSupported; 574 }(); 575 // Check for ES6 `y` flag support 576 var hasNativeY = function () { 577 var isSupported = true; 578 try { 579 new RegExp('', 'y'); 580 } catch (exception) { 581 isSupported = false; 582 } 583 return isSupported; 584 }(); 585 // Check for ES6 `flags` prop support 586 var hasFlagsProp = /a/.flags !== undefined; 587 // Tracker for known flags, including addon flags 588 var registeredFlags = { 589 g: true, 590 i: true, 591 m: true, 592 u: hasNativeU, 593 y: hasNativeY 594 }; 595 // Shortcut to `Object.prototype.toString` 596 var toString = {}.toString; 597 598 /* ============================== 599 * Private functions 600 * ============================== */ 601 602 /** 603 * Attaches extended data and `XRegExp.prototype` properties to a regex object. 604 * 605 * @private 606 * @param {RegExp} regex Regex to augment. 607 * @param {Array} captureNames Array with capture names, or `null`. 608 * @param {String} xSource XRegExp pattern used to generate `regex`, or `null` if N/A. 609 * @param {String} xFlags XRegExp flags used to generate `regex`, or `null` if N/A. 610 * @param {Boolean} [isInternalOnly=false] Whether the regex will be used only for internal 611 * operations, and never exposed to users. For internal-only regexes, we can improve perf by 612 * skipping some operations like attaching `XRegExp.prototype` properties. 613 * @returns {RegExp} Augmented regex. 614 */ 615 function augment(regex, captureNames, xSource, xFlags, isInternalOnly) { 616 var p; 617 618 regex[REGEX_DATA] = { 619 captureNames: captureNames 620 }; 621 622 if (isInternalOnly) { 623 return regex; 624 } 625 626 // Can't auto-inherit these since the XRegExp constructor returns a nonprimitive value 627 if (regex.__proto__) { 628 regex.__proto__ = XRegExp.prototype; 629 } else { 630 for (p in XRegExp.prototype) { 631 // An `XRegExp.prototype.hasOwnProperty(p)` check wouldn't be worth it here, since 632 // this is performance sensitive, and enumerable `Object.prototype` or 633 // `RegExp.prototype` extensions exist on `regex.prototype` anyway 634 regex[p] = XRegExp.prototype[p]; 635 } 636 } 637 638 regex[REGEX_DATA].source = xSource; 639 // Emulate the ES6 `flags` prop by ensuring flags are in alphabetical order 640 regex[REGEX_DATA].flags = xFlags ? xFlags.split('').sort().join('') : xFlags; 641 642 return regex; 643 } 644 645 /** 646 * Removes any duplicate characters from the provided string. 647 * 648 * @private 649 * @param {String} str String to remove duplicate characters from. 650 * @returns {String} String with any duplicate characters removed. 651 */ 652 function clipDuplicates(str) { 653 return nativ.replace.call(str, /([\s\S])(?=[\s\S]*\1)/g, ''); 654 } 655 656 /** 657 * Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype` 658 * properties. The copy has a fresh `lastIndex` property (set to zero). Allows adding and removing 659 * flags g and y while copying the regex. 660 * 661 * @private 662 * @param {RegExp} regex Regex to copy. 663 * @param {Object} [options] Options object with optional properties: 664 * <li>`addG` {Boolean} Add flag g while copying the regex. 665 * <li>`addY` {Boolean} Add flag y while copying the regex. 666 * <li>`removeG` {Boolean} Remove flag g while copying the regex. 667 * <li>`removeY` {Boolean} Remove flag y while copying the regex. 668 * <li>`isInternalOnly` {Boolean} Whether the copied regex will be used only for internal 669 * operations, and never exposed to users. For internal-only regexes, we can improve perf by 670 * skipping some operations like attaching `XRegExp.prototype` properties. 671 * @returns {RegExp} Copy of the provided regex, possibly with modified flags. 672 */ 673 function copyRegex(regex, options) { 674 if (!XRegExp.isRegExp(regex)) { 675 throw new TypeError('Type RegExp expected'); 676 } 677 678 var xData = regex[REGEX_DATA] || {}, 679 flags = getNativeFlags(regex), 680 flagsToAdd = '', 681 flagsToRemove = '', 682 xregexpSource = null, 683 xregexpFlags = null; 684 685 options = options || {}; 686 687 if (options.removeG) { 688 flagsToRemove += 'g'; 689 } 690 if (options.removeY) { 691 flagsToRemove += 'y'; 692 } 693 if (flagsToRemove) { 694 flags = nativ.replace.call(flags, new RegExp('[' + flagsToRemove + ']+', 'g'), ''); 695 } 696 697 if (options.addG) { 698 flagsToAdd += 'g'; 699 } 700 if (options.addY) { 701 flagsToAdd += 'y'; 702 } 703 if (flagsToAdd) { 704 flags = clipDuplicates(flags + flagsToAdd); 705 } 706 707 if (!options.isInternalOnly) { 708 if (xData.source !== undefined) { 709 xregexpSource = xData.source; 710 } 711 // null or undefined; don't want to add to `flags` if the previous value was null, since
712 // that indicates we're not tracking original precompilation flags 713 if (xData.flags != null) { 714 // Flags are only added for non-internal regexes by `XRegExp.globalize`. Flags are 715 // never removed for non-internal regexes, so don't need to handle it 716 xregexpFlags = flagsToAdd ? clipDuplicates(xData.flags + flagsToAdd) : xData.flags; 717 } 718 } 719 720 // Augment with `XRegExp.prototype` properties, but use the native `RegExp` constructor to 721 // avoid searching for special tokens. That would be wrong for regexes constructed by 722 // `RegExp`, and unnecessary for regexes constructed by `XRegExp` because the regex has 723 // already undergone the translation to native regex syntax 724 regex = augment(new RegExp(regex.source, flags), hasNamedCapture(regex) ? xData.captureNames.slice(0) : null, xregexpSource, xregexpFlags, options.isInternalOnly); 725 726 return regex; 727 } 728 729 /** 730 * Converts hexadecimal to decimal. 731 * 732 * @private 733 * @param {String} hex 734 * @returns {Number} 735 */ 736 function dec(hex) { 737 return parseInt(hex, 16); 738 } 739 740 /** 741 * Returns native `RegExp` flags used by a regex object. 742 * 743 * @private 744 * @param {RegExp} regex Regex to check. 745 * @returns {String} Native flags in use. 746 */ 747 function getNativeFlags(regex) { 748 return hasFlagsProp ? regex.flags : 749 // Explicitly using `RegExp.prototype.toString` (rather than e.g. `String` or 750 // concatenation with an empty string) allows this to continue working predictably when 751 // `XRegExp.proptotype.toString` is overriden 752 nativ.exec.call(/\/([a-z]*)$/i, RegExp.prototype.toString.call(regex))[1]; 753 } 754 755 /** 756 * Determines whether a regex has extended instance data used to track capture names. 757 * 758 * @private 759 * @param {RegExp} regex Regex to check. 760 * @returns {Boolean} Whether the regex uses named capture. 761 */ 762 function hasNamedCapture(regex) { 763 return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames); 764 } 765 766 /** 767 * Converts decimal to hexadecimal. 768 * 769 * @private 770 * @param {Number|String} dec 771 * @returns {String} 772 */ 773 function hex(dec) { 774 return parseInt(dec, 10).toString(16); 775 } 776 777 /** 778 * Returns the first index at which a given value can be found in an array. 779 * 780 * @private 781 * @param {Array} array Array to search. 782 * @param {*} value Value to locate in the array. 783 * @returns {Number} Zero-based index at which the item is found, or -1. 784 */ 785 function indexOf(array, value) { 786 var len = array.length, 787 i; 788 789 for (i = 0; i < len; ++i) { 790 if (array[i] === value) { 791 return i; 792 } 793 } 794 795 return -1; 796 } 797 798 /** 799 * Determines whether a value is of the specified type, by resolving its internal [[Class]]. 800 * 801 * @private 802 * @param {*} value Object to check. 803 * @param {String} type Type to check for, in TitleCase. 804 * @returns {Boolean} Whether the object matches the type. 805 */ 806 function isType(value, type) { 807 return toString.call(value) === '[object ' + type + ']'; 808 } 809 810 /** 811 * Checks whether the next nonignorable token after the specified position is a quantifier. 812 * 813 * @private 814 * @param {String} pattern Pattern to search within. 815 * @param {Number} pos Index in `pattern` to search at. 816 * @param {String} flags Flags used by the pattern. 817 * @returns {Boolean} Whether the next token is a quantifier. 818 */ 819 function isQuantifierNext(pattern, pos, flags) { 820 return nativ.test.call(flags.indexOf('x') > -1 ? 821 // Ignore any leading whitespace, line comments, and inline comments 822 /^(?:\s+|#.*|\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/ : 823 // Ignore any leading inline comments 824 /^(?:\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/, pattern.slice(pos)); 825 } 826 827 /** 828 * Pads the provided string with as many leading zeros as needed to get to length 4. Used to produce 829 * fixed-length hexadecimal values. 830 * 831 * @private 832 * @param {String} str 833 * @returns {String} 834 */ 835 function pad4(str) { 836 while (str.length < 4) { 837 str = '0' + str; 838 } 839 return str; 840 } 841 842 /** 843 * Checks for flag-related errors, and strips/applies flags in a leading mode modifier. Offloads
844 * the flag preparation logic from the `XRegExp` constructor. 845 * 846 * @private 847 * @param {String} pattern Regex pattern, possibly with a leading mode modifier. 848 * @param {String} flags Any combination of flags. 849 * @returns {Object} Object with properties `pattern` and `flags`. 850 */ 851 function prepareFlags(pattern, flags) { 852 var i; 853 854 // Recent browsers throw on duplicate flags, so copy this behavior for nonnative flags 855 if (clipDuplicates(flags) !== flags) { 856 throw new SyntaxError('Invalid duplicate regex flag ' + flags); 857 } 858 859 // Strip and apply a leading mode modifier with any combination of flags except g or y 860 pattern = nativ.replace.call(pattern, /^\(\?([\w$]+)\)/, function ($0, $1) { 861 if (nativ.test.call(/[gy]/, $1)) { 862 throw new SyntaxError('Cannot use flag g or y in mode modifier ' + $0); 863 } 864 // Allow duplicate flags within the mode modifier 865 flags = clipDuplicates(flags + $1); 866 return ''; 867 }); 868 869 // Throw on unknown native or nonnative flags 870 for (i = 0; i < flags.length; ++i) { 871 if (!registeredFlags[flags.charAt(i)]) { 872 throw new SyntaxError('Unknown regex flag ' + flags.charAt(i)); 873 } 874 } 875 876 return { 877 pattern: pattern, 878 flags: flags 879 }; 880 } 881 882 /** 883 * Prepares an options object from the given value. 884 * 885 * @private 886 * @param {String|Object} value Value to convert to an options object. 887 * @returns {Object} Options object. 888 */ 889 function prepareOptions(value) { 890 var options = {}; 891 892 if (isType(value, 'String')) { 893 XRegExp.forEach(value, /[^\s,]+/, function (match) { 894 options[match] = true; 895 }); 896 897 return options; 898 } 899 900 return value; 901 } 902 903 /** 904 * Registers a flag so it doesn't throw an 'unknown flag' error. 905 * 906 * @private 907 * @param {String} flag Single-character flag to register. 908 */ 909 function registerFlag(flag) { 910 if (!/^[\w$]$/.test(flag)) { 911 throw new Error('Flag must be a single character A-Za-z0-9_$'); 912 } 913 914 registeredFlags[flag] = true; 915 } 916 917 /** 918 * Runs built-in and custom regex syntax tokens in reverse insertion order at the specified 919 * position, until a match is found. 920 * 921 * @private 922 * @param {String} pattern Original pattern from which an XRegExp object is being built. 923 * @param {String} flags Flags being used to construct the regex. 924 * @param {Number} pos Position to search for tokens within `pattern`. 925 * @param {Number} scope Regex scope to apply: 'default' or 'class'. 926 * @param {Object} context Context object to use for token handler functions. 927 * @returns {Object} Object with properties `matchLength`, `output`, and `reparse`; or `null`. 928 */ 929 function runTokens(pattern, flags, pos, scope, context) { 930 var i = tokens.length, 931 leadChar = pattern.charAt(pos), 932 result = null, 933 match, 934 t; 935 936 // Run in reverse insertion order 937 while (i--) { 938 t = tokens[i]; 939 if (t.leadChar && t.leadChar !== leadChar || t.scope !== scope && t.scope !== 'all' || t.flag && flags.indexOf(t.flag) === -1) { 940 continue; 941 } 942 943 match = XRegExp.exec(pattern, t.regex, pos, 'sticky'); 944 if (match) { 945 result = { 946 matchLength: match[0].length, 947 output: t.handler.call(context, match, scope, flags), 948 reparse: t.reparse 949 }; 950 // Finished with token tests 951 break; 952 } 953 } 954 955 return result; 956 } 957 958 /** 959 * Enables or disables implicit astral mode opt-in. When enabled, flag A is automatically added to 960 * all new regexes created by XRegExp. This causes an error to be thrown when creating regexes if 961 * the Unicode Base addon is not available, since flag A is registered by that addon. 962 * 963 * @private 964 * @param {Boolean} on `true` to enable; `false` to disable. 965 */ 966 function setAstral(on) { 967 features.astral = on; 968 } 969 970 /** 971 * Enables or disables native method overrides. 972 * 973 * @private 974 * @param {Boolean} on `true` to enable; `false` to disable. 975 */ 976 function setNatives(on) { 977 RegExp.prototype.exec = (on ? fixed : nativ).exec; 978 RegExp.prototype.test = (on ? fixed : nativ).test; 979 String.prototype.match = (on ? fixed : nativ).match; 980 String.prototype.replace = (on ? fixed : nativ).replace; 981 String.prototype.split = (on ? fixed : nativ).split; 982 983 features.natives = on; 984 } 985 986 /** 987 * Returns the object, or throws an error if it is `null` or `undefined`. This is used to follow 988 * the ES5 abstract operation `ToObject`. 989 * 990 * @private 991 * @param {*} value Object to check and return. 992 * @returns {*} The provided object. 993 */ 994 function toObject(value) { 995 // null or undefined 996 if (value == null) { 997 throw new TypeError('Cannot convert null or undefined to object'); 998 } 999 1000 return value; 1001 } 1002 1003 /* ============================== 1004 * Constructor 1005 * ============================== */ 1006 1007 /** 1008 * Creates an extended regular expression object for matching text with a pattern. Differs from a 1009 * native regular expression in that additional syntax and flags are supported. The returned object 1010 * is in fact a native `RegExp` and works with all native methods. 1011 * 1012 * @class XRegExp 1013 * @constructor 1014 * @param {String|RegExp} pattern Regex pattern string, or an existing regex object to copy. 1015 * @param {String} [flags] Any combination of flags. 1016 * Native flags: 1017 * <li>`g` - global 1018 * <li>`i` - ignore case 1019 * <li>
1019`m` - multiline anchors 1020 * <li>`u` - unicode (ES6) 1021 * <li>`y` - sticky (Firefox 3+, ES6) 1022 * Additional XRegExp flags: 1023 * <li>`n` - explicit capture 1024 * <li>`s` - dot matches all (aka singleline) 1025 * <li>`x` - free-spacing and line comments (aka extended) 1026 * <li>`A` - astral (requires the Unicode Base addon) 1027 * Flags cannot be provided when constructing one `RegExp` from another. 1028 * @returns {RegExp} Extended regular expression object. 1029 * @example 1030 * 1031 * // With named capture and flag x 1032 * XRegExp('(?<year> [0-9]{4} ) -? # year \n\ 1033 * (?<month> [0-9]{2} ) -? # month \n\ 1034 * (?<day> [0-9]{2} ) # day ', 'x'); 1035 * 1036 * // Providing a regex object copies it. Native regexes are recompiled using native (not XRegExp) 1037 * // syntax. Copies maintain extended data, are augmented with `XRegExp.prototype` properties, and 1038 * // have fresh `lastIndex` properties (set to zero). 1039 * XRegExp(/regex/); 1040 */ 1041 function XRegExp(pattern, flags) { 1042 var context = { 1043 hasNamedCapture: false, 1044 captureNames: [] 1045 }, 1046 scope = defaultScope, 1047 output = '', 1048 pos = 0, 1049 result, 1050 token, 1051 generated, 1052 appliedPattern, 1053 appliedFlags; 1054 1055 if (XRegExp.isRegExp(pattern)) { 1056 if (flags !== undefined) { 1057 throw new TypeError('Cannot supply flags when copying a RegExp'); 1058 } 1059 return copyRegex(pattern); 1060 } 1061 1062 // Copy the argument behavior of `RegExp` 1063 pattern = pattern === undefined ? '' : String(pattern); 1064 flags = flags === undefined ? '' : String(flags); 1065 1066 if (XRegExp.isInstalled('astral') && flags.indexOf('A') === -1) { 1067 // This causes an error to be thrown if the Unicode Base addon is not available 1068 flags += 'A'; 1069 } 1070 1071 if (!patternCache[pattern]) { 1072 patternCache[pattern] = {}; 1073 } 1074 1075 if (!patternCache[pattern][flags]) { 1076 // Check for flag-related errors, and strip/apply flags in a leading mode modifier 1077 result = prepareFlags(pattern, flags); 1078 appliedPattern = result.pattern; 1079 appliedFlags = result.flags; 1080 1081 // Use XRegExp's tokens to translate the pattern to a native regex pattern. 1082 // `appliedPattern.length` may change on each iteration if tokens use `reparse` 1083 while (pos < appliedPattern.length) { 1084 do { 1085 // Check for custom tokens at the current position 1086 result = runTokens(appliedPattern, appliedFlags, pos, scope, context); 1087 // If the matched token used the `reparse` option, splice its output into the 1088 // pattern before running tokens again at the same position 1089 if (result && result.reparse) { 1090 appliedPattern = appliedPattern.slice(0, pos) + result.output + appliedPattern.slice(pos + result.matchLength); 1091 } 1092 } while (result && result.reparse); 1093 1094 if (result) { 1095 output += result.output; 1096 pos += result.matchLength || 1; 1097 } else { 1098 // Get the native token at the current position 1099 token = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky')[0]; 1100 output += token; 1101 pos += token.length; 1102 if (token === '[' && scope === defaultScope) { 1103 scope = classScope; 1104 } else if (token === ']' && scope === classScope) { 1105 scope = defaultScope; 1106 } 1107 } 1108 } 1109 1110 patternCache[pattern][flags] = { 1111 // Cleanup token cruft: repeated `(?:)(?:)` and leading/trailing `(?:)` 1112 pattern: nativ.replace.call(output, /\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??(?=\(\?:\))|^\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??|\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??$/g, ''), 1113 // Strip all but native flags 1114 flags: nativ.replace.call(appliedFlags, /[^gimuy]+/g, ''), 1115 // `context.captureNames` has an item for each capturing group, even if unnamed 1116 captures: context.hasNamedCapture ? context.captureNames : null 1117 }; 1118 } 1119 1120 generated = patternCache[pattern][flags]; 1121 return augment(new RegExp(generated.pattern, generated.flags), generated.captures, pattern, flags); 1122 }; 1123 1124 // Add `RegExp.prototype` to the prototype chain 1125 XRegExp.prototype = new RegExp(); 1126 1127 /* ============================== 1128 * Public properties 1129 * ============================== */ 1130 1131 /** 1132 * The XRegExp version number as a string containing three dot-separated parts. For example, 1133 * '2.0.0-beta-3'. 1134 * 1135 * @static 1136 * @memberOf XRegExp
1137 * @type String 1138 */ 1139 XRegExp.version = '3.1.0-dev'; 1140 1141 /* ============================== 1142 * Public methods 1143 * ============================== */ 1144 1145 /** 1146 * Extends XRegExp syntax and allows custom flags. This is used internally and can be used to 1147 * create XRegExp addons. If more than one token can match the same string, the last added wins. 1148 * 1149 * @memberOf XRegExp 1150 * @param {RegExp} regex Regex object that matches the new token. 1151 * @param {Function} handler Function that returns a new pattern string (using native regex syntax) 1152 * to replace the matched token within all future XRegExp regexes. Has access to persistent 1153 * properties of the regex being built, through `this`. Invoked with three arguments: 1154 * <li>The match array, with named backreference properties. 1155 * <li>The regex scope where the match was found: 'default' or 'class'. 1156 * <li>The flags used by the regex, including any flags in a leading mode modifier. 1157 * The handler function becomes part of the XRegExp construction process, so be careful not to 1158 * construct XRegExps within the function or you will trigger infinite recursion. 1159 * @param {Object} [options] Options object with optional properties: 1160 * <li>`scope` {String} Scope where the token applies: 'default', 'class', or 'all'. 1161 * <li>`flag` {String} Single-character flag that triggers the token. This also registers the 1162 * flag, which prevents XRegExp from throwing an 'unknown flag' error when the flag is used. 1163 * <li>`optionalFlags` {String} Any custom flags checked for within the token `handler` that are 1164 * not required to trigger the token. This registers the flags, to prevent XRegExp from 1165 * throwing an 'unknown flag' error when any of the flags are used. 1166 * <li>`reparse` {Boolean} Whether the `handler` function's output should not be treated as 1167 * final, and instead be reparseable by other tokens (including the current token). Allows 1168 * token chaining or deferring. 1169 * <li>`leadChar` {String} Single character that occurs at the beginning of any successful match 1170 * of the token (not always applicable). This doesn't change the behavior of the token unless 1171 * you provide an erroneous value. However, providing it can increase the token's performance 1172 * since the token can be skipped at any positions where this character doesn't appear. 1173 * @example 1174 * 1175 * // Basic usage: Add \a for the ALERT control code 1176 * XRegExp.addToken( 1177 * /\\a/, 1178 * function() {return '\\x07';}, 1179 * {scope: 'all'} 1180 * ); 1181 * XRegExp('\\a[\\a-\\n]+').test('\x07\n\x07'); // -> true 1182 * 1183 * // Add the U (ungreedy) flag from PCRE and RE2, which reverses greedy and lazy quantifiers. 1184 * // Since `scope` is not specified, it uses 'default' (i.e., transformations apply outside of 1185 * // character classes only) 1186 * XRegExp.addToken( 1187 * /([?*+]|{\d+(?:,\d*)?})(\??)/, 1188 * function(match) {return match[1] + (match[2] ? '' : '?');}, 1189 * {flag: 'U'} 1190 * ); 1191 * XRegExp('a+', 'U').exec('aaa')[0]; // -> 'a' 1192 * XRegExp('a+?', 'U').exec('aaa')[0]; // -> 'aaa' 1193 */ 1194 XRegExp.addToken = function (regex, handler, options) { 1195 options = options || {}; 1196 var optionalFlags = options.optionalFlags, 1197 i; 1198 1199 if (options.flag) { 1200 registerFlag(options.flag); 1201 } 1202 1203 if (optionalFlags) { 1204 optionalFlags = nativ.split.call(optionalFlags, ''); 1205 for (i = 0; i < optionalFlags.length; ++i) { 1206 registerFlag(optionalFlags[i]); 1207 } 1208 } 1209 1210 // Add to the private list of syntax tokens 1211 tokens.push({ 1212 regex: copyRegex(regex, { 1213 addG: true, 1214 addY: hasNativeY, 1215 isInternalOnly: true 1216 }), 1217 handler: handler, 1218 scope: options.scope || defaultScope, 1219 flag: options.flag, 1220 reparse: options.reparse, 1221 leadChar: options.leadChar 1222 }); 1223 1224 // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and 1225 // flags might now produce different results 1226 XRegExp.cache.flush('patterns'); 1227 }; 1228 1229 /** 1230 * Caches and returns the result of calling `XRegExp(pattern, flags)`. On any subsequent call with 1231 * the same pattern and flag combination, the cached copy of the regex is returned. 1232 * 1233 * @memberOf XRegExp 1234 * @param {String} pattern Regex pattern string. 1235 * @param {String} [flags] Any combination of XRegExp flags. 1236 * @returns {RegExp} Cached XRegExp object. 1237 * @example 1238 *
1239 * while (match = XRegExp.cache('.', 'gs').exec(str)) { 1240 * // The regex is compiled once only 1241 * } 1242 */ 1243 XRegExp.cache = function (pattern, flags) { 1244 if (!regexCache[pattern]) { 1245 regexCache[pattern] = {}; 1246 } 1247 return regexCache[pattern][flags] || (regexCache[pattern][flags] = XRegExp(pattern, flags)); 1248 }; 1249 1250 // Intentionally undocumented 1251 XRegExp.cache.flush = function (cacheName) { 1252 if (cacheName === 'patterns') { 1253 // Flush the pattern cache used by the `XRegExp` constructor 1254 patternCache = {}; 1255 } else { 1256 // Flush the regex cache populated by `XRegExp.cache` 1257 regexCache = {}; 1258 } 1259 }; 1260 1261 /** 1262 * Escapes any regular expression metacharacters, for use when matching literal strings. The result 1263 * can safely be used at any point within a regex that uses any flags. 1264 * 1265 * @memberOf XRegExp 1266 * @param {String} str String to escape. 1267 * @returns {String} String with regex metacharacters escaped. 1268 * @example 1269 * 1270 * XRegExp.escape('Escaped? <.>'); 1271 * // -> 'Escaped\?\ <\.>' 1272 */ 1273 XRegExp.escape = function (str) { 1274 return nativ.replace.call(toObject(str), /[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); 1275 }; 1276 1277 /** 1278 * Executes a regex search in a specified string. Returns a match array or `null`. If the provided 1279 * regex uses named capture, named backreference properties are included on the match array. 1280 * Optional `pos` and `sticky` arguments specify the search start position, and whether the match 1281 * must start at the specified position only. The `lastIndex` property of the provided regex is not 1282 * used, but is updated for compatibility. Also fixes browser bugs compared to the native 1283 * `RegExp.prototype.exec` and can be used reliably cross-browser. 1284 * 1285 * @memberOf XRegExp 1286 * @param {String} str String to search. 1287 * @param {RegExp} regex Regex to search with. 1288 * @param {Number} [pos=0] Zero-based index at which to start the search. 1289 * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position 1290 * only. The string `'sticky'` is accepted as an alternative to `true`. 1291 * @returns {Array} Match array with named backreference properties, or `null`. 1292 * @example 1293 * 1294 * // Basic use, with named backreference 1295 * var match = XRegExp.exec('U+2620', XRegExp('U\\+(?<hex>[0-9A-F]{4})')); 1296 * match.hex; // -> '2620' 1297 * 1298 * // With pos and sticky, in a loop 1299 * var pos = 2, result = [], match; 1300 * while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) { 1301 * result.push(match[1]); 1302 * pos = match.index + match[0].length; 1303 * } 1304 * // result -> ['2', '3', '4'] 1305 */ 1306 XRegExp.exec = function (str, regex, pos, sticky) { 1307 var cacheKey = 'g', 1308 addY = false, 1309 match, 1310 r2; 1311 1312 addY = hasNativeY && !!(sticky || regex.sticky && sticky !== false); 1313 if (addY) { 1314 cacheKey += 'y'; 1315 } 1316 1317 regex[REGEX_DATA] = regex[REGEX_DATA] || {}; 1318 1319 // Shares cached copies with `XRegExp.match`/`replace` 1320 r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, { 1321 addG: true, 1322 addY: addY, 1323 removeY: sticky === false, 1324 isInternalOnly: true 1325 })); 1326 1327 r2.lastIndex = pos = pos || 0; 1328 1329 // Fixed `exec` required for `lastIndex` fix, named backreferences, etc. 1330 match = fixed.exec.call(r2, str); 1331 1332 if (sticky && match && match.index !== pos) { 1333 match = null; 1334 } 1335 1336 if (regex.global) { 1337 regex.lastIndex = match ? r2.lastIndex : 0; 1338 } 1339 1340 return match; 1341 }; 1342 1343 /** 1344 * Executes a provided function once per regex match. Searches always start at the beginning of the 1345 * string and continue until the end, regardless of the state of the regex's `global` property and 1346 * initial `lastIndex`. 1347 * 1348 * @memberOf XRegExp 1349 * @param {String} str String to search. 1350 * @param {RegExp} regex Regex to search with. 1351 * @param {Function} callback Function to execute for each match. Invoked with four arguments: 1352 * <li>The match array, with named backreference properties. 1353 * <li>The zero-based match index. 1354 * <li>The string being traversed. 1355 * <li>The regex object being used to traverse the string. 1356 * @example 1357 * 1358 * // Extracts every other digit from a string 1359 * var evens = [];
1360 * XRegExp.forEach('1a2345', /\d/, function(match, i) { 1361 * if (i % 2) evens.push(+match[0]); 1362 * }); 1363 * // evens -> [2, 4] 1364 */ 1365 XRegExp.forEach = function (str, regex, callback) { 1366 var pos = 0, 1367 i = -1, 1368 match; 1369 1370 while (match = XRegExp.exec(str, regex, pos)) { 1371 // Because `regex` is provided to `callback`, the function could use the deprecated/ 1372 // nonstandard `RegExp.prototype.compile` to mutate the regex. However, since 1373 // `XRegExp.exec` doesn't use `lastIndex` to set the search position, this can't lead 1374 // to an infinite loop, at least. Actually, because of the way `XRegExp.exec` caches 1375 // globalized versions of regexes, mutating the regex will not have any effect on the 1376 // iteration or matched strings, which is a nice side effect that brings extra safety 1377 callback(match, ++i, str, regex); 1378 1379 pos = match.index + (match[0].length || 1); 1380 } 1381 }; 1382 1383 /** 1384 * Copies a regex object and adds flag `g`. The copy maintains extended data, is augmented with 1385 * `XRegExp.prototype` properties, and has a fresh `lastIndex` property (set to zero). Native 1386 * regexes are not recompiled using XRegExp syntax. 1387 * 1388 * @memberOf XRegExp 1389 * @param {RegExp} regex Regex to globalize. 1390 * @returns {RegExp} Copy of the provided regex with flag `g` added. 1391 * @example 1392 * 1393 * var globalCopy = XRegExp.globalize(/regex/); 1394 * globalCopy.global; // -> true 1395 */ 1396 XRegExp.globalize = function (regex) { 1397 return copyRegex(regex, { addG: true }); 1398 }; 1399 1400 /** 1401 * Installs optional features according to the specified options. Can be undone using 1402 * {@link #XRegExp.uninstall}. 1403 * 1404 * @memberOf XRegExp 1405 * @param {Object|String} options Options object or string. 1406 * @example 1407 * 1408 * // With an options object 1409 * XRegExp.install({ 1410 * // Enables support for astral code points in Unicode addons (implicitly sets flag A) 1411 * astral: true, 1412 * 1413 * // Overrides native regex methods with fixed/extended versions that support named 1414 * // backreferences and fix numerous cross-browser bugs 1415 * natives: true 1416 * }); 1417 * 1418 * // With an options string 1419 * XRegExp.install('astral natives'); 1420 */ 1421 XRegExp.install = function (options) { 1422 options = prepareOptions(options); 1423 1424 if (!features.astral && options.astral) { 1425 setAstral(true); 1426 } 1427 1428 if (!features.natives && options.natives) { 1429 setNatives(true); 1430 } 1431 }; 1432 1433 /** 1434 * Checks whether an individual optional feature is installed. 1435 * 1436 * @memberOf XRegExp 1437 * @param {String} feature Name of the feature to check. One of: 1438 * <li>`natives` 1439 * <li>`astral` 1440 * @returns {Boolean} Whether the feature is installed. 1441 * @example 1442 * 1443 * XRegExp.isInstalled('natives'); 1444 */ 1445 XRegExp.isInstalled = function (feature) { 1446 return !!features[feature]; 1447 }; 1448 1449 /** 1450 * Returns `true` if an object is a regex; `false` if it isn't. This works correctly for regexes 1451 * created in another frame, when `instanceof` and `constructor` checks would fail. 1452 * 1453 * @memberOf XRegExp 1454 * @param {*} value Object to check. 1455 * @returns {Boolean} Whether the object is a `RegExp` object. 1456 * @example 1457 * 1458 * XRegExp.isRegExp('string'); // -> false 1459 * XRegExp.isRegExp(/regex/i); // -> true 1460 * XRegExp.isRegExp(RegExp('^', 'm')); // -> true 1461 * XRegExp.isRegExp(XRegExp('(?s).')); // -> true 1462 */ 1463 XRegExp.isRegExp = function (value) { 1464 return toString.call(value) === '[object RegExp]'; 1465 //return isType(value, 'RegExp'); 1466 }; 1467 1468 /** 1469 * Returns the first matched string, or in global mode, an array containing all matched strings. 1470 * This is essentially a more convenient re-implementation of `String.prototype.match` that gives 1471 * the result types you actually want (string instead of `exec`-style array in match-first mode, 1472 * and an empty array instead of `null` when no matches are found in match-all mode). It also lets 1473 * you override flag g and ignore `lastIndex`, and fixes browser bugs. 1474 * 1475 * @memberOf XRegExp 1476 * @param {String} str String to search. 1477 * @param {RegExp} regex Regex to search with. 1478 * @param {String} [scope='one'] Use 'one' to return the first match as a string. Use 'all' to 1479 * return an array of all matched strings. If not explicitly specified and `regex` uses flag g, 1480 * `scope` is 'all'. 1481 * @returns {String|Array} In match-first mode: First match as a string, or `null`. In match-all 1482 * mode: Array of all matched strings, or an empty array. 1483 * @example 1484 *
1485 * // Match first 1486 * XRegExp.match('abc', /\w/); // -> 'a' 1487 * XRegExp.match('abc', /\w/g, 'one'); // -> 'a' 1488 * XRegExp.match('abc', /x/g, 'one'); // -> null 1489 * 1490 * // Match all 1491 * XRegExp.match('abc', /\w/g); // -> ['a', 'b', 'c'] 1492 * XRegExp.match('abc', /\w/, 'all'); // -> ['a', 'b', 'c'] 1493 * XRegExp.match('abc', /x/, 'all'); // -> [] 1494 */ 1495 XRegExp.match = function (str, regex, scope) { 1496 var global = regex.global && scope !== 'one' || scope === 'all', 1497 cacheKey = (global ? 'g' : '') + (regex.sticky ? 'y' : '') || 'noGY', 1498 result, 1499 r2; 1500 1501 regex[REGEX_DATA] = regex[REGEX_DATA] || {}; 1502 1503 // Shares cached copies with `XRegExp.exec`/`replace` 1504 r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, { 1505 addG: !!global, 1506 addY: !!regex.sticky, 1507 removeG: scope === 'one', 1508 isInternalOnly: true 1509 })); 1510 1511 result = nativ.match.call(toObject(str), r2); 1512 1513 if (regex.global) { 1514 regex.lastIndex = scope === 'one' && result ? 1515 // Can't use `r2.lastIndex` since `r2` is nonglobal in this case 1516 result.index + result[0].length : 0; 1517 } 1518 1519 return global ? result || [] : result && result[0]; 1520 }; 1521 1522 /** 1523 * Retrieves the matches from searching a string using a chain of regexes that successively search 1524 * within previous matches. The provided `chain` array can contain regexes and or objects with 1525 * `regex` and `backref` properties. When a backreference is specified, the named or numbered 1526 * backreference is passed forward to the next regex or returned. 1527 * 1528 * @memberOf XRegExp 1529 * @param {String} str String to search. 1530 * @param {Array} chain Regexes that each search for matches within preceding results. 1531 * @returns {Array} Matches by the last regex in the chain, or an empty array. 1532 * @example 1533 * 1534 * // Basic usage; matches numbers within <b> tags 1535 * XRegExp.matchChain('1 <b>2</b> 3 <b>4 a 56</b>', [ 1536 * XRegExp('(?is)<b>.*?</b>'), 1537 * /\d+/ 1538 * ]); 1539 * // -> ['2', '4', '56'] 1540 * 1541 * // Passing forward and returning specific backreferences 1542 * html = '<a href="http://xregexp.com/api/">XRegExp</a>\ 1543 * <a href="http://www.google.com/">Google</a>'; 1544 * XRegExp.matchChain(html, [ 1545 * {regex: /<a href="([^"]+)">/i, backref: 1}, 1546 * {regex: XRegExp('(?i)^https?://(?<domain>[^/?#]+)'), backref: 'domain'} 1547 * ]); 1548 * // -> ['xregexp.com', 'www.google.com'] 1549 */ 1550 XRegExp.matchChain = function (str, chain) { 1551 return function recurseChain(values, level) { 1552 var item = chain[level].regex ? chain[level] : { regex: chain[level] }, 1553 matches = [], 1554 addMatch = function addMatch(match) { 1555 if (item.backref) { 1556 /* Safari 4.0.5 (but not 5.0.5+) inappropriately uses sparse arrays to hold 1557 * the `undefined`s for backreferences to nonparticipating capturing 1558 * groups. In such cases, a `hasOwnProperty` or `in` check on its own would 1559 * inappropriately throw the exception, so also check if the backreference 1560 * is a number that is within the bounds of the array. 1561 */ 1562 if (!(match.hasOwnProperty(item.backref) || +item.backref < match.length)) { 1563 throw new ReferenceError('Backreference to undefined group: ' + item.backref); 1564 } 1565 1566 matches.push(match[item.backref] || ''); 1567 } else { 1568 matches.push(match[0]); 1569 } 1570 }, 1571 i; 1572 1573 for (i = 0; i < values.length; ++i) { 1574 XRegExp.forEach(values[i], item.regex, addMatch); 1575 } 1576 1577 return level === chain.length - 1 || !matches.length ? matches : recurseChain(matches, level + 1); 1578 }([str], 0); 1579 }; 1580 1581 /** 1582 * Returns a new string with one or all matches of a pattern replaced. The pattern can be a string 1583 * or regex, and the replacement can be a string or a function to be called for each match. To 1584 * perform a global search and replace, use the optional `scope` argument or include flag g if using 1585 * a regex. Replacement strings can use `${n}` for named and numbered backreferences. Replacement 1586 * functions can use named backreferences via `arguments[0].name`. Also fixes browser bugs compared 1587 * to the native `String.prototype.replace` and can be used reliably cross-browser. 1588 * 1589 * @memberOf XRegExp 1590 * @param {String} str String to search. 1591 * @param {RegExp|String} search Search pattern to be replaced. 1592 * @param {String|Function} replacement Replacement string or a function invoked to create it. 1593 * Replacement strings can include special replacement syntax: 1594 * <li>$$ - Inserts a literal $ character. 1595 * <li>$&, $0 - Inserts the matched substring. 1596 * <li>$` - Inserts the string that precedes the matched substring (left context). 1597 * <li>$' - Inserts the string that follows the matched substring (right context). 1598 * <li>$n, $nn - Where n/nn are digits referencing an existent capturing group, inserts 1599 * backreference n/nn. 1600 * <li>${n} - Where n is a name or any number of digits that reference an existent capturing 1601 * group, inserts backreference n. 1602 * Replacement functions are invoked with three or more arguments: 1603 * <li>The matched substring (corresponds to $& above). Named backreferences are accessible as 1604 * properties of this first argument. 1605 * <li>0..n arguments, one for each backreference (corresponding to $1, $2, etc. above). 1606 * <li>The zero-based index of the match within the total search string. 1607 * <li>The total string being searched. 1608 * @param {String} [scope='one'] Use 'one' to replace the first match only, or 'all'. If not 1609 * explicitly specified and using a regex with flag g, `scope` is 'all'. 1610 * @returns {String} New string with one or all matches replaced. 1611 * @example 1612 * 1613 * // Regex search, using named backreferences in replacement string 1614 * var name = XRegExp('(?<first>\\w+) (?<last>
1614\\w+)'); 1615 * XRegExp.replace('John Smith', name, '${last}, ${first}'); 1616 * // -> 'Smith, John' 1617 * 1618 * // Regex search, using named backreferences in replacement function 1619 * XRegExp.replace('John Smith', name, function(match) { 1620 * return match.last + ', ' + match.first; 1621 * }); 1622 * // -> 'Smith, John' 1623 * 1624 * // String search, with replace-all 1625 * XRegExp.replace('RegExp builds RegExps', 'RegExp', 'XRegExp', 'all'); 1626 * // -> 'XRegExp builds XRegExps' 1627 */ 1628 XRegExp.replace = function (str, search, replacement, scope) { 1629 var isRegex = XRegExp.isRegExp(search), 1630 global = search.global && scope !== 'one' || scope === 'all', 1631 cacheKey = (global ? 'g' : '') + (search.sticky ? 'y' : '') || 'noGY', 1632 s2 = search, 1633 result; 1634 1635 if (isRegex) { 1636 search[REGEX_DATA] = search[REGEX_DATA] || {}; 1637 1638 // Shares cached copies with `XRegExp.exec`/`match`. Since a copy is used, `search`'s 1639 // `lastIndex` isn't updated *during* replacement iterations 1640 s2 = search[REGEX_DATA][cacheKey] || (search[REGEX_DATA][cacheKey] = copyRegex(search, { 1641 addG: !!global, 1642 addY: !!search.sticky, 1643 removeG: scope === 'one', 1644 isInternalOnly: true 1645 })); 1646 } else if (global) { 1647 s2 = new RegExp(XRegExp.escape(String(search)), 'g'); 1648 } 1649 1650 // Fixed `replace` required for named backreferences, etc. 1651 result = fixed.replace.call(toObject(str), s2, replacement); 1652 1653 if (isRegex && search.global) { 1654 // Fixes IE, Safari bug (last tested IE 9, Safari 5.1) 1655 search.lastIndex = 0; 1656 } 1657 1658 return result; 1659 }; 1660 1661 /** 1662 * Performs batch processing of string replacements. Used like {@link #XRegExp.replace}, but 1663 * accepts an array of replacement details. Later replacements operate on the output of earlier 1664 * replacements. Replacement details are accepted as an array with a regex or string to search for, 1665 * the replacement string or function, and an optional scope of 'one' or 'all'. Uses the XRegExp 1666 * replacement text syntax, which supports named backreference properties via `${name}`. 1667 * 1668 * @memberOf XRegExp 1669 * @param {String} str String to search. 1670 * @param {Array} replacements Array of replacement detail arrays. 1671 * @returns {String} New string with all replacements. 1672 * @example 1673 * 1674 * str = XRegExp.replaceEach(str, [ 1675 * [XRegExp('(?<name>a)'), 'z${name}'], 1676 * [/b/gi, 'y'], 1677 * [/c/g, 'x', 'one'], // scope 'one' overrides /g 1678 * [/d/, 'w', 'all'], // scope 'all' overrides lack of /g 1679 * ['e', 'v', 'all'], // scope 'all' allows replace-all for strings 1680 * [/f/g, function($0) { 1681 * return $0.toUpperCase(); 1682 * }] 1683 * ]); 1684 */ 1685 XRegExp.replaceEach = function (str, replacements) { 1686 var i, r; 1687 1688 for (i = 0; i < replacements.length; ++i) { 1689 r = replacements[i]; 1690 str = XRegExp.replace(str, r[0], r[1], r[2]); 1691 } 1692 1693 return str; 1694 }; 1695 1696 /** 1697 * Splits a string into an array of strings using a regex or string separator. Matches of the 1698 * separator are not included in the result array. However, if `separator` is a regex that contains 1699 * capturing groups, backreferences are spliced into the result each time `separator` is matched. 1700 * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably 1701 * cross-browser. 1702 * 1703 * @memberOf XRegExp 1704 * @param {String} str String to split. 1705 * @param {RegExp|String} separator Regex or string to use for separating the string. 1706 * @param {Number} [limit] Maximum number of items to include in the result array. 1707 * @returns {Array} Array of substrings. 1708 * @example 1709 * 1710 * // Basic use 1711 * XRegExp.split('a b c', ' '); 1712 * // -> ['a', 'b', 'c'] 1713 * 1714 * // With limit 1715 * XRegExp.split('a b c', ' ', 2); 1716 * // -> ['a', 'b'] 1717 * 1718 * // Backreferences in result array 1719 * XRegExp.split('..word1..', /([a-z]+)(\d+)/i); 1720 * // -> ['..', 'word', '1', '..'] 1721 */ 1722 XRegExp.split = function (str, separator, limit) { 1723 return fixed.split.call(toObject(str), separator, limit); 1724 }; 1725 1726 /** 1727 * Executes a regex search in a specified string. Returns `true` or `false`. Optional `pos` and 1728 * `sticky` arguments specify the search start position, and whether the match must start at the 1729 * specified position only. The `lastIndex` property of the provided regex is not used, but is 1730 * updated for compatibility. Also fixes browser bugs compared to the native 1731 * `RegExp.prototype.test` and can be used reliably cross-browser. 1732 * 1733 * @memberOf XRegExp 1734 * @param {String} str String to search. 1735 * @param {RegExp} regex Regex to search with. 1736 * @param {Number} [pos=0] Zero-based index at which to start the search. 1737 * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position 1738 * only. The string `'sticky'` is accepted as an alternative to `true`. 1739 * @returns {Boolean} Whether the regex matched the provided value. 1740 * @example 1741 * 1742 * // Basic use 1743 * XRegExp.test('abc', /c/); // -> true 1744 * 1745 * // With pos and sticky 1746 * XRegExp.test('abc', /c/, 0, 'sticky'); // -> false 1747 * XRegExp.test('abc', /c/, 2, 'sticky'); // -> true 1748 */ 1749 XRegExp.test = function (str, regex, pos, sticky) { 1750 // Do this the easy way :-) 1751 return !!XRegExp.exec(str, regex, pos, sticky); 1752 }; 1753 1754 /** 1755 * Uninstalls optional features according to the specified options. All optional features start out 1756 * uninstalled, so this is used to undo the actions of {@link #XRegExp.install}. 1757 * 1758 * @memberOf XRegExp 1759 * @param {Object|String} options Options object or string. 1760 * @example 1761 * 1762 * // With an options object 1763 * XRegExp.uninstall({ 1764 * // Disables support for astral code points in Unicode addons 1765 * astral: true, 1766 * 1767 * // Restores native regex methods 1768 * natives: true 1769 * }); 1770 * 1771 * // With an options string 1772 * XRegExp.uninstall('astral natives'); 1773 */ 1774 XRegExp.uninstall = function (options) { 1775 options = prepareOptions(options); 1776 1777 if (features.astral && options.astral) { 1778 setAstral(false); 1779 } 1780 1781 if (features.natives && options.natives) { 1782 setNatives(false); 1783 } 1784 }; 1785 1786 /** 1787 * Returns an XRegExp object that is the union of the given patterns. Patterns can be provided as 1788 * regex objects or strings. Metacharacters are escaped in patterns provided as strings. 1789 * Backreferences in provided regex objects are automatically renumbered to work correctly within 1790 * the larger combined pattern. Native flags used by provided regexes are ignored in favor of the 1791 * `flags` argument. 1792 * 1793 * @memberOf XRegExp 1794 * @param {Array} patterns Regexes and strings to combine. 1795 * @param {String} [flags] Any combination of XRegExp flags. 1796 * @returns {RegExp} Union of the provided regexes and strings. 1797 * @example 1798 * 1799 * XRegExp.union(['a+b*c', /(dogs)\1/, /(cats)\1/], 'i'); 1800 * // -> /a\+b\*c|(dogs)\1|(cats)\2/i 1801 */ 1802 XRegExp.union = function (patterns, flags) { 1803 var parts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*]/g, 1804 output = [], 1805 numCaptures = 0, 1806 numPriorCaptures, 1807 captureNames, 1808 pattern, 1809 rewrite = function rewrite(match, paren, backref) { 1810 var name = captureNames[numCaptures - numPriorCaptures]; 1811 1812 // Capturing group 1813 if (paren) { 1814 ++numCaptures; 1815 // If the current capture has a name, preserve the name 1816 if (name) { 1817 return '(?<' + name + '>'; 1818 } 1819 // Backreference 1820 } else if (backref) { 1821 // Rewrite the backreference 1822 return '\\' + (+backref + numPriorCaptures); 1823 } 1824 1825 return match; 1826 }, 1827 i; 1828 1829 if (!(isType(patterns, 'Array') && patterns.length)) { 1830 throw new TypeError('Must provide a nonempty array of patterns to merge'); 1831 } 1832 1833 for (i = 0; i < patterns.length; ++i) { 1834 pattern = patterns[i]; 1835 1836 if (XRegExp.isRegExp(pattern)) { 1837 numPriorCaptures = numCaptures; 1838 captureNames = pattern[REGEX_DATA] && pattern[REGEX_DATA].captureNames || []; 1839 1840 // Rewrite backreferences. Passing to XRegExp dies on octals and ensures patterns 1841 // are independently valid; helps keep this simple. Named captures are put back 1842 output.push(nativ.replace.call(XRegExp(pattern.source).source, parts, rewrite)); 1843 } else { 1844 output.push(XRegExp.escape(pattern)); 1845 } 1846 } 1847 1848 return XRegExp(output.join('|'), flags); 1849 }; 1850 1851 /* ============================== 1852 * Fixed/extended native methods 1853 * ============================== */ 1854 1855 /** 1856 * Adds named capture support (with backreferences returned as `result.name`), and fixes browser 1857 * bugs in the native `RegExp.prototype.exec`. Calling `XRegExp.install('natives')` uses this to 1858 * override the native method. Use via `XRegExp.exec` without overriding natives. 1859 * 1860 * @private 1861 * @param {String} str String to search. 1862 * @returns {Array}
1862 Match array with named backreference properties, or `null`. 1863 */ 1864 fixed.exec = function (str) { 1865 var origLastIndex = this.lastIndex, 1866 match = nativ.exec.apply(this, arguments), 1867 name, 1868 r2, 1869 i; 1870 1871 if (match) { 1872 // Fix browsers whose `exec` methods don't return `undefined` for nonparticipating 1873 // capturing groups. This fixes IE 5.5-8, but not IE 9's quirks mode or emulation of 1874 // older IEs. IE 9 in standards mode follows the spec 1875 if (!correctExecNpcg && match.length > 1 && indexOf(match, '') > -1) { 1876 r2 = copyRegex(this, { 1877 removeG: true, 1878 isInternalOnly: true 1879 }); 1880 // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed 1881 // matching due to characters outside the match 1882 nativ.replace.call(String(str).slice(match.index), r2, function () { 1883 var len = arguments.length, 1884 i; 1885 // Skip index 0 and the last 2 1886 for (i = 1; i < len - 2; ++i) { 1887 if (arguments[i] === undefined) { 1888 match[i] = undefined; 1889 } 1890 } 1891 }); 1892 } 1893 1894 // Attach named capture properties 1895 if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) { 1896 // Skip index 0 1897 for (i = 1; i < match.length; ++i) { 1898 name = this[REGEX_DATA].captureNames[i - 1]; 1899 if (name) { 1900 match[name] = match[i]; 1901 } 1902 } 1903 } 1904 1905 // Fix browsers that increment `lastIndex` after zero-length matches 1906 if (this.global && !match[0].length && this.lastIndex > match.index) { 1907 this.lastIndex = match.index; 1908 } 1909 } 1910 1911 if (!this.global) { 1912 // Fixes IE, Opera bug (last tested IE 9, Opera 11.6) 1913 this.lastIndex = origLastIndex; 1914 } 1915 1916 return match; 1917 }; 1918 1919 /** 1920 * Fixes browser bugs in the native `RegExp.prototype.test`. Calling `XRegExp.install('natives')` 1921 * uses this to override the native method. 1922 * 1923 * @private 1924 * @param {String} str String to search. 1925 * @returns {Boolean} Whether the regex matched the provided value. 1926 */ 1927 fixed.test = function (str) { 1928 // Do this the easy way :-) 1929 return !!fixed.exec.call(this, str); 1930 }; 1931 1932 /** 1933 * Adds named capture support (with backreferences returned as `result.name`), and fixes browser 1934 * bugs in the native `String.prototype.match`. Calling `XRegExp.install('natives')` uses this to 1935 * override the native method. 1936 * 1937 * @private 1938 * @param {RegExp|*} regex Regex to search with. If not a regex object, it is passed to `RegExp`. 1939 * @returns {Array} If `regex` uses flag g, an array of match strings or `null`. Without flag g, 1940 * the result of calling `regex.exec(this)`. 1941 */ 1942 fixed.match = function (regex) { 1943 var result; 1944 1945 if (!XRegExp.isRegExp(regex)) { 1946 // Use the native `RegExp` rather than `XRegExp` 1947 regex = new RegExp(regex); 1948 } else if (regex.global) { 1949 result = nativ.match.apply(this, arguments); 1950 // Fixes IE bug 1951 regex.lastIndex = 0; 1952 1953 return result; 1954 } 1955 1956 return fixed.exec.call(regex, toObject(this)); 1957 }; 1958 1959 /** 1960 * Adds support for `${n}` tokens for named and numbered backreferences in replacement text, and 1961 * provides named backreferences to replacement functions as `arguments[0].name`. Also fixes browser 1962 * bugs in replacement text syntax when performing a replacement using a nonregex search value, and 1963 * the value of a replacement regex's `lastIndex` property during replacement iterations and upon 1964 * completion. Calling `XRegExp.install('natives')` uses this to override the native method. Note 1965 * that this doesn't support SpiderMonkey's proprietary third (`flags`) argument. Use via 1966 * `XRegExp.replace` without overriding natives. 1967 * 1968 * @private 1969 * @param {RegExp|String} search Search pattern to be replaced. 1970 * @param {String|Function} replacement Replacement string or a function invoked to create it. 1971 * @returns {String} New string with one or all matches replaced. 1972 */ 1973 fixed.replace = function (search, replacement) { 1974 var isRegex = XRegExp.isRegExp(search), 1975 origLastIndex, 1976 captureNames, 1977 result; 1978 1979 if (isRegex) { 1980 if (search[REGEX_DATA]) { 1981 captureNames = search[REGEX_DATA].captureNames; 1982 } 1983 // Only needed if `search` is nonglobal 1984 origLastIndex = search.lastIndex; 1985 } else { 1986 search += ''; // Type-convert 1987 } 1988 1989 // Don't use `typeof`; some older browsers return 'function' for regex objects 1990 if (isType(replacement, 'Function')) { 1991 // Stringifying `this` fixes a bug in IE < 9 where the last argument in replacement 1992 // functions isn't type-converted to a string 1993 result = nativ.replace.call(String(this), search, function () { 1994 var args = arguments, 1995 i; 1996 if (captureNames) { 1997 // Change the `arguments[0]` string primitive to a `String` object that can 1998 // store properties. This really does need to use `String` as a constructor 1999 args[0] = new String(args[0]); 2000 // Store named backreferences on the first argument 2001 for (i = 0; i < captureNames.length; ++i) { 2002 if (captureNames[i]) { 2003 args[0][captureNames[i]] = args[i + 1]; 2004 } 2005 } 2006 } 2007 // Update `lastIndex` before calling `replacement`. Fixes IE, Chrome, Firefox, 2008 // Safari bug (last tested IE 9, Chrome 17, Firefox 11, Safari 5.1) 2009 if (isRegex && search.global) { 2010 search.lastIndex = args[args.length - 2] + args[0].length; 2011 } 2012 // ES6 specs the context for replacement functions as `undefined` 2013 return replacement.apply(undefined, args); 2014 }); 2015 } else { 2016 // Ensure that the last value of `args` will be a string when given nonstring `this`, 2017 // while still throwing on null or undefined context 2018 result = nativ.replace.call(this == null ? this : String(this), search, function () { 2019 // Keep this function's `arguments` available through closure 2020 var args = arguments; 2021 return nativ.replace.call(String(replacement), replacementToken, function ($0, $1, $2) { 2022 var n; 2023 // Named or numbered backreference with curly braces 2024 if ($1) { 2025 // XRegExp behavior for `${n}`: 2026 // 1. Backreference to numbered capture, if `n` is an integer. Use `0` for 2027 // for the entire match. Any number of leading zeros may be used. 2028 // 2. Backreference to named capture `n`, if it exists and is not an 2029 // integer overridden by numbered capture. In practice, this does not 2030 // overlap with numbered capture since XRegExp does not allow named 2031 // capture to use a bare integer as the name. 2032 // 3. If the name or number does not refer to an existing capturing group, 2033 // it's an error. 2034 n = +$1; // Type-convert; drop leading zeros 2035 if (n <= args.length - 3) { 2036 return args[n] || ''; 2037 } 2038 // Groups with the same name is an error, else would need `lastIndexOf` 2039 n = captureNames ? indexOf(captureNames, $1) : -1; 2040 if (n < 0) { 2041 throw new SyntaxError('Backreference to undefined group ' + $0); 2042 } 2043 return args[n + 1] || ''; 2044 } 2045 // Else, special variable or numbered backreference without curly braces 2046 if ($2 === '$') { 2047 // $$ 2048 return '$'; 2049 } 2050 if ($2 === '&' || +$2 === 0) { 2051 // $&, $0 (not followed by 1-9), $00 2052 return args[0]; 2053 } 2054 if ($2 === '`') { 2055 // $` (left context) 2056 return args[args.length - 1].slice(0, args[args.length - 2]); 2057 } 2058 if ($2 === "'") { 2059 // $' (right context) 2060 return args[args.length - 1].slice(args[args.length - 2] + args[0].length); 2061 } 2062 // Else, numbered backreference without curly braces 2063 $2 = +$2; // Type-convert; drop leading zero 2064 // XRegExp behavior for `$n` and `$nn`: 2065 // - Backrefs end after 1 or 2 digits. Use `${..}` for more digits. 2066 // - `$1` is an error if no capturing groups. 2067 // - `$10` is an error if less than 10 capturing groups. Use `${1}0` instead. 2068 // - `$01` is `$1` if at least one capturing group, else it's an error. 2069 // - `$0` (not followed by 1-9) and `$00` are the entire match. 2070 // Native behavior, for comparison: 2071 // - Backrefs end after 1 or 2 digits. Cannot reference capturing group 100+. 2072 // - `$1` is a literal `$1` if no capturing groups. 2073 // - `$10` is `$1` followed by a literal `0` if less than 10 capturing groups. 2074 // - `$01` is `$1` if at least one capturing group, else it's a literal `$01`. 2075 // - `$0` is a literal `$0`. 2076 if (!isNaN($2)) { 2077 if ($2 > args.length - 3) { 2078 throw new SyntaxError('Backreference to undefined group ' + $0); 2079 } 2080 return args[$2] || ''; 2081 } 2082 // `$` followed by an unsupported char is an error, unlike native JS 2083 throw new SyntaxError('Invalid token ' + $0); 2084 }); 2085 }); 2086 } 2087 2088 if (isRegex) { 2089 if (search.global) { 2090 // Fixes IE, Safari bug (last tested IE 9, Safari 5.1) 2091 search.lastIndex = 0; 2092 } else { 2093 // Fixes IE, Opera bug (last tested IE 9, Opera 11.6) 2094 search.lastIndex = origLastIndex; 2095 } 2096 } 2097 2098 return result; 2099 }; 2100 2101 /** 2102 * Fixes browser bugs in the native `String.prototype.split`. Calling `XRegExp.install('natives')` 2103 * uses this to override the native method. Use via `XRegExp.split` without overriding natives. 2104 * 2105 * @private 2106 * @param {RegExp|String} separator Regex or string to use for separating the string. 2107 * @param {Number} [limit] Maximum number of items to include in the result array. 2108 * @returns {Array} Array of substrings. 2109 */ 2110 fixed.split = function (separator, limit) { 2111 if (!XRegExp.isRegExp(separator)) { 2112 // Browsers handle nonregex split correctly, so use the faster native method 2113 return nativ.split.apply(this, arguments); 2114 } 2115 2116 var str = String(this), 2117 output = [], 2118 origLastIndex = separator.lastIndex, 2119 lastLastIndex = 0, 2120 lastLength; 2121 2122 // Values for `limit`, per the spec: 2123 // If undefined: pow(2,32) - 1 2124 // If 0, Infinity, or NaN: 0 2125 // If positive number: limit = floor(limit); if (limit >= pow(2,32)) limit -= pow(2,32); 2126 // If negative number: pow(2,32) - floor(abs(limit)) 2127 // If other: Type-convert, then use the above rules 2128 // This line fails in very strange ways for some values of `limit` in Opera 10.5-10.63, 2129 // unless Opera Dragonfly is open (go figure). It works in at least Opera 9.5-10.1 and 11+ 2130 limit = (limit === undefined ? -1 : limit) >>> 0; 2131
2132 XRegExp.forEach(str, separator, function (match) { 2133 // This condition is not the same as `if (match[0].length)` 2134 if (match.index + match[0].length > lastLastIndex) { 2135 output.push(str.slice(lastLastIndex, match.index)); 2136 if (match.length > 1 && match.index < str.length) { 2137 Array.prototype.push.apply(output, match.slice(1)); 2138 } 2139 lastLength = match[0].length; 2140 lastLastIndex = match.index + lastLength; 2141 } 2142 }); 2143 2144 if (lastLastIndex === str.length) { 2145 if (!nativ.test.call(separator, '') || lastLength) { 2146 output.push(''); 2147 } 2148 } else { 2149 output.push(str.slice(lastLastIndex)); 2150 } 2151 2152 separator.lastIndex = origLastIndex; 2153 return output.length > limit ? output.slice(0, limit) : output; 2154 }; 2155 2156 /* ============================== 2157 * Built-in syntax/flag tokens 2158 * ============================== */ 2159 2160 /* 2161 * Letter escapes that natively match literal characters: `\a`, `\A`, etc. These should be 2162 * SyntaxErrors but are allowed in web reality. XRegExp makes them errors for cross-browser 2163 * consistency and to reserve their syntax, but lets them be superseded by addons. 2164 */ 2165 XRegExp.addToken(/\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4}|{[\dA-Fa-f]+})|x(?![\dA-Fa-f]{2}))/, function (match, scope) { 2166 // \B is allowed in default scope only 2167 if (match[1] === 'B' && scope === defaultScope) { 2168 return match[0]; 2169 } 2170 throw new SyntaxError('Invalid escape ' + match[0]); 2171 }, { 2172 scope: 'all', 2173 leadChar: '\\' 2174 }); 2175 2176 /* 2177 * Unicode code point escape with curly braces: `\u{N..}`. `N..` is any one or more digit 2178 * hexadecimal number from 0-10FFFF, and can include leading zeros. Requires the native ES6 `u` flag 2179 * to support code points greater than U+FFFF. Avoids converting code points above U+FFFF to 2180 * surrogate pairs (which could be done without flag `u`), since that could lead to broken behavior 2181 * if you follow a `\u{N..}` token that references a code point above U+FFFF with a quantifier, or 2182 * if you use the same in a character class. 2183 */ 2184 XRegExp.addToken(/\\u{([\dA-Fa-f]+)}/, function (match, scope, flags) { 2185 var code = dec(match[1]); 2186 if (code > 0x10FFFF) { 2187 throw new SyntaxError('Invalid Unicode code point ' + match[0]); 2188 } 2189 if (code <= 0xFFFF) { 2190 // Converting to \uNNNN avoids needing to escape the literal character and keep it 2191 // separate from preceding tokens 2192 return '\\u' + pad4(hex(code)); 2193 } 2194 // If `code` is between 0xFFFF and 0x10FFFF, require and defer to native handling 2195 if (hasNativeU && flags.indexOf('u') > -1) { 2196 return match[0]; 2197 } 2198 throw new SyntaxError('Cannot use Unicode code point above \\u{FFFF} without flag u'); 2199 }, { 2200 scope: 'all', 2201 leadChar: '\\' 2202 }); 2203 2204 /* 2205 * Empty character class: `[]` or `[^]`. This fixes a critical cross-browser syntax inconsistency. 2206 * Unless this is standardized (per the ES spec), regex syntax can't be accurately parsed because 2207 * character class endings can't be determined. 2208 */ 2209 XRegExp.addToken(/\[(\^?)]/, function (match) { 2210 // For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S]. 2211 // (?!) should work like \b\B, but is unreliable in some versions of Firefox 2212 return match[1] ? '[\\s\\S]' : '\\b\\B'; 2213 }, { leadChar: '[' }); 2214 2215 /* 2216 * Comment pattern: `(?# )`. Inline comments are an alternative to the line comments allowed in 2217 * free-spacing mode (flag x). 2218 */ 2219 XRegExp.addToken(/\(\?#[^)]*\)/, function (match, scope, flags) { 2220 // Keep tokens separated unless the following token is a quantifier 2221 return isQuantifierNext(match.input, match.index + match[0].length, flags) ? '' : '(?:)'; 2222 }, { leadChar: '(' }); 2223 2224 /* 2225 * Whitespace and line comments, in free-spacing mode (aka extended mode, flag x) only. 2226 */ 2227 XRegExp.addToken(/\s+|#.*/, function (match, scope, flags) { 2228 // Keep tokens separated unless the following token is a quantifier 2229 return isQuantifierNext(match.input, match.index + match[0].length, flags) ? '' : '(?:)'; 2230 }, { flag: 'x' }); 2231 2232 /* 2233 * Dot, in dotall mode (aka singleline mode, flag s) only. 2234 */ 2235 XRegExp.addToken(/\./, function () { 2236 return '[\\s\\S]'; 2237 }, { 2238 flag: 's', 2239 leadChar: '.' 2240 }); 2241 2242 /* 2243 * Named backreference: `\k<name>`. Backreference names can use the characters A-Z, a-z, 0-9, _, 2244 * and $ only. Also allows numbered backreferences as `\k<n>`. 2245 */ 2246 XRegExp.addToken(/\\k<([\w$]+)>/, function (match) { 2247 // Groups with the same name is an error, else would need `lastIndexOf` 2248 var index = isNaN(match[1]) ? indexOf(this.captureNames, match[1]) + 1 : +match[1], 2249 endIndex = match.index + match[0].length; 2250 if (!index || index > this.captureNames.length) { 2251 throw new SyntaxError('Backreference to undefined group ' + match[0]); 2252 } 2253 // Keep backreferences separate from subsequent literal numbers 2254 return '\\' + index + (endIndex === match.input.length || isNaN(match.input.charAt(endIndex)) ? '' : '(?:)'); 2255 }, { leadChar: '\\' }); 2256 2257 /* 2258 * Numbered backreference or octal, plus any following digits: `\0`, `\11`, etc. Octals except `\0` 2259 * not followed by 0-9 and backreferences to unopened capture groups throw an error. Other matches 2260 * are returned unaltered. IE < 9 doesn't support backreferences above `\99` in regex syntax. 2261 */ 2262 XRegExp.addToken(/\\(\d+)/, function (match, scope) { 2263 if (!(scope === defaultScope && /^[1-9]/.test(match[1]) && +match[1] <= this.captureNames.length) && match[1] !== '0') { 2264 throw new SyntaxError('Cannot use octal escape or backreference to undefined group ' + match[0]); 2265 } 2266 return match[0]; 2267 }, { 2268 scope: 'all', 2269 leadChar: '\\' 2270 }); 2271 2272 /* 2273 * Named capturing group; match the opening delimiter only: `(?<name>`. Capture names can use the 2274 * characters A-Z, a-z, 0-9, _, and $ only. Names can't be integers. Supports Python-style 2275 * `(?P<name>` as an alternate syntax to avoid issues in some older versions of Opera which natively 2276 * supported the Python-style syntax. Otherwise, XRegExp might treat numbered backreferences to 2277 * Python-style named capture as octals. 2278 */ 2279 XRegExp.addToken(/\(\?P?<([\w$]+)>/, function (match) { 2280 // Disallow bare integers as names because named backreferences are added to match 2281 // arrays and therefore numeric properties may lead to incorrect lookups 2282 if (!isNaN(match[1])) { 2283 throw new SyntaxError('Cannot use integer as capture name ' + match[0]); 2284 } 2285 if (match[1] === 'length' || match[1] === '__proto__') { 2286 throw new SyntaxError('Cannot use reserved word as capture name ' + match[0]); 2287 } 2288 if (indexOf(this.captureNames, match[1]) > -1) { 2289 throw new SyntaxError('Cannot use same name for multiple groups ' + match[0]); 2290 } 2291 this.captureNames.push(match[1]); 2292 this.hasNamedCapture = true; 2293 return '('; 2294 }, { leadChar: '(' }); 2295 2296 /* 2297 * Capturing group; match the opening parenthesis only. Required for support of named capturing 2298 * groups. Also adds explicit capture mode (flag n). 2299 */ 2300 XRegExp.addToken(/\((?!\?)/, function (match, scope, flags) { 2301 if (flags.indexOf('n') > -1) { 2302 return '(?:'; 2303 } 2304 this.captureNames.push(null); 2305 return '('; 2306 }, { 2307 optionalFlags: 'n', 2308 leadChar: '(' 2309 }); 2310 2311 /* ============================== 2312 * Expose XRegExp 2313 * ============================== */ 2314 2315 module.exports = XRegExp; 2316 2317/***/ }, 2318/* 5 */ 2319/***/ function(module, exports, __webpack_require__) { 2320 2321 'use strict'; 2322 2323 Object.defineProperty(exports, "__esModule", { 2324 value: true 2325 }); 2326 2327 var _match = __webpack_require__(6); 2328
2329 Object.keys(_match).forEach(function (key) { 2330 if (key === "default") return; 2331 Object.defineProperty(exports, key, { 2332 enumerable: true, 2333 get: function get() { 2334 return _match[key]; 2335 } 2336 }); 2337 }); 2338 2339 var _applyRegexList = __webpack_require__(7); 2340 2341 Object.keys(_applyRegexList).forEach(function (key) { 2342 if (key === "default") return; 2343 Object.defineProperty(exports, key, { 2344 enumerable: true, 2345 get: function get() { 2346 return _applyRegexList[key]; 2347 } 2348 }); 2349 }); 2350 2351/***/ }, 2352/* 6 */ 2353/***/ function(module, exports) { 2354 2355 "use strict"; 2356 2357 Object.defineProperty(exports, "__esModule", { 2358 value: true 2359 }); 2360 2361 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 2362 2363 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2364 2365 var Match = exports.Match = function () { 2366 function Match(value, index, css) { 2367 _classCallCheck(this, Match); 2368 2369 this.value = value; 2370 this.index = index; 2371 this.length = value.length; 2372 this.css = css; 2373 this.brushName = null; 2374 } 2375 2376 _createClass(Match, [{ 2377 key: "toString", 2378 value: function toString() { 2379 return this.value; 2380 } 2381 }]); 2382 2383 return Match; 2384 }(); 2385 2386/***/ }, 2387/* 7 */ 2388/***/ function(module, exports, __webpack_require__) { 2389 2390 'use strict'; 2391 2392 Object.defineProperty(exports, "__esModule", { 2393 value: true 2394 }); 2395 2396 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; 2397 2398 exports.applyRegexList = applyRegexList; 2399 2400 var _matches = __webpack_require__(8); 2401 2402 /** 2403 * Applies all regular expression to the code and stores all found 2404 * matches in the `this.matches` array. 2405 */ 2406 function applyRegexList(code, regexList) { 2407 var result = []; 2408 2409 regexList = regexList || []; 2410 2411 for (var i = 0, l = regexList.length; i < l; i++) { 2412 // BUG: length returns len+1 for array if methods added to prototype chain ([email protected]) 2413 if (_typeof(regexList[i]) === 'object') result = result.concat((0, _matches.find)(code, regexList[i])); 2414 } 2415 2416 result = (0, _matches.sort)(result); 2417 result = (0, _matches.removeNested)(result); 2418 result = (0, _matches.compact)(result); 2419 2420 return result; 2421 } 2422 2423/***/ }, 2424/* 8 */ 2425/***/ function(module, exports, __webpack_require__) { 2426 2427 'use strict'; 2428 2429 Object.defineProperty(exports, "__esModule", { 2430 value: true 2431 }); 2432 exports.find = find; 2433 exports.sort = sort; 2434 exports.compact = compact; 2435 exports.removeNested = removeNested; 2436 2437 var _match = __webpack_require__(6); 2438 2439 var _syntaxhighlighterRegex = __webpack_require__(3); 2440 2441 /** 2442 * Executes given regular expression on provided code and returns all matches that are found. 2443 * 2444 * @param {String} code Code to execute regular expression on. 2445 * @param {Object} regex Regular expression item info from `regexList` collection. 2446 * @return {Array} Returns a list of Match objects. 2447 */ 2448 function find(code, regexInfo) { 2449 function defaultAdd(match, regexInfo) { 2450 return match[0]; 2451 }; 2452 2453 var index = 0, 2454 match = null, 2455 matches = [], 2456 process = regexInfo.func ? regexInfo.func : defaultAdd, 2457 pos = 0; 2458 2459 while (match = _syntaxhighlighterRegex.XRegExp.exec(code, regexInfo.regex, pos)) { 2460 var resultMatch = process(match, regexInfo); 2461 2462 if (typeof resultMatch === 'string') resultMatch = [new _match.Match(resultMatch, match.index, regexInfo.css)]; 2463 2464 matches = matches.concat(resultMatch); 2465 pos = match.index + match[0].length; 2466 } 2467 2468 return matches; 2469 }; 2470 2471 /** 2472 * Sorts matches by index position and then by length. 2473 */ 2474 function sort(matches) { 2475 function sortMatchesCallback(m1, m2) { 2476 // sort matches by index first 2477 if (m1.index < m2.index) return -1;else if (m1.index > m2.index) return 1;else { 2478 // if index is the same, sort by length 2479 if (m1.length < m2.length) return -1;else if (m1.length > m2.length) return 1; 2480 } 2481 2482 return 0; 2483 } 2484 2485 return matches.sort(sortMatchesCallback); 2486 } 2487 2488 function compact(matches) { 2489 var result = [], 2490 i, 2491 l; 2492 2493 for (i = 0, l = matches.length; i < l; i++) { 2494 if (matches[i]) result.push(matches[i]); 2495 }return result; 2496 } 2497 2498 /** 2499 * Checks to see if any of the matches are inside of other matches. 2500 * This process would get rid of highligted strings inside comments,
2501 * keywords inside strings and so on. 2502 */ 2503 function removeNested(matches) { 2504 // Optimized by Jose Prado (http://joseprado.com) 2505 for (var i = 0, l = matches.length; i < l; i++) { 2506 if (matches[i] === null) continue; 2507 2508 var itemI = matches[i], 2509 itemIEndPos = itemI.index + itemI.length; 2510 2511 for (var j = i + 1, l = matches.length; j < l && matches[i] !== null; j++) { 2512 var itemJ = matches[j]; 2513 2514 if (itemJ === null) continue;else if (itemJ.index > itemIEndPos) break;else if (itemJ.index == itemI.index && itemJ.length > itemI.length) matches[i] = null;else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos) matches[j] = null; 2515 } 2516 } 2517 2518 return matches; 2519 } 2520 2521/***/ }, 2522/* 9 */ 2523/***/ function(module, exports) { 2524 2525 'use strict'; 2526 2527 Object.defineProperty(exports, "__esModule", { 2528 value: true 2529 }); 2530 exports.default = Renderer; 2531 /** 2532 * Pads number with zeros until it's length is the same as given length. 2533 * 2534 * @param {Number} number Number to pad. 2535 * @param {Number} length Max string length with. 2536 * @return {String} Returns a string padded with proper amount of '0'. 2537 */ 2538 function padNumber(number, length) { 2539 var result = number.toString(); 2540 2541 while (result.length < length) { 2542 result = '0' + result; 2543 }return result; 2544 }; 2545 2546 function getLines(str) { 2547 return str.split(/\r?\n/); 2548 } 2549 2550 function getLinesToHighlight(opts) { 2551 var results = {}, 2552 linesToHighlight, 2553 l, 2554 i; 2555 2556 linesToHighlight = opts.highlight || []; 2557 2558 if (typeof linesToHighlight.push !== 'function') linesToHighlight = [linesToHighlight]; 2559 2560 for (i = 0, l = linesToHighlight.length; i < l; i++) { 2561 results[linesToHighlight[i]] = true; 2562 }return results; 2563 } 2564 2565 function Renderer(code, matches, opts) { 2566 var _this = this; 2567 2568 _this.opts = opts; 2569 _this.code = code; 2570 _this.matches = matches; 2571 _this.lines = getLines(code); 2572 _this.linesToHighlight = getLinesToHighlight(opts); 2573 } 2574 2575 Renderer.prototype = { 2576 /** 2577 * Wraps each line of the string into <code/> tag with given style applied to it. 2578 * 2579 * @param {String} str Input string. 2580 * @param {String} css Style name to apply to the string. 2581 * @return {String} Returns input string with each line surrounded by <span/> tag. 2582 */ 2583 wrapLinesWithCode: function wrapLinesWithCode(str, css) { 2584 if (str == null || str.length == 0 || str == '\n' || css == null) return str; 2585 2586 var _this = this, 2587 results = [], 2588 lines, 2589 line, 2590 spaces, 2591 i, 2592 l; 2593 2594 str = str.replace(/</g, '<'); 2595 2596 // Replace two or more sequential spaces with leaving last space untouched. 2597 str = str.replace(/ {2,}/g, function (m) { 2598 spaces = ''; 2599 2600 for (i = 0, l = m.length; i < l - 1; i++) { 2601 spaces += _this.opts.space; 2602 }return spaces + ' '; 2603 }); 2604 2605 lines = getLines(str); 2606 2607 // Split each line and apply <span class="...">...</span> to them so that leading spaces aren't included. 2608 for (i = 0, l = lines.length; i < l; i++) { 2609 line = lines[i]; 2610 spaces = ''; 2611 2612 if (line.length > 0) { 2613 line = line.replace(/^( | )+/, function (s) { 2614 spaces = s; 2615 return ''; 2616 }); 2617 2618 line = line.length === 0 ? spaces : spaces + '<code class="' + css + '">' + line + '</code>'; 2619 } 2620 2621 results.push(line); 2622 } 2623 2624 return results.join('\n'); 2625 }, 2626 2627 /** 2628 * Turns all URLs in the code into <a/> tags. 2629 * @param {String} code Input code. 2630 * @return {String} Returns code with </a> tags. 2631 */ 2632 processUrls: function processUrls(code) { 2633 var gt = /(.*)((>|<).*)/, 2634 url = /\w+:\/\/[\w-.\/?%&=:@;#]*/g; 2635 2636 return code.replace(url, function (m) { 2637 var suffix = '', 2638 match = null; 2639 2640 // We include < and > in the URL for the common cases like <http://google.com> 2641 // The problem is that they get transformed into <http://google.com> 2642 // Where as > easily looks like part of the URL string. 2643 2644 if (match = gt.exec(m)) { 2645 m = match[1]; 2646 suffix = match[2]; 2647 } 2648 2649 return '<a href="' + m + '">' + m + '</a>' + suffix; 2650 }); 2651 }, 2652 2653 /** 2654 * Creates an array containing integer line numbers starting from the 'first-line' param. 2655 * @return {Array} Returns array of integers. 2656 */ 2657 figureOutLineNumbers: function figureOutLineNumbers(code) { 2658 var lineNumbers = [], 2659 lines = this.lines, 2660 firstLine = parseInt(this.opts.firstLine || 1), 2661 i, 2662 l; 2663 2664 for (i = 0, l = lines.length; i < l; i++) { 2665 lineNumbers.push(i + firstLine); 2666 }return lineNumbers; 2667 }, 2668 2669 /** 2670 * Generates HTML markup for a single line of code while determining alternating line style. 2671 * @param {Integer} lineNumber Line number. 2672 * @param {String} code Line HTML markup. 2673 * @return {String} Returns HTML markup. 2674 */ 2675 wrapLine: function wrapLine(lineIndex, lineNumber, lineHtml) { 2676 var classes = ['line', 'number' + lineNumber, 'index' + lineIndex, 'alt' + (lineNumber % 2 == 0 ? 1 : 2).toString()]; 2677 2678 if (this.linesToHighlight[lineNumber]) classes.push('highlighted'); 2679 2680 if (lineNumber == 0) classes.push('break'); 2681 2682 return '<div class="' + classes.join(' ') + '">' + lineHtml + '</div>'; 2683 }, 2684 2685 /** 2686 * Generates HTML markup for line number column. 2687 * @param {String} code Complete code HTML markup. 2688 * @param {Array} lineNumbers Calculated line numbers. 2689 * @return {String} Returns HTML markup. 2690 */ 2691 renderLineNumbers: function renderLineNumbers(code, lineNumbers) { 2692 var _this = this, 2693 opts = _this.opts, 2694 html = '', 2695 count = _this.lines.length, 2696 firstLine = parseInt(opts.firstLine || 1), 2697 pad = opts.padLineNumbers, 2698 lineNumber, 2699 i; 2700 2701 if (pad == true) pad = (firstLine + count - 1).toString().length;else if (isNaN(pad) == true) pad = 0; 2702 2703 for (i = 0; i < count; i++) { 2704 lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i; 2705 code = lineNumber == 0 ? opts.space : padNumber(lineNumber, pad);
2706 html += _this.wrapLine(i, lineNumber, code); 2707 } 2708 2709 return html; 2710 }, 2711 2712 /** 2713 * Splits block of text into individual DIV lines. 2714 * @param {String} code Code to highlight. 2715 * @param {Array} lineNumbers Calculated line numbers. 2716 * @return {String} Returns highlighted code in HTML form. 2717 */ 2718 getCodeLinesHtml: function getCodeLinesHtml(html, lineNumbers) { 2719 // html = utils.trim(html); 2720 2721 var _this = this, 2722 opts = _this.opts, 2723 lines = getLines(html), 2724 padLength = opts.padLineNumbers, 2725 firstLine = parseInt(opts.firstLine || 1), 2726 brushName = opts.brush, 2727 html = ''; 2728 2729 for (var i = 0, l = lines.length; i < l; i++) { 2730 var line = lines[i], 2731 indent = /^( |\s)+/.exec(line), 2732 spaces = null, 2733 lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i; 2734 ; 2735 2736 if (indent != null) { 2737 spaces = indent[0].toString(); 2738 line = line.substr(spaces.length); 2739 spaces = spaces.replace(' ', opts.space); 2740 } 2741 2742 // line = utils.trim(line); 2743 2744 if (line.length == 0) line = opts.space; 2745 2746 html += _this.wrapLine(i, lineNumber, (spaces != null ? '<code class="' + brushName + ' spaces">' + spaces + '</code>' : '') + line); 2747 } 2748 2749 return html; 2750 }, 2751 2752 /** 2753 * Returns HTML for the table title or empty string if title is null. 2754 */ 2755 getTitleHtml: function getTitleHtml(title) { 2756 return title ? '<caption>' + title + '</caption>' : ''; 2757 }, 2758 2759 /** 2760 * Finds all matches in the source code. 2761 * @param {String} code Source code to process matches in. 2762 * @param {Array} matches Discovered regex matches. 2763 * @return {String} Returns formatted HTML with processed mathes. 2764 */ 2765 getMatchesHtml: function getMatchesHtml(code, matches) { 2766 function getBrushNameCss(match) { 2767 var result = match ? match.brushName || brushName : brushName; 2768 return result ? result + ' ' : ''; 2769 }; 2770 2771 var _this = this, 2772 pos = 0, 2773 result = '', 2774 brushName = _this.opts.brush || '', 2775 match, 2776 matchBrushName, 2777 i, 2778 l; 2779 2780 // Finally, go through the final list of matches and pull the all 2781 // together adding everything in between that isn't a match. 2782 for (i = 0, l = matches.length; i < l; i++) { 2783 match = matches[i]; 2784 2785 if (match === null || match.length === 0) continue; 2786 2787 matchBrushName = getBrushNameCss(match); 2788 2789 result += _this.wrapLinesWithCode(code.substr(pos, match.index - pos), matchBrushName + 'plain') + _this.wrapLinesWithCode(match.value, matchBrushName + match.css); 2790 2791 pos = match.index + match.length + (match.offset || 0); 2792 } 2793 2794 // don't forget to add whatever's remaining in the string 2795 result += _this.wrapLinesWithCode(code.substr(pos), getBrushNameCss() + 'plain'); 2796 2797 return result; 2798 }, 2799 2800 /** 2801 * Generates HTML markup for the whole syntax highlighter. 2802 * @param {String} code Source code. 2803 * @return {String} Returns HTML markup. 2804 */ 2805 getHtml: function getHtml() { 2806 var _this = this, 2807 opts = _this.opts, 2808 code = _this.code, 2809 matches = _this.matches, 2810 classes = ['syntaxhighlighter'], 2811 lineNumbers, 2812 gutter, 2813 html; 2814 2815 if (opts.collapse === true) classes.push('collapsed'); 2816 2817 gutter = opts.gutter !== false; 2818 2819 if (!gutter) classes.push('nogutter'); 2820 2821 // add custom user style name 2822 classes.push(opts.className); 2823 2824 // add brush alias to the class name for custom CSS 2825 classes.push(opts.brush); 2826 2827 if (gutter) lineNumbers = _this.figureOutLineNumbers(code); 2828 2829 // processes found matches into the html 2830 html = _this.getMatchesHtml(code, matches); 2831 2832 // finally, split all lines so that they wrap well 2833 html = _this.getCodeLinesHtml(html, lineNumbers); 2834 2835 // finally, process the links 2836 if (opts.autoLinks) html = _this.processUrls(html); 2837 2838 html = '\n <div class="' + classes.join(' ') + '">\n <table border="0" cellpadding="0" cellspacing="0">\n ' + _this.getTitleHtml(opts.title) + '\n <tbody>\n <tr>\n ' + (gutter ? '<td class="gutter">
2838' + _this.renderLineNumbers(code) + '</td>' : '') + '\n <td class="code">\n <div class="container">' + html + '</div>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n '; 2839 2840 return html; 2841 } 2842 }; 2843 2844/***/ }, 2845/* 10 */ 2846/***/ function(module, exports) { 2847 2848 'use strict'; 2849 2850 /** 2851 * Splits block of text into lines. 2852 * @param {String} block Block of text. 2853 * @return {Array} Returns array of lines. 2854 */ 2855 function splitLines(block) { 2856 return block.split(/\r?\n/); 2857 } 2858 2859 /** 2860 * Executes a callback on each line and replaces each line with result from the callback. 2861 * @param {Object} str Input string. 2862 * @param {Object} callback Callback function taking one string argument and returning a string. 2863 */ 2864 function eachLine(str, callback) { 2865 var lines = splitLines(str); 2866 2867 for (var i = 0, l = lines.length; i < l; i++) { 2868 lines[i] = callback(lines[i], i); 2869 }return lines.join('\n'); 2870 } 2871 2872 /** 2873 * Generates a unique element ID. 2874 */ 2875 function guid(prefix) { 2876 return (prefix || '') + Math.round(Math.random() * 1000000).toString(); 2877 } 2878 2879 /** 2880 * Merges two objects. Values from obj2 override values in obj1. 2881 * Function is NOT recursive and works only for one dimensional objects. 2882 * @param {Object} obj1 First object. 2883 * @param {Object} obj2 Second object. 2884 * @return {Object} Returns combination of both objects. 2885 */ 2886 function merge(obj1, obj2) { 2887 var result = {}, 2888 name; 2889 2890 for (name in obj1) { 2891 result[name] = obj1[name]; 2892 }for (name in obj2) { 2893 result[name] = obj2[name]; 2894 }return result; 2895 } 2896 2897 /** 2898 * Removes all white space at the begining and end of a string. 2899 * 2900 * @param {String} str String to trim. 2901 * @return {String} Returns string without leading and following white space characters. 2902 */ 2903 function trim(str) { 2904 return str.replace(/^\s+|\s+$/g, ''); 2905 } 2906 2907 /** 2908 * Converts the source to array object. Mostly used for function arguments and 2909 * lists returned by getElementsByTagName() which aren't Array objects. 2910 * @param {List} source Source list. 2911 * @return {Array} Returns array. 2912 */ 2913 function toArray(source) { 2914 return Array.prototype.slice.apply(source); 2915 } 2916 2917 /** 2918 * Attempts to convert string to boolean. 2919 * @param {String} value Input string. 2920 * @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise. 2921 */ 2922 function toBoolean(value) { 2923 var result = { "true": true, "false": false }[value]; 2924 return result == null ? value : result; 2925 } 2926 2927 module.exports = { 2928 splitLines: splitLines, 2929 eachLine: eachLine, 2930 guid: guid, 2931 merge: merge, 2932 trim: trim, 2933 toArray: toArray, 2934 toBoolean: toBoolean 2935 }; 2936 2937/***/ }, 2938/* 11 */ 2939/***/ function(module, exports, __webpack_require__) { 2940 2941 'use strict'; 2942 2943 var trim = __webpack_require__(12), 2944 bloggerMode = __webpack_require__(13), 2945 stripBrs = __webpack_require__(14), 2946 unindenter = __webpack_require__(15), 2947 retabber = __webpack_require__(16); 2948 2949 module.exports = function (code, opts) { 2950 code = trim(code, opts); 2951 code = bloggerMode(code, opts); 2952 code = stripBrs(code, opts); 2953 code = unindenter.unindent(code, opts); 2954 2955 var tabSize = opts['tab-size']; 2956 code = opts['smart-tabs'] === true ? retabber.smart(code, tabSize) : retabber.regular(code, tabSize); 2957 2958 return code; 2959 }; 2960 2961/***/ }, 2962/* 12 */ 2963/***/ function(module, exports) { 2964 2965 'use strict'; 2966 2967 module.exports = function (code, opts) { 2968 return code 2969 // This is a special trim which only removes first and last empty lines 2970 // and doesn't affect valid leading space on the first line. 2971 .replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, '') 2972 2973 // IE lets these buggers through 2974 .replace(/\r/g, ' '); 2975 }; 2976 2977/***/ }, 2978/* 13 */ 2979/***/ function(module, exports) { 2980 2981 'use strict'; 2982 2983 module.exports = function (code, opts) { 2984 var br = /<br\s*\/?>|<br\s*\/?>/gi; 2985 2986 if (opts['bloggerMode'] === true) code = code.replace(br, '\n'); 2987 2988 return code; 2989 }; 2990 2991/***/ }, 2992/* 14 */ 2993/***/ function(module, exports) { 2994 2995 'use strict'; 2996 2997 module.exports = function (code, opts) { 2998 var br = /<br\s*\/?>|<br\s*\/?>/gi; 2999 3000 if (opts['stripBrs'] === true) code = code.replace(br, ''); 3001 3002 return code; 3003 }; 3004 3005/***/ }, 3006/* 15 */
3007/***/ function(module, exports) { 3008 3009 'use strict'; 3010 3011 function isEmpty(str) { 3012 return (/^\s*$/.test(str) 3013 ); 3014 } 3015 3016 module.exports = { 3017 unindent: function unindent(code) { 3018 var lines = code.split(/\r?\n/), 3019 regex = /^\s*/, 3020 min = 1000, 3021 line, 3022 matches, 3023 i, 3024 l; 3025 3026 // go through every line and check for common number of indents 3027 for (i = 0, l = lines.length; i < l && min > 0; i++) { 3028 line = lines[i]; 3029 3030 if (isEmpty(line)) continue; 3031 3032 matches = regex.exec(line); 3033 3034 // In the event that just one line doesn't have leading white space 3035 // we can't unindent anything, so bail completely. 3036 if (matches == null) return code; 3037 3038 min = Math.min(matches[0].length, min); 3039 } 3040 3041 // trim minimum common number of white space from the begining of every line 3042 if (min > 0) for (i = 0, l = lines.length; i < l; i++) { 3043 if (!isEmpty(lines[i])) lines[i] = lines[i].substr(min); 3044 }return lines.join('\n'); 3045 } 3046 }; 3047 3048/***/ }, 3049/* 16 */ 3050/***/ function(module, exports) { 3051 3052 'use strict'; 3053 3054 var spaces = ''; 3055 3056 // Create a string with 1000 spaces to copy spaces from... 3057 // It's assumed that there would be no indentation longer than that. 3058 for (var i = 0; i < 50; i++) { 3059 spaces += ' '; 3060 } // 20 spaces * 50 3061 3062 // This function inserts specified amount of spaces in the string 3063 // where a tab is while removing that given tab. 3064 function insertSpaces(line, pos, count) { 3065 return line.substr(0, pos) + spaces.substr(0, count) + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab 3066 ; 3067 } 3068 3069 module.exports = { 3070 smart: function smart(code, tabSize) { 3071 var lines = code.split(/\r?\n/), 3072 tab = '\t', 3073 line, 3074 pos, 3075 i, 3076 l; 3077 3078 // Go through all the lines and do the 'smart tabs' magic. 3079 for (i = 0, l = lines.length; i < l; i++) { 3080 line = lines[i]; 3081 3082 if (line.indexOf(tab) === -1) continue; 3083 3084 pos = 0; 3085 3086 while ((pos = line.indexOf(tab)) !== -1) { 3087 // This is pretty much all there is to the 'smart tabs' logic. 3088 // Based on the position within the line and size of a tab, 3089 // calculate the amount of spaces we need to insert. 3090 line = insertSpaces(line, pos, tabSize - pos % tabSize); 3091 } 3092 3093 lines[i] = line; 3094 } 3095 3096 return lines.join('\n'); 3097 }, 3098 3099 regular: function regular(code, tabSize) { 3100 return code.replace(/\t/g, spaces.substr(0, tabSize)); 3101 } 3102 }; 3103 3104/***/ }, 3105/* 17 */ 3106/***/ function(module, exports) { 3107 3108 'use strict'; 3109 3110 /** 3111 * Finds all <SCRIPT TYPE="text/syntaxhighlighter" /> elementss. 3112 * Finds both "text/syntaxhighlighter" and "syntaxhighlighter" 3113 * ...in order to make W3C validator happy with subtype and backwardscompatible without subtype 3114 * @return {Array} Returns array of all found SyntaxHighlighter tags. 3115 */ 3116 function getSyntaxHighlighterScriptTags() { 3117 var tags = document.getElementsByTagName('script'), 3118 result = []; 3119 3120 for (var i = 0; i < tags.length; i++) { 3121 if (tags[i].type == 'text/syntaxhighlighter' || tags[i].type == 'syntaxhighlighter') result.push(tags[i]); 3122 }return result; 3123 }; 3124 3125 /** 3126 * Checks if target DOM elements has specified CSS class. 3127 * @param {DOMElement} target Target DOM element to check. 3128 * @param {String} className Name of the CSS class to check for. 3129 * @return {Boolean} Returns true if class name is present, false otherwise. 3130 */ 3131 function hasClass(target, className) { 3132 return target.className.indexOf(className) != -1; 3133 } 3134 3135 /** 3136 * Adds CSS class name to the target DOM element. 3137 * @param {DOMElement} target Target DOM element. 3138 * @param {String} className New CSS class to add. 3139 */ 3140 function addClass(target, className) { 3141 if (!hasClass(target, className)) target.className += ' ' + className; 3142 } 3143 3144 /** 3145 * Removes CSS class name from the target DOM element. 3146 * @param {DOMElement} target Target DOM element. 3147 * @param {String} className CSS class to remove. 3148 */ 3149 function removeClass(target, className) { 3150 target.className = target.className.replace(className, ''); 3151 } 3152 3153 /** 3154 * Adds event handler to the target object. 3155 * @param {Object} obj Target object. 3156 * @param {String} type Name of the event. 3157 * @param {Function} func Handling function. 3158 */ 3159 function attachEvent(obj, type, func, scope) { 3160 function handler(e) { 3161 e = e || window.event; 3162 3163 if (!e.target) { 3164 e.target = e.srcElement; 3165 e.preventDefault = function () { 3166 this.returnValue = false;
3167 }; 3168 } 3169 3170 func.call(scope || window, e); 3171 }; 3172 3173 if (obj.attachEvent) { 3174 obj.attachEvent('on' + type, handler); 3175 } else { 3176 obj.addEventListener(type, handler, false); 3177 } 3178 } 3179 3180 /** 3181 * Looks for a child or parent node which has specified classname. 3182 * Equivalent to jQuery's $(container).find(".className") 3183 * @param {Element} target Target element. 3184 * @param {String} search Class name or node name to look for. 3185 * @param {Boolean} reverse If set to true, will go up the node tree instead of down. 3186 * @return {Element} Returns found child or parent element on null. 3187 */ 3188 function findElement(target, search, reverse /* optional */) { 3189 if (target == null) return null; 3190 3191 var nodes = reverse != true ? target.childNodes : [target.parentNode], 3192 propertyToFind = { '#': 'id', '.': 'className' }[search.substr(0, 1)] || 'nodeName', 3193 expectedValue, 3194 found; 3195 3196 expectedValue = propertyToFind != 'nodeName' ? search.substr(1) : search.toUpperCase(); 3197 3198 // main return of the found node 3199 if ((target[propertyToFind] || '').indexOf(expectedValue) != -1) return target; 3200 3201 for (var i = 0, l = nodes.length; nodes && i < l && found == null; i++) { 3202 found = findElement(nodes[i], search, reverse); 3203 }return found; 3204 } 3205 3206 /** 3207 * Looks for a parent node which has specified classname. 3208 * This is an alias to <code>findElement(container, className, true)</code>. 3209 * @param {Element} target Target element. 3210 * @param {String} className Class name to look for. 3211 * @return {Element} Returns found parent element on null. 3212 */ 3213 function findParentElement(target, className) { 3214 return findElement(target, className, true); 3215 } 3216 3217 /** 3218 * Opens up a centered popup window. 3219 * @param {String} url URL to open in the window. 3220 * @param {String} name Popup name. 3221 * @param {int} width Popup width. 3222 * @param {int} height Popup height. 3223 * @param {String} options window.open() options. 3224 * @return {Window} Returns window instance. 3225 */ 3226 function popup(url, name, width, height, options) { 3227 var x = (screen.width - width) / 2, 3228 y = (screen.height - height) / 2; 3229 3230 options += ', left=' + x + ', top=' + y + ', width=' + width + ', height=' + height; 3231 options = options.replace(/^,/, ''); 3232 3233 var win = window.open(url, name, options); 3234 win.focus(); 3235 return win; 3236 } 3237 3238 function getElementsByTagName(name) { 3239 return document.getElementsByTagName(name); 3240 } 3241 3242 /** 3243 * Finds all elements on the page which could be processes by SyntaxHighlighter. 3244 */ 3245 function findElementsToHighlight(opts) { 3246 var elements = getElementsByTagName(opts['tagName']), 3247 scripts, 3248 i; 3249 3250 // support for <SCRIPT TYPE="syntaxhighlighter" /> feature 3251 if (opts['useScriptTags']) { 3252 scripts = getElementsByTagName('script'); 3253 3254 for (i = 0; i < scripts.length; i++) { 3255 if (scripts[i].type.match(/^(text\/)?syntaxhighlighter$/)) elements.push(scripts[i]); 3256 } 3257 } 3258 3259 return elements; 3260 } 3261 3262 function create(name) { 3263 return document.createElement(name); 3264 } 3265 3266 /** 3267 * Quick code mouse double click handler. 3268 */ 3269 function quickCodeHandler(e) { 3270 var target = e.target, 3271 highlighterDiv = findParentElement(target, '.syntaxhighlighter'), 3272 container = findParentElement(target, '.container'), 3273 textarea = document.createElement('textarea'), 3274 highlighter; 3275 3276 if (!container || !highlighterDiv || findElement(container, 'textarea')) return; 3277 3278 //highlighter = highlighters.get(highlighterDiv.id); 3279 3280 // add source class name 3281 addClass(highlighterDiv, 'source'); 3282 3283 // Have to go over each line and grab it's text, can't just do it on the 3284 // container because Firefox loses all \n where as Webkit doesn't. 3285 var lines = container.childNodes, 3286 code = []; 3287 3288 for (var i = 0, l = lines.length; i < l; i++) { 3289 code.push(lines[i].innerText || lines[i].textContent); 3290 } // using \r instead of \r or \r\n makes this work equally well on IE, FF and Webkit 3291 code = code.join('\r'); 3292 3293 // For Webkit browsers, replace nbsp with a breaking space 3294 code = code.replace(/\u00a0/g, " "); 3295 3296 // inject <textarea/> tag 3297 textarea.readOnly = true; // https://github.com/syntaxhighlighter/syntaxhighlighter/pull/329 3298 textarea.appendChild(document.createTextNode(code)); 3299 container.appendChild(textarea); 3300 3301 // preselect all text 3302 textarea.focus(); 3303 textarea.select(); 3304 3305 // set up handler for lost focus 3306 attachEvent(textarea, 'blur', function (e) { 3307 textarea.parentNode.removeChild(textarea); 3308 removeClass(highlighterDiv, 'source'); 3309 }); 3310 }; 3311 3312 module.exports = { 3313 quickCodeHandler: quickCodeHandler, 3314 create: create, 3315 popup: popup, 3316 hasClass: hasClass, 3317 addClass: addClass, 3318 removeClass: removeClass, 3319 attachEvent: attachEvent, 3320 findElement: findElement, 3321 findParentElement: findParentElement, 3322 getSyntaxHighlighterScriptTags: getSyntaxHighlighterScriptTags, 3323 findElementsToHighlight: findElementsToHighlight 3324 }; 3325 3326/***/ }, 3327/* 18 */
3328/***/ function(module, exports) { 3329 3330 'use strict'; 3331 3332 module.exports = { 3333 space: ' ', 3334 3335 /** Enables use of <SCRIPT type="syntaxhighlighter" /> tags. */ 3336 useScriptTags: true, 3337 3338 /** Blogger mode flag. */ 3339 bloggerMode: false, 3340 3341 stripBrs: false, 3342 3343 /** Name of the tag that SyntaxHighlighter will automatically look for. */ 3344 tagName: 'pre' 3345 }; 3346 3347/***/ }, 3348/* 19 */ 3349/***/ function(module, exports) { 3350 3351 'use strict'; 3352 3353 module.exports = { 3354 /** Additional CSS class names to be added to highlighter elements. */ 3355 'class-name': '', 3356 3357 /** First line number. */ 3358 'first-line': 1, 3359 3360 /** 3361 * Pads line numbers. Possible values are: 3362 * 3363 * false - don't pad line numbers. 3364 * true - automaticaly pad numbers with minimum required number of leading zeroes. 3365 * [int] - length up to which pad line numbers. 3366 */ 3367 'pad-line-numbers': false, 3368 3369 /** Lines to highlight. */ 3370 'highlight': null, 3371 3372 /** Title to be displayed above the code block. */ 3373 'title': null, 3374 3375 /** Enables or disables smart tabs. */ 3376 'smart-tabs': true, 3377 3378 /** Gets or sets tab size. */ 3379 'tab-size': 4, 3380 3381 /** Enables or disables gutter. */ 3382 'gutter': true, 3383 3384 /** Enables quick code copy and paste from double click. */ 3385 'quick-code': true, 3386 3387 /** Forces code view to be collapsed. */ 3388 'collapse': false, 3389 3390 /** Enables or disables automatic links. */ 3391 'auto-links': true, 3392 3393 'unindent': true, 3394 3395 'html-script': false 3396 }; 3397 3398/***/ }, 3399/* 20 */ 3400/***/ function(module, exports, __webpack_require__) { 3401 3402 /* WEBPACK VAR INJECTION */(function(process) {'use strict'; 3403 3404 var applyRegexList = __webpack_require__(5).applyRegexList; 3405 3406 function HtmlScript(BrushXML, brushClass) { 3407 var scriptBrush, 3408 xmlBrush = new BrushXML(); 3409 3410 if (brushClass == null) return; 3411 3412 scriptBrush = new brushClass(); 3413 3414 if (scriptBrush.htmlScript == null) throw new Error('Brush wasn\'t configured for html-script option: ' + brushClass.brushName); 3415 3416 xmlBrush.regexList.push({ regex: scriptBrush.htmlScript.code, func: process }); 3417 3418 this.regexList = xmlBrush.regexList; 3419 3420 function offsetMatches(matches, offset) { 3421 for (var j = 0, l = matches.length; j < l; j++) { 3422 matches[j].index += offset; 3423 } 3424 } 3425 3426 function process(match, info) { 3427 var code = match.code, 3428 results = [], 3429 regexList = scriptBrush.regexList, 3430 offset = match.index + match.left.length, 3431 htmlScript = scriptBrush.htmlScript, 3432 matches; 3433 3434 function add(matches) { 3435 results = results.concat(matches); 3436 } 3437 3438 matches = applyRegexList(code, regexList); 3439 offsetMatches(matches, offset); 3440 add(matches); 3441 3442 // add left script bracket 3443 if (htmlScript.left != null && match.left != null) { 3444 matches = applyRegexList(match.left, [htmlScript.left]); 3445 offsetMatches(matches, match.index); 3446 add(matches); 3447 } 3448 3449 // add right script bracket 3450 if (htmlScript.right != null && match.right != null) { 3451 matches = applyRegexList(match.right, [htmlScript.right]); 3452 offsetMatches(matches, match.index + match[0].lastIndexOf(match.right)); 3453 add(matches); 3454 } 3455 3456 for (var j = 0, l = results.length; j < l; j++) { 3457 results[j].brushName = brushClass.brushName; 3458 }return results; 3459 } 3460 }; 3461 3462 module.exports = HtmlScript; 3463 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(21))) 3464 3465/***/ }, 3466/* 21 */ 3467/***/ function(module, exports) { 3468 3469 'use strict'; 3470 3471 // shim for using process in browser 3472 3473 var process = module.exports = {}; 3474 var queue = []; 3475 var draining = false; 3476 var currentQueue; 3477 var queueIndex = -1; 3478 3479 function cleanUpNextTick() { 3480 draining = false; 3481 if (currentQueue.length) { 3482 queue = currentQueue.concat(queue); 3483 } else { 3484 queueIndex = -1; 3485 } 3486 if (queue.length) { 3487 drainQueue(); 3488 } 3489 } 3490 3491 function drainQueue() { 3492 if (draining) { 3493 return; 3494 } 3495 var timeout = setTimeout(cleanUpNextTick); 3496 draining = true; 3497 3498 var len = queue.length; 3499 while (len) { 3500 currentQueue = queue; 3501 queue = []; 3502 while (++queueIndex < len) { 3503 if (currentQueue) { 3504 currentQueue[queueIndex].run(); 3505 } 3506 } 3507 queueIndex = -1; 3508 len = queue.length; 3509 } 3510 currentQueue = null; 3511 draining = false;
3512 clearTimeout(timeout); 3513 } 3514 3515 process.nextTick = function (fun) { 3516 var args = new Array(arguments.length - 1); 3517 if (arguments.length > 1) { 3518 for (var i = 1; i < arguments.length; i++) { 3519 args[i - 1] = arguments[i]; 3520 } 3521 } 3522 queue.push(new Item(fun, args)); 3523 if (queue.length === 1 && !draining) { 3524 setTimeout(drainQueue, 0); 3525 } 3526 }; 3527 3528 // v8 likes predictible objects 3529 function Item(fun, array) { 3530 this.fun = fun; 3531 this.array = array; 3532 } 3533 Item.prototype.run = function () { 3534 this.fun.apply(null, this.array); 3535 }; 3536 process.title = 'browser'; 3537 process.browser = true; 3538 process.env = {}; 3539 process.argv = []; 3540 process.version = ''; // empty string to avoid regexp issues 3541 process.versions = {}; 3542 3543 function noop() {} 3544 3545 process.on = noop; 3546 process.addListener = noop; 3547 process.once = noop; 3548 process.off = noop; 3549 process.removeListener = noop; 3550 process.removeAllListeners = noop; 3551 process.emit = noop; 3552 3553 process.binding = function (name) { 3554 throw new Error('process.binding is not supported'); 3555 }; 3556 3557 process.cwd = function () { 3558 return '/'; 3559 }; 3560 process.chdir = function (dir) { 3561 throw new Error('process.chdir is not supported'); 3562 }; 3563 process.umask = function () { 3564 return 0; 3565 }; 3566 3567/***/ }, 3568/* 22 */ 3569/***/ function(module, exports, __webpack_require__) { 3570 3571 'use strict'; 3572 3573 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3574 3575 var _syntaxhighlighterHtmlRenderer = __webpack_require__(9); 3576 3577 var _syntaxhighlighterHtmlRenderer2 = _interopRequireDefault(_syntaxhighlighterHtmlRenderer); 3578 3579 var _syntaxhighlighterRegex = __webpack_require__(3); 3580 3581 var _syntaxhighlighterMatch = __webpack_require__(5); 3582 3583 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3584 3585 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3586 3587 module.exports = function () { 3588 function BrushBase() { 3589 _classCallCheck(this, BrushBase); 3590 } 3591 3592 _createClass(BrushBase, [{ 3593 key: 'getKeywords', 3594 3595 /** 3596 * Converts space separated list of keywords into a regular expression string. 3597 * @param {String} str Space separated keywords. 3598 * @return {String} Returns regular expression string. 3599 */ 3600 value: function getKeywords(str) { 3601 var results = str.replace(/^\s+|\s+$/g, '').replace(/\s+/g, '|'); 3602 3603 return '\\b(?:' + results + ')\\b'; 3604 } 3605 3606 /** 3607 * Makes a brush compatible with the `html-script` functionality. 3608 * @param {Object} regexGroup Object containing `left` and `right` regular expressions. 3609 */ 3610 3611 }, { 3612 key: 'forHtmlScript', 3613 value: function forHtmlScript(regexGroup) { 3614 var regex = { 'end': regexGroup.right.source }; 3615 3616 if (regexGroup.eof) { 3617 regex.end = '(?:(?:' + regex.end + ')|$)'; 3618 } 3619 3620 this.htmlScript = { 3621 left: { regex: regexGroup.left, css: 'script' }, 3622 right: { regex: regexGroup.right, css: 'script' }, 3623 code: (0, _syntaxhighlighterRegex.XRegExp)("(?<left>
3623" + regexGroup.left.source + ")" + "(?<code>.*?)" + "(?<right>" + regex.end + ")", "sgi") 3624 }; 3625 } 3626 }, { 3627 key: 'getHtml', 3628 value: function getHtml(code) { 3629 var params = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 3630 3631 var matches = (0, _syntaxhighlighterMatch.applyRegexList)(code, this.regexList); 3632 var renderer = new _syntaxhighlighterHtmlRenderer2.default(code, matches, params); 3633 return renderer.getHtml(); 3634 } 3635 }]); 3636 3637 return BrushBase; 3638 }(); 3639 3640/***/ }, 3641/* 23 */ 3642/***/ function(module, exports, __webpack_require__) { 3643 3644 'use strict'; 3645 3646 var BrushBase = __webpack_require__(22); 3647 var regexLib = __webpack_require__(3).commonRegExp; 3648 3649 function Brush() { 3650 // AppleScript brush by David Chambers 3651 // http://davidchambersdesign.com/ 3652 var keywords = 'after before beginning continue copy each end every from return get global in local named of set some that the then times to where whose with without'; 3653 var ordinals = 'first second third fourth fifth sixth seventh eighth ninth tenth last front back middle'; 3654 var specials = 'activate add alias ask attachment boolean class constant delete duplicate empty exists id integer list make message modal modified new no pi properties quit real record remove rest result reveal reverse run running save string word yes'; 3655 3656 this.regexList = [{ 3657 regex: /(--|#).*$/gm, 3658 css: 'comments' 3659 }, { 3660 regex: /\(\*(?:[\s\S]*?\(\*[\s\S]*?\*\))*[\s\S]*?\*\)/gm, // support nested comments 3661 css: 'comments' 3662 }, { 3663 regex: /"[\s\S]*?"/gm, 3664 css: 'string' 3665 }, { 3666 regex: /(?:,|:|¬|'s\b|\(|\)|\{|\}|«|\b\w*»)/g, // operators 3667 css: 'color1' 3668 }, { 3669 regex: /(-)?(\d)+(\.(\d)?)?(E\+(\d)+)?/g, // numbers 3670 css: 'color1' 3671 }, { 3672 regex: /(?:&(amp;|gt;|lt;)?|=|� |>|<|≥|>=|≤|<=|\*|\+|-|\/|÷|\^)/g, 3673 css: 'color2' 3674 }, { 3675 regex: /\b(?:and|as|div|mod|not|or|return(?!\s&)(ing)?|equals|(is(n't| not)? )?equal( to)?|does(n't| not) equal|(is(n't| not)? )?(greater|less) than( or equal( to)?)?|(comes|does(n't| not) come) (after|before)|is(n't| not)?( in)? (back|front) of|is(n't| not)? behind|is(n't| not)?( (in|contained by))?|does(n't| not) contain|contain(s)?|(start|begin|end)(s)? with|((but|end) )?(consider|ignor)ing|prop(erty)?|(a )?ref(erence)?( to)?|repeat (until|while|with)|((end|exit) )?repeat|((else|end) )?if|else|(end )?(script|tell|try)|(on )?error|(put )?into|(of )?(it|me)|its|my|with (timeout( of)?|transaction)|end (timeout|transaction))\b/g, 3676 css: 'keyword' 3677 }, { 3678 regex: /\b\d+(st|nd|rd|th)\b/g, // ordinals 3679 css: 'keyword' 3680 }, { 3681 regex: /\b(?:about|above|against|around|at|below|beneath|beside|between|by|(apart|aside) from|(instead|out) of|into|on(to)?|over|since|thr(ough|u)|under)\b/g, 3682 css: 'color3' 3683 }, { 3684 regex: /\b(?:adding folder items to|after receiving|clipboard info|set the clipboard to|(the )?clipboard|entire contents|document( (edited|file|nib name))?|file( (name|type))?|(info )?for|giving up after|(name )?extension|return(ed)?|second(?! item)(s)?|list (disks|folder)|(Unicode )?text|(disk )?item(s)?|((current|list) )?view|((container|key) )?window|case|diacriticals|hyphens|numeric strings|punctuation|white space|folder creation|application(s( folder)?| (processes|scripts position|support))?|((desktop )?(pictures )?|(documents|downloads|favorites|home|keychain|library|movies|music|public|scripts|sites|system|users|utilities|workflows) )folder|desktop|Folder Action scripts|font(s| panel)?|help|internet plugins|modem scripts|(system )?preferences|printer descriptions|scripting (additions|components)|shared (documents|libraries)|startup (disk|items)|temporary items|trash|on server|in AppleTalk zone|((as|long|short) )?user name|user (ID|locale)|(with )?password|in (bundle( with identifier)?|directory)|(close|open for) access|read|write( permission)?|(g|s)et eof|starting at|hidden( answer)?|open(ed| (location|untitled))?|error (handling|reporting)|administrator privileges|altering line endings|get volume settings|(alert|boot|input|mount|output|set) volume|output muted|(fax|random )?number|round(ing)?|up|down|toward zero|to nearest|as taught in school|system (attribute|info)|((AppleScript( Studio)?|system) )?version|(home )?directory|(IPv4|primary Ethernet) address|CPU (type|speed)|physical memory|time (stamp|to GMT)|replacing|ASCII (character|number)|localized string|from table|offset|summarize|beep|delay|say|(empty|multiple) selections allowed|(of|preferred) type|invisibles|showing( package contents)?|editable URL|(File|FTP|News|Media|Web) [Ss]ervers|Telnet hosts|Directory services|Remote applications|waiting until completion|saving( (in|to))?|path (for|to( (((current|frontmost) )?application|resource))?)|(background|RGB) color|(OK|cancel) button name|cancel button|button(s)?|cubic ((centi)?met(re|er)s|yards|feet|inches)|square ((kilo)?met(re|er)s|miles|yards|feet)|(centi|kilo)?met(re|er)s|miles|yards|feet|inches|lit(re|er)s|gallons|quarts|(kilo)?grams|ounces|pounds|degrees (Celsius|Fahrenheit|Kelvin)|print( (dialog|settings))?|clos(e(able)?|ing)|(de)?miniaturized|miniaturizable|zoom(ed|able)|attribute run|action (method|property|title)|phone|email|((start|end)ing|home) page|((birth|creation|current|custom|modification) )?date|((((phonetic )?(first|last|middle))|computer|host|maiden|related) |nick)?name|aim|icq|jabber|msn|yahoo|address(es)?|save addressbook|should enable action|city|country( code)?|formatte(r|d address)|(palette )?label|state|street|zip|AIM [Hh]andle(s)?|my card|select(ion| all)?|unsaved|(alpha )?value|entr(y|ies)|(ICQ|Jabber|MSN) handle|person|people|company|department|icon image|job title|note|organization|suffix|vcard|url|copies|collating|pages (across|down)|request print time|target( printer)?|((GUI Scripting|Script menu) )?enabled|show Computer scripts|(de)?activated|awake from nib|became (key|main)|call method|of (class|object)|center|clicked toolbar item|closed|for document|exposed|(can )?hide|idle|keyboard (down|up)|event( (number|type))?|launch(ed)?|load (image|movie|nib|sound)|owner|log|mouse (
3684down|dragged|entered|exited|moved|up)|move|column|localization|resource|script|register|drag (info|types)|resigned (active|key|main)|resiz(e(d)?|able)|right mouse (down|dragged|up)|scroll wheel|(at )?index|should (close|open( untitled)?|quit( after last window closed)?|zoom)|((proposed|screen) )?bounds|show(n)?|behind|in front of|size (mode|to fit)|update(d| toolbar item)?|was (hidden|miniaturized)|will (become active|close|finish launching|hide|miniaturize|move|open|quit|(resign )?active|((maximum|minimum|proposed) )?size|show|zoom)|bundle|data source|movie|pasteboard|sound|tool(bar| tip)|(color|open|save) panel|coordinate system|frontmost|main( (bundle|menu|window))?|((services|(excluded from )?windows) )?menu|((executable|frameworks|resource|scripts|shared (frameworks|support)) )?path|(selected item )?identifier|data|content(s| view)?|character(s)?|click count|(command|control|option|shift) key down|context|delta (x|y|z)|key( code)?|location|pressure|unmodified characters|types|(first )?responder|playing|(allowed|selectable) identifiers|allows customization|(auto saves )?configuration|visible|image( name)?|menu form representation|tag|user(-| )defaults|associated file name|(auto|needs) display|current field editor|floating|has (resize indicator|shadow)|hides when deactivated|level|minimized (image|title)|opaque|position|release when closed|sheet|title(d)?)\b/g, 3685 css: 'color4' 3686 }, { 3687 regex: /\b(?:tracks|paragraph|text item(s)?)\b/g, 3688 css: 'classes' 3689 }, { 3690 regex: /\b(?:AppleScript|album|video kind|grouping|length|text item delimiters|quoted form|POSIX path(?= of))\b/g, 3691 css: 'properties' 3692 }, { 3693 regex: /\b(?:run|exists|count)\b/g, 3694 css: 'commandNames' 3695 }, { 3696 regex: /\b(?:POSIX (file|path))\b/g, 3697 css: 'additionClasses' 3698 }, { 3699 regex: /\b(?:message|with (data|icon( (caution|note|stop))?|parameter(s)?|prompt|properties|seed|title)|regexp|string result|using( delimiters)?|default (answer|button|color|country code|entr(y|ies)|identifiers|items|name|location|script editor))\b/g, 3700 css: 'additionParameterNames' 3701 }, { 3702 regex: /\b(?:display(ing| (alert|dialog|mode))?|choose( ((remote )?application|color|folder|from list|URL))?|(do( shell)?|load|run|store) script|re_compile|find text)\b/g, 3703 css: 'additionCommandNames' 3704 }, { 3705 regex: /\b(?:xxx)\b/g, 3706 css: 'parameterNames' 3707 }, { 3708 regex: /\b(?:true|false|none)\b/g, 3709 css: 'enumeratedValues' 3710 }, { 3711 regex: new RegExp(this.getKeywords(specials), 'gm'), 3712 css: 'color3' 3713 }, { 3714 regex: new RegExp(this.getKeywords(keywords), 'gm'), 3715 css: 'keyword' 3716 }, { 3717 regex: new RegExp(this.getKeywords(ordinals), 'gm'), 3718 css: 'keyword' 3719 }]; 3720 }; 3721 3722 Brush.prototype = new BrushBase(); 3723 Brush.aliases = ['applescript']; 3724 module.exports = Brush; 3725 3726/***/ }, 3727/* 24 */ 3728/***/ function(module, exports, __webpack_require__) { 3729 3730 'use strict'; 3731 3732 var BrushBase = __webpack_require__(22); 3733 var regexLib = __webpack_require__(3).commonRegExp; 3734 3735 function Brush() { 3736 // Created by Peter Atoria @ http://iAtoria.com 3737 3738 var inits = 'class interface function package'; 3739 3740 var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' + 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' + 'extends false final finally flash_proxy for get if implements import in include Infinity ' + 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' + 'Null Number Object object_proxy override parseFloat parseInt private protected public ' + 'return set static String super switch this throw true try typeof uint undefined unescape ' + 'use void while with'; 3741 3742 this.regexList = [{ 3743 regex: regexLib.singleLineCComments, 3744 css: 'comments' 3745 }, { 3746 regex: regexLib.multiLineCComments, 3747 css: 'comments' 3748 }, { 3749 regex: regexLib.doubleQuotedString, 3750 css: 'string' 3751 }, { 3752 regex: regexLib.singleQuotedString, 3753 css: 'string' 3754 }, { 3755 regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, 3756 css: 'value' 3757 }, { 3758 regex: new RegExp(this.getKeywords(inits), 'gm'), 3759 css: 'color3' 3760 }, { 3761 regex: new RegExp(this.getKeywords(keywords), 'gm'), 3762 css: 'keyword' 3763 }, { 3764 regex: new RegExp('var', 'gm'), 3765 css: 'variable' 3766 }, { 3767 regex: new RegExp('trace', 'gm'), 3768 css: 'color1' 3769 }]; 3770 3771 this.forHtmlScript(regexLib.scriptScriptTags); 3772 }; 3773 3774 Brush.prototype = new BrushBase(); 3775 Brush.aliases = ['actionscript3', 'as3']; 3776 module.exports = Brush; 3777 3778/***/ }, 3779/* 25 */ 3780/***/ function(module, exports, __webpack_require__) { 3781 3782 'use strict'; 3783 3784 var BrushBase = __webpack_require__(22); 3785 var regexLib = __webpack_require__(3).commonRegExp;
3786 var XRegExp = __webpack_require__(3).XRegExp; 3787 var Match = __webpack_require__(5).Match; 3788 3789 function Brush() { 3790 function hereDocProcess(match, regexInfo) { 3791 var result = []; 3792 3793 if (match.here_doc != null) result.push(new Match(match.here_doc, match.index + match[0].indexOf(match.here_doc), 'string')); 3794 3795 if (match.full_tag != null) result.push(new Match(match.full_tag, match.index, 'preprocessor')); 3796 3797 if (match.end_tag != null) result.push(new Match(match.end_tag, match.index + match[0].lastIndexOf(match.end_tag), 'preprocessor')); 3798 3799 return result; 3800 } 3801 3802 var keywords = 'if fi then elif else for do done until while break continue case esac function return in eq ne ge le'; 3803 var commands = 'alias apropos awk basename base64 bash bc bg builtin bunzip2 bzcat bzip2 bzip2recover cal cat cd cfdisk chgrp chmod chown chroot' + 'cksum clear cmp comm command cp cron crontab crypt csplit cut date dc dd ddrescue declare df ' + 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + 'free fsck ftp gawk gcc gdb getconf getopts grep groups gunzip gzcat gzip hash head history hostname id ifconfig ' + 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + 'mv nasm nc ndisasm netstat nice nl nohup nslookup objdump od open op passwd paste pathchk ping popd pr printcap ' + 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + 'sleep sort source split ssh strace strings su sudo sum symlink sync tail tar tee test time ' + 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + 'uname unex
3803pand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + 'vi watch wc whereis which who whoami Wget xargs xxd yes chsh zcat'; 3804 3805 this.regexList = [{ 3806 regex: /^#!.*$/gm, 3807 css: 'preprocessor bold' 3808 }, { 3809 regex: /\/[\w-\/]+/gm, 3810 css: 'plain' 3811 }, { 3812 regex: regexLib.singleLinePerlComments, 3813 css: 'comments' 3814 }, { 3815 regex: regexLib.doubleQuotedString, 3816 css: 'string' 3817 }, { 3818 regex: regexLib.singleQuotedString, 3819 css: 'string' 3820 }, { 3821 regex: new RegExp(this.getKeywords(keywords), 'gm'), 3822 css: 'keyword' 3823 }, { 3824 regex: new RegExp(this.getKeywords(commands), 'gm'), 3825 css: 'functions' 3826 }, { 3827 regex: new XRegExp("(?<full_tag>(<|<){2}(?<tag>\\w+)) .*$(?<here_doc>[\\s\\S]*)(?<end_tag>^\\k<tag>$)", 'gm'), 3828 func: hereDocProcess 3829 }]; 3830 } 3831 3832 Brush.prototype = new BrushBase(); 3833 Brush.aliases = ['bash', 'shell', 'sh']; 3834 module.exports = Brush; 3835 3836/***/ }, 3837/* 26 */ 3838/***/ function(module, exports, __webpack_require__) { 3839 3840 'use strict'; 3841 3842 var BrushBase = __webpack_require__(22); 3843 var regexLib = __webpack_require__(3).commonRegExp; 3844 3845 function Brush() { 3846 // Contributed by Jen
3847 // http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter-plus 3848 3849 var funcs = 'Abs ACos AddSOAPRequestHeader AddSOAPResponseHeader AjaxLink AjaxOnLoad ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ' + 'ArrayInsertAt ArrayIsDefined ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArraySet ArraySort ArraySum ArraySwap ArrayToList ' + 'Asc ASin Atn BinaryDecode BinaryEncode BitAnd BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN BitSHRN BitXor ' + 'Ceiling CharsetDecode CharsetEncode Chr CJustify Compare CompareNoCase Cos CreateDate CreateDateTime CreateObject ' + 'CreateODBCDate CreateODBCDateTime CreateODBCTime CreateTime CreateTimeSpan CreateUUID DateAdd DateCompare DateConvert ' + 'DateDiff DateFormat DatePart Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear DE DecimalFormat DecrementValue ' + 'Decrypt DecryptBinary DeleteClientVariable DeserializeJSON DirectoryExists DollarFormat DotNetToCFType Duplicate Encrypt ' + 'EncryptBinary Evaluate Exp ExpandPath FileClose FileCopy FileDelete FileExists FileIsEOF FileMove FileOpen FileRead ' + 'FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute FileSetLastModified FileWrite Find FindNoCase FindOneOf ' + 'FirstDayOfMonth Fix FormatBaseN GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList GetBaseTemplatePath ' + 'GetClientVariablesList GetComponentMetaData GetContextRoot GetCurrentTemplatePath GetDirectoryFromPath GetEncoding ' + 'GetException GetFileFromPath GetFileInfo GetFunctionList GetGatewayHelper GetHttpRequestData GetHttpTimeString ' + 'GetK2ServerDocCount GetK2ServerDocCountLimit GetLocale GetLocaleDisplayName GetLocalHostIP GetMetaData GetMetricData ' + 'GetPageContext GetPrinterInfo GetProfileSections GetProfileString GetReadableImageFormats GetSOAPRequest GetSOAPRequestHeader ' + 'GetSOAPResponse GetSOAPResponseHeader GetTempDirectory GetTempFile GetTemplatePath GetTickCount GetTimeZoneInfo GetToken ' + 'GetUserRoles GetWriteableImageFormats Hash Hour HTMLCodeFormat HTMLEditFormat IIf ImageAddBorder ImageBlur ImageClearRect ' + 'ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect ImageDrawCubicCurve ImageDrawLine ImageDrawLines ImageDrawOval ' + 'ImageDrawPoint ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob ImageGetBufferedImage ' + 'ImageGetEXIFTag ImageGetHeight ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay ImagePaste ' + 'ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit ImageSetAntialiasing ImageSetBackgroundColor ' + 'ImageSetDrawingColor ImageSetDrawingStroke ImageSetDrawingTransparency ImageSharpen ImageShear ImageShearDrawingAxis ImageTranslate ' + 'ImageTranslateDrawingAxis ImageWrite ImageWriteBase64 ImageXORDrawingMode IncrementValue InputBaseN Insert Int IsArray IsBinary ' + 'IsBoolean IsCustomFunction IsDate IsDDX IsDebugMode IsDefined IsImage IsImageFile IsInstanceOf IsJSON IsLeapYear IsLocalHost ' + 'IsNumeric IsNumericDate IsObject IsPDFFile IsPDFObject IsQuery IsSimpleValue IsSOAPRequest IsStruct IsUserInAnyRole IsUserInRole ' + 'IsUserLoggedIn IsValid IsWDDX IsXML IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot JavaCast JSStringFormat LCase Left Len ' + 'ListAppend ListChangeDelims ListContains ListContainsNoCase ListDeleteAt ListFind ListFindNoCase ListFirst ListGetAt ListInsertAt ' + 'ListLast ListLen ListPrepend ListQualify ListRest ListSetAt ListSort ListToArray ListValueCount ListValueCountNoCase LJustify Log ' + 'Log10 LSCurrencyFormat LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime ' + 'LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Max Mid Min Minute Month MonthAsString Now NumberFormat ParagraphFormat ParseDateTime ' + 'Pi PrecisionEvaluate PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow QueryConvertForGrid QueryNew QuerySetCell QuotedValueList Rand ' + 'Randomize RandRange REFind REFindNoCase ReleaseComObject REMatch REMatchNoCase RemoveChars RepeatString Replace ReplaceList ReplaceNoCase ' + 'REReplace REReplaceNoCase Reverse Right RJustify Round RTrim Second SendGatewayMessage SerializeJSON SetEncoding SetLocale SetProfileStr
3849ing ' + 'SetVariable Sgn Sin Sleep SpanExcluding SpanIncluding Sqr StripCR StructAppend StructClear StructCopy StructCount StructDelete StructFind ' + 'StructFindKey StructFindValue StructGet StructInsert StructIsEmpty StructKeyArray StructKeyExists StructKeyList StructKeyList StructNew ' + 'StructSort StructUpdate Tan TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase URLDecode URLEncodedFormat URLSessionFormat Val ' + 'ValueList VerifyClient Week Wrap Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform ' + 'XmlValidate Year YesNoFormat'; 3850 3851 var keywords = 'cfabort cfajaximport cfajaxproxy cfapplet cfapplication cfargument cfassociate cfbreak cfcache cfcalendar ' + 'cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection cfcomponent cfcontent cfcookie cfdbinfo ' + 'cfdefaultcase cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror ' + 'cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask ' + 'cfexecute cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid cfgridcolumn ' + 'cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage cfimport cfinclude cfindex ' + 'cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflocation cflock cflog ' + 'cflogin cfloginuser cflogout cfloop cfmail cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate ' + 'cfobject cfobjectcache cfoutput cfparam cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop ' + 'cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult ' + 'cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow cfreturn cfsavecontent cfschedule ' + 'cfscript cfsearch cfselect cfset cfsetting cfsilent cfslider cfsprydataset cfstoredproc cfswitch cftable ' + 'cftextarea cfthread cfthrow cftimer cftooltip cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx ' + 'cfwindow cfxml cfzip cfzipparam'; 3852 3853 var operators = 'all and any between cross in join like not null or outer some'; 3854 3855 this.regexList = [{ 3856 regex: new RegExp('--(.*)$', 'gm'), 3857 css: 'comments' 3858 }, { 3859 regex: regexLib.xmlComments, 3860 css: 'comments' 3861 }, { 3862 regex: regexLib.doubleQuotedString, 3863 css: 'string' 3864 }, { 3865 regex: regexLib.singleQuotedString, 3866 css: 'string' 3867 }, { 3868 regex: new RegExp(this.getKeywords(funcs), 'gmi'), 3869 css: 'functions' 3870 }, { 3871 regex: new RegExp(this.getKeywords(operators), 'gmi'), 3872 css: 'color1' 3873 }, { 3874 regex: new RegExp(this.getKeywords(keywords), 'gmi'), 3875 css: 'keyword' 3876 }]; 3877 } 3878 3879 Brush.prototype = new BrushBase(); 3880 Brush.aliases = ['coldfusion', 'cf']; 3881 module.exports = Brush; 3882 3883/***/ }, 3884/* 27 */ 3885/***/ function(module, exports, __webpack_require__) { 3886 3887 'use strict'; 3888 3889 var BrushBase = __webpack_require__(22); 3890 var regexLib = __webpack_require__(3).commonRegExp; 3891 3892 function Brush() { 3893 // Copyright 2006 Shin, YoungJin 3894 3895 var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' + 'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' + 'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' + 'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' + 'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' + 'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' + 'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' + 'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' + 'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' + 'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' + 'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' + 'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' + 'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' + 'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' + 'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' + 'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' + 'char char16_t char32_t bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' + 'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' + 'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' + '__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' + 'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' + 'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' + 'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' + 'va_list wchar_t wctrans_t wctype_t wint_t signed'; 3896 3897 var keywords = 'alignas alignof auto break case catch class const constexpr decltype __finally __exception __try ' + 'const_cast continue private public protected __declspec ' + 'default delete deprecated dllexport dllimport do dynamic_cast ' + 'else enum explicit extern if for friend goto inline ' + 'mutable naked namespace new noinline noreturn nothrow noexcept nullptr ' + 'register reinterpret_
3897cast return selectany ' + 'sizeof static static_cast static_assert struct switch template this ' + 'thread thread_local throw true false try typedef typeid typename union ' + 'using uuid virtual void volatile whcar_t while'; 3898 3899 var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' + 'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' + 'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' + 'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' + 'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' + 'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' + 'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' + 'fwrite getc getchar gets perror printf putc putchar puts remove ' + 'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' + 'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' + 'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' + 'mbtowc qsort rand realloc srand strtod strtol strtoul system ' + 'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' + 'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' + 'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' + 'clock ctime difftime gmtime localtime mktime strftime time'; 3900 3901 this.regexList = [{ 3902 regex: regexLib.singleLineCComments, 3903 css: 'comments' 3904 }, { 3905 regex: regexLib.multiLineCComments, 3906 css: 'comments' 3907 }, { 3908 regex: regexLib.doubleQuotedString, 3909 css: 'string' 3910 }, { 3911 regex: regexLib.singleQuotedString, 3912 css: 'string' 3913 }, { 3914 regex: /^ *#.*/gm, 3915 css: 'preprocessor' 3916 }, { 3917 regex: new RegExp(this.getKeywords(datatypes), 'gm'), 3918 css: 'color1 bold' 3919 }, { 3920 regex: new RegExp(this.getKeywords(functions), 'gm'), 3921 css: 'functions bold' 3922 }, { 3923 regex: new RegExp(this.getKeywords(keywords), 'gm'), 3924 css: 'keyword bold' 3925 }]; 3926 }; 3927 3928 Brush.prototype = new BrushBase(); 3929 Brush.aliases = ['cpp', 'cc', 'c++', 'c', 'h', 'hpp', 'h++']; 3930 module.exports = Brush; 3931 3932/***/ }, 3933/* 28 */ 3934/***/ function(module, exports, __webpack_require__) { 3935 3936 'use strict'; 3937 3938 var BrushBase = __webpack_require__(22); 3939 var regexLib = __webpack_require__(3).commonRegExp; 3940 var Match = __webpack_require__(5).Match; 3941 3942 function Brush() { 3943 var keywords = 'abstract as base bool break byte case catch char checked class const ' + 'continue decimal default delegate do double else enum event explicit volatile ' + 'extern false finally fixed float for foreach get goto if implicit in int ' + 'interface internal is lock long namespace new null object operator out ' + 'override params private protected public readonly ref return sbyte sealed set ' + 'short sizeof stackalloc static string struct switch this throw true try ' + 'typeof uint ulong unchecked unsafe ushort using virtual void while var ' + 'from group by into select let where orderby join on equals ascending descending'; 3944 3945 function fixComments(match, regexInfo) { 3946 var css = match[0].indexOf("///") == 0 ? 'color1' : 'comments'; 3947 return [new Match(match[0], match.index, css)]; 3948 } 3949 3950 this.regexList = [{ 3951 regex: regexLib.singleLineCComments, 3952 func: fixComments 3953 }, { 3954 regex: regexLib.multiLineCComments, 3955 css: 'comments' 3956 }, { 3957 regex: /@"(?:[^"]|"")*"/g, 3958 css: 'string' 3959 }, { 3960 regex: regexLib.doubleQuotedString, 3961 css: 'string' 3962 }, { 3963 regex: regexLib.singleQuotedString, 3964 css: 'string' 3965 }, { 3966 regex: /^\s*#.*/gm, 3967 css: 'preprocessor' 3968 }, { 3969 regex: new RegExp(this.getKeywords(keywords), 'gm'), 3970 css: 'keyword' 3971 }, { 3972 regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, 3973 css: 'keyword' 3974 }, { 3975 regex: /\byield(?=\s+(?:return|break)\b)/g, 3976 css: 'keyword' 3977 }]; 3978 3979 this.forHtmlScript(regexLib.aspScriptTags); 3980 }; 3981 3982 Brush.prototype = new BrushBase(); 3983 Brush.aliases = ['c#', 'c-sharp', 'csharp']; 3984 module.exports = Brush; 3985 3986/***/ }, 3987/* 29 */ 3988/***/ function(module, exports, __webpack_require__) { 3989 3990 'use strict'; 3991 3992 var BrushBase = __webpack_require__(22); 3993 var regexLib = __webpack_require__(3).commonRegExp; 3994 3995 function Brush() { 3996 function getKeywordsCSS(str) { 3997 return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; 3998 }; 3999 4000 function getValuesCSS(str) { 4001 return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; 4002 }; 4003 4004 var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode
4004-range units-per-em ' + 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index'; 4005 4006 var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder ' + 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed ' + 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double ' + 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia ' + 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic ' + 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha ' + 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower ' + 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset ' + 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side ' + 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow ' + 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize ' + 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal ' + 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin ' + 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; 4007 4008 var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; 4009 4010 this.regexList = [{ 4011 regex: regexLib.multiLineCComments, 4012 css: 'comments' 4013 }, { 4014 regex: regexLib.doubleQuotedString, 4015 css: 'string' 4016 }, { 4017 regex: regexLib.singleQuotedString, 4018 css: 'string' 4019 }, { 4020 regex: /\#[a-fA-F0-9]{3,6}/g, 4021 css: 'value' 4022 }, { 4023 regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, 4024 css: 'value' 4025 }, { 4026 regex: /!important/g, 4027 css: 'color3' 4028 }, { 4029 regex: new RegExp(getKeywordsCSS(keywords), 'gm'), 4030 css: 'keyword' 4031 }, { 4032 regex: new RegExp(getValuesCSS(values), 'g'), 4033 css: 'value' 4034 }, { 4035 regex: new RegExp(this.getKeywords(fonts), 'g'), 4036 css: 'color1' 4037 }]; 4038 4039 this.forHtmlScript({ 4040 left: /(<|<)\s*style.*?(>|>)/gi, 4041 right: /(<|<)\/\s*style\s*(>|>)/gi 4042 }); 4043 }; 4044 4045 Brush.prototype = new BrushBase(); 4046 Brush.aliases = ['css']; 4047 module.exports = Brush; 4048 4049/***/ }, 4050/* 30 */ 4051/***/ function(module, exports, __webpack_require__) { 4052 4053 'use strict'; 4054 4055 var BrushBase = __webpack_require__(22); 4056 var regexLib = __webpack_require__(3).commonRegExp; 4057 4058 function Brush() { 4059 var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + 'case char class comp const constructor currency destructor div do double ' + 'downto else end except exports extended false file finalization finally ' + 'for function goto if implementation in inherited int64 initialization ' + 'integer interface is label library longint longword mod nil not object ' + 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + 'pint64 pointer private procedure program property pshortstring pstring ' + 'pvariant pwidechar pwidestring protected public published raise real real48 ' + 'record repeat set shl shortint shortstring shr single smallint string then ' + 'threadvar to true try type unit until uses val var varirnt while widechar ' + 'widestring with word write writeln xor'; 4060 4061 this.regexList = [{ 4062 regex: /\(\*[\s\S]*?\*\)/gm, 4063 css: 'comments' 4064 }, { 4065 regex: /{(?!\$)[\s\S]*?}/gm, 4066 css: 'comments' 4067 }, { 4068 regex: regexLib.singleLineCComments, 4069 css: 'comments' 4070 }, { 4071 regex: regexLib.singleQuotedString, 4072 css: 'string' 4073 }, { 4074 regex: /\{\$[a-zA-Z]+ .+\}/g, 4075 css: 'color1' 4076 }, { 4077 regex: /\b[\d\.]+\b/g, 4078 css: 'value' 4079 }, { 4080 regex: /\$[a-zA-Z0-9]+\b/g, 4081 css: 'value' 4082 }, { 4083 regex: new RegExp(this.getKeywords(keywords), 'gmi'), 4084 css: 'keyword' 4085 }]; 4086 }; 4087 4088 Brush.prototype = new BrushBase(); 4089 Brush.aliases = ['delphi', 'pascal', 'pas']; 4090 module.exports = Brush; 4091 4092/***/ }, 4093/* 31 */ 4094/***/ function(module, exports, __webpack_require__) { 4095 4096 'use strict'; 4097 4098 var BrushBase = __webpack_require__(22); 4099 var regexLib = __webpack_require__(3).commonRegExp; 4100 4101 function Brush() { 4102 this.regexList = [{ 4103 regex: /^\+\+\+ .*$/gm, 4104 css: 'color2' 4105 }, { 4106 regex: /^\-\-\- .*$/gm, 4107 css: 'color2' 4108 }, { 4109 regex: /^\s.*$/gm, 4110 css: 'color1' 4111 }, { 4112 regex: /^@@.*@@.*$/gm, 4113 css: 'variable' 4114 }, { 4115 regex: /^\+.*$/gm, 4116 css: 'string' 4117 }, { 4118 regex: /^\-.*$/gm, 4119 css: 'color3' 4120 }]; 4121 }; 4122 4123 Brush.prototype = new BrushBase(); 4124 Brush.aliases = ['diff', 'patch']; 4125 module.exports = Brush; 4126 4127/***/ }, 4128/* 32 */ 4129/***/ function(module, exports, __webpack_require__) { 4130 4131 'use strict'; 4132 4133 var BrushBase = __webpack_require__(22); 4134 var regexLib = __webpack_require__(3).commonRegExp; 4135 4136 function Brush() { 4137 // Contributed by Jean-Lou Dupont 4138 // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html 4139 4140 // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5 4141 var keywords = 'after and andalso band begin bnot bor bsl bsr bxor ' + 'case catch cond div end fun if let not of or orelse ' + 'query receive rem try when xor' + 4142 // additional 4143 ' module export import define'; 4144 4145 this.regexList = [{ 4146 regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), 4147 css: 'constants' 4148 }, { 4149 regex: new RegExp("\\%.+", 'gm'), 4150 css: 'comments' 4151 }, { 4152 regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), 4153 css: 'preprocessor' 4154 }, { 4155 regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), 4156 css: 'functions' 4157 }, { 4158 regex: regexLib.doubleQuotedString, 4159 css: 'string' 4160 }, { 4161 regex: regexLib.singleQuotedString, 4162 css: 'string' 4163 }, { 4164 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4165 css: 'keyword' 4166 }]; 4167 }; 4168 4169 Brush.prototype = new BrushBase(); 4170 Brush.aliases = ['erl', 'erlang']; 4171 module.exports = Brush; 4172 4173/***/ }, 4174/* 33 */ 4175/***/ function(module, exports, __webpack_require__) { 4176 4177 'use strict'; 4178 4179 var BrushBase = __webpack_require__(22); 4180 var regexLib = __webpack_require__(3).commonRegExp; 4181 4182 function Brush() { 4183 // Contributed by Andres Almiray 4184 // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter 4185 4186 var keywords = 'as assert break case catch class continue def default do else extends finally ' + 'if in implements import instanceof interface new package property return switch ' + 'throw throws try while public protected private static'; 4187 var types = 'void boolean byte char short int long float double'; 4188 var constants = 'null';
4189 var methods = 'allProperties count get size ' + 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + 'findIndexOf grep inject max min reverseEach sort ' + 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + 'transformChar transformLine withOutputStream withPrintWriter withStream ' + 'withStreams withWriter withWriterAppend write writeLine ' + 'dump inspect invokeMethod print println step times upto use waitForOrKill ' + 'getText'; 4190 4191 this.regexList = [{ 4192 regex: regexLib.singleLineCComments, 4193 css: 'comments' 4194 }, { 4195 regex: regexLib.multiLineCComments, 4196 css: 'comments' 4197 }, { 4198 regex: regexLib.doubleQuotedString, 4199 css: 'string' 4200 }, { 4201 regex: regexLib.singleQuotedString, 4202 css: 'string' 4203 }, { 4204 regex: /""".*"""/g, 4205 css: 'string' 4206 }, { 4207 regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), 4208 css: 'value' 4209 }, { 4210 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4211 css: 'keyword' 4212 }, { 4213 regex: new RegExp(this.getKeywords(types), 'gm'), 4214 css: 'color1' 4215 }, { 4216 regex: new RegExp(this.getKeywords(constants), 'gm'), 4217 css: 'constants' 4218 }, { 4219 regex: new RegExp(this.getKeywords(methods), 'gm'), 4220 css: 'functions' 4221 }]; 4222 4223 this.forHtmlScript(regexLib.aspScriptTags); 4224 } 4225 4226 Brush.prototype = new BrushBase(); 4227 Brush.aliases = ['groovy']; 4228 module.exports = Brush; 4229 4230/***/ }, 4231/* 34 */ 4232/***/ function(module, exports, __webpack_require__) { 4233 4234 'use strict'; 4235 4236 var BrushBase = __webpack_require__(22); 4237 var regexLib = __webpack_require__(3).commonRegExp; 4238 4239 function Brush() { 4240 4241 var inits = 'class interface package macro enum typedef extends implements dynamic in for if while else do try switch case catch'; 4242 4243 var keywords = 'return break continue new throw cast using import function public private inline static untyped callback true false null Int Float String Void Std Bool Dynamic Array Vector'; 4244 4245 this.regexList = [{ 4246 regex: regexLib.singleLineCComments, 4247 css: 'comments' 4248 }, { 4249 regex: regexLib.multiLineCComments, 4250 css: 'comments' 4251 }, { 4252 regex: regexLib.doubleQuotedString, 4253 css: 'string' 4254 }, { 4255 regex: regexLib.singleQuotedString, 4256 css: 'string' 4257 }, { 4258 regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, 4259 css: 'value' 4260 }, { 4261 regex: new RegExp(this.getKeywords(inits), 'gm'), 4262 css: 'color3' 4263 }, { 4264 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4265 css: 'keyword' 4266 }, { 4267 regex: new RegExp('var', 'gm'), 4268 css: 'variable' 4269 }, { 4270 regex: new RegExp('trace', 'gm'), 4271 css: 'color1' 4272 }, { 4273 regex: new RegExp('#if', 'gm'), 4274 css: 'comments' 4275 }, { 4276 regex: new RegExp('#elseif', 'gm'), 4277 css: 'comments' 4278 }, { 4279 regex: new RegExp('#end', 'gm'), 4280 css: 'comments' 4281 }, { 4282 regex: new RegExp('#error', 'gm'), 4283 css: 'comments' 4284 }]; 4285 4286 //standard compiler conditionals flags 4287 var flags = ["debug", "error", "cpp", "js", "neko", "php", "flash", "flash8", "flash9", "flash10", "flash10", "mobile", "desktop", "web", "ios", "android", "iphone"]; 4288 4289 //append the flags to the array with a ! operator 4290 var i; 4291 var length = flags.length; 4292 for (i = 0; i <= length - 1; i++) { 4293 this.regexList.push({ 4294 regex: new RegExp(flags[i], 'gm'), 4295 css: 'comments' 4296 }); 4297 this.regexList.push({ 4298 regex: new RegExp('!' + flags[i], 'gm'), 4299 css: 'comments' 4300 }); 4301 } 4302 4303 this.forHtmlScript(regexLib.scriptScriptTags); 4304 } 4305 4306 ; 4307 4308 Brush.prototype = new BrushBase(); 4309 Brush.aliases = ['haxe', 'hx']; 4310 module.exports = Brush; 4311 4312/***/ }, 4313/* 35 */ 4314/***/ function(module, exports, __webpack_require__) { 4315 4316 'use strict'; 4317 4318 var BrushBase = __webpack_require__(22); 4319 var regexLib = __webpack_require__(3).commonRegExp; 4320 4321 function Brush() { 4322 var keywords = 'abstract assert boolean break byte case catch char class const ' + 'continue default do double else enum extends ' + 'false final finally float for goto if implements import ' + 'instanceof int interface long native new null ' + 'package private protected public return ' + 'short static strictfp super switch synchronized this throw throws true ' + 'transient try void volatile while'; 4323 4324 this.regexList = [{ 4325 regex: regexLib.singleLineCComments, 4326 css: 'comments' 4327 }, { 4328 regex: /\/\*([^\*][\s\S]*?)?\*\//gm, 4329 css: 'comments' 4330 }, { 4331 regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, 4332 css: 'preprocessor' 4333 }, { 4334 regex: regexLib.doubleQuotedString, 4335 css: 'string' 4336 }, { 4337 regex: regexLib.singleQuotedString, 4338 css: 'string' 4339 }, { 4340 regex: /\b([\d]+(\.[\d]+)?f?|[\d]+l?|0x[a-f0-9]+)\b/gi, 4341 css: 'value' 4342 }, { 4343 regex: /(?!\@interface\b)\@[\$\w]+\b/g, 4344 css: 'color1' 4345 }, { 4346 regex: /\@interface\b/g, 4347 css: 'color2' 4348 }, { 4349 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4350 css: 'keyword' 4351 }]; 4352 4353 this.forHtmlScript({ 4354 left: /(<|<)%[@!=]?/g, 4355 right: /%(>|>)/g 4356 }); 4357 }; 4358 4359 Brush.prototype = new BrushBase(); 4360 Brush.aliases = ['java']; 4361 module.exports = Brush; 4362 4363/***/ }, 4364/* 36 */ 4365/***/ function(module, exports, __webpack_require__) { 4366 4367 'use strict'; 4368 4369 var BrushBase = __webpack_require__(22); 4370 var regexLib = __webpack_require__(3).commonRegExp; 4371 4372 function Brush() { 4373 // Contributed by Patrick Webster 4374 // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html 4375 var datatypes = 'Boolean Byte Character Double Duration ' + 'Float Integer Long Number Short String Void'; 4376 4377 var keywords = 'abstract after and as assert at before bind bound break catch class ' + 'continue def delete else exclusive extends false finally first for from ' + 'function if import in indexof init insert instanceof into inverse last ' + 'lazy mixin mod nativearray new not null on or override package postinit ' + 'protected public public-init public-read replace return reverse sizeof ' + '
4377step super then this throw true try tween typeof var where while with ' + 'attribute let private readonly static trigger'; 4378 4379 this.regexList = [{ 4380 regex: regexLib.singleLineCComments, 4381 css: 'comments' 4382 }, { 4383 regex: regexLib.multiLineCComments, 4384 css: 'comments' 4385 }, { 4386 regex: regexLib.singleQuotedString, 4387 css: 'string' 4388 }, { 4389 regex: regexLib.doubleQuotedString, 4390 css: 'string' 4391 }, { 4392 regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, 4393 css: 'color2' 4394 }, { 4395 regex: new RegExp(this.getKeywords(datatypes), 'gm'), 4396 css: 'variable' 4397 }, { 4398 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4399 css: 'keyword' 4400 }]; 4401 this.forHtmlScript(regexLib.aspScriptTags); 4402 }; 4403 4404 Brush.prototype = new BrushBase(); 4405 Brush.aliases = ['jfx', 'javafx']; 4406 module.exports = Brush; 4407 4408/***/ }, 4409/* 37 */ 4410/***/ function(module, exports, __webpack_require__) { 4411 4412 'use strict'; 4413 4414 var BrushBase = __webpack_require__(22); 4415 var regexLib = __webpack_require__(3).commonRegExp; 4416 4417 function Brush() { 4418 var keywords = 'break case catch class continue ' + 'default delete do else enum export extends false ' + 'for from as function if implements import in instanceof ' + 'interface let new null package private protected ' + 'static return super switch ' + 'this throw true try typeof var while with yield'; 4419 4420 this.regexList = [{ 4421 regex: regexLib.multiLineDoubleQuotedString, 4422 css: 'string' 4423 }, { 4424 regex: regexLib.multiLineSingleQuotedString, 4425 css: 'string' 4426 }, { 4427 regex: regexLib.singleLineCComments, 4428 css: 'comments' 4429 }, { 4430 regex: regexLib.multiLineCComments, 4431 css: 'comments' 4432 }, { 4433 regex: /\s*#.*/gm, 4434 css: 'preprocessor' 4435 }, { 4436 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4437 css: 'keyword' 4438 }]; 4439 4440 this.forHtmlScript(regexLib.scriptScriptTags); 4441 } 4442 4443 Brush.prototype = new BrushBase(); 4444 Brush.aliases = ['js', 'jscript', 'javascript', 'json']; 4445 module.exports = Brush; 4446 4447/***/ }, 4448/* 38 */ 4449/***/ function(module, exports, __webpack_require__) { 4450 4451 'use strict'; 4452 4453 var BrushBase = __webpack_require__(22); 4454 var regexLib = __webpack_require__(3).commonRegExp; 4455 4456 function Brush() { 4457 // Contributed by David Simmons-Duffin and Marty Kube 4458 4459 var funcs = 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' + 'chroot close closedir connect cos crypt defined delete each endgrent ' + 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' + 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' + 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' + 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' + 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' + 'getservbyname getservbyport getservent getsockname getsockopt glob ' + 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' + 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' + 'oct open opendir ord pack pipe pop pos print printf prototype push ' + 'quotemeta rand read readdir readline readlink readpipe recv rename ' + 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' + 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' + 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' + 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' + 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' + 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' + 'undef unlink unpack unshift utime values vec wait waitpid warn write ' + 4460 // feature 4461 'say'; 4462 4463 var keywords = 'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' + 'for foreach goto if import last local my next no our package redo ref ' + 'require return sub tie tied unless untie until use wantarray while ' + 4464 // feature 4465 'given when default ' + 4466 // Try::Tiny 4467 'try catch finally ' + 4468 // Moose 4469 'has extends with before after around override augment'; 4470 4471 this.regexList = [{ 4472 regex: /(<<|<<)((\w+)|(['"])(.+?)\4)[\s\S]+?\n\3\5\n/g, 4473 css: 'string' 4474 }, { 4475 regex: /#.*$/gm, 4476 css: 'comments' 4477 }, { 4478 regex: /^#!.*\n/g, 4479 css: 'preprocessor' 4480 }, { 4481 regex: /-?\w+(?=\s*=(>|>))/g, 4482 css: 'string' 4483 }, 4484 4485 // is this too much? 4486 { 4487 regex: /\bq[qwxr]?\([\s\S]*?\)/g, 4488 css: 'string' 4489 }, { 4490 regex: /\bq[qwxr]?\{[\s\S]*?\}/g, 4491 css: 'string' 4492 }, { 4493 regex: /\bq[qwxr]?\[[\s\S]*?\]/g, 4494 css: 'string' 4495 }, { 4496 regex: /\bq[qwxr]?(<|<)[\s\S]*?(>|>)/g, 4497 css: 'string' 4498 }, { 4499 regex: /\bq[qwxr]?([^\w({<[])[\s\S]*?\1/g, 4500 css: 'string' 4501 }, { 4502 regex: regexLib.doubleQuotedString, 4503 css: 'string' 4504 }, { 4505 regex: regexLib.singleQuotedString, 4506 css: 'string' 4507 }, { 4508 regex: /(?:&|[$@%*]|\$#)\$?[a-zA-Z_](\w+|::)*/g, 4509 css: 'variable' 4510 }, { 4511 regex: /\b__(?:END|DATA)__\b[\s\S]*$/g, 4512 css: 'comments' 4513 }, { 4514 regex: /(^|\n)=\w[\s\S]*?(\n=cut\s*(?=\n)|$)/g, 4515 css: 'comments' 4516 }, { 4517 regex: new RegExp(this.getKeywords(funcs), 'gm'), 4518 css: 'functions' 4519 }, { 4520 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4521 css: 'keyword' 4522 }]; 4523 4524 this.forHtmlScript(regexLib.phpScriptTags); 4525 } 4526 4527 Brush.prototype = new BrushBase(); 4528 Brush.aliases = ['perl', 'Perl', 'pl']; 4529 module.exports = Brush; 4530 4531/***/ }, 4532/* 39 */ 4533/***/ function(module, exports, __webpack_require__) { 4534 4535 'use strict'; 4536 4537 Object.defineProperty(exports, "__esModule", { 4538 value: true 4539 }); 4540 4541 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4542 4543 var _brushBase = __webpack_require__(22); 4544 4545 var _brushBase2 = _interopRequireDefault(_brushBase); 4546 4547 var _syntaxhighlighterRegex = __webpack_require__(3); 4548 4549 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4550 4551 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4552 4553 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 4554 4555 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
4555onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 4556 4557 var functions = 'abs acos acosh addcslashes addslashes ' + 'array_change_key_case array_chunk array_combine array_count_values array_diff ' + 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill ' + 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key ' + 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map ' + 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product ' + 'array_push array_rand array_reduce array_reverse array_search array_shift ' + 'array_slice array_splice array_sum array_udiff array_udiff_assoc ' + 'array_udiff_uassoc array_uintersect array_uintersect_assoc ' + 'array_uintersect_uassoc array_unique array_unshift array_values array_walk ' + 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert ' + 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress ' + 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir ' + 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists ' + 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct ' + 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log ' + 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded ' + 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents ' + 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype ' + 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf ' + 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname ' + 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt ' + 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext ' + 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set ' + 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double ' + 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long ' + 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault ' + 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br ' + 'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir ' + 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split ' + 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes ' + 'stripos stripslashes stristr strlen strnatcasecmp strnat
4557cmp strncasecmp strncmp strpbrk ' + 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime ' + 'strtoupper strtr strval substr substr_compare'; 4558 4559 var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' + 'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final finally for foreach ' + 'function global goto if implements include include_once interface instanceof insteadof namespace new ' + 'old_function or private protected public return require require_once static switch ' + 'trait throw try use const while xor yield '; 4560 4561 var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__'; 4562 4563 var Brush = function (_BrushBase) { 4564 _inherits(Brush, _BrushBase); 4565 4566 _createClass(Brush, null, [{ 4567 key: 'aliases', 4568 get: function get() { 4569 return ['php']; 4570 } 4571 }]); 4572 4573 function Brush() { 4574 _classCallCheck(this, Brush); 4575 4576 var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Brush).call(this)); 4577 4578 _this.regexList = [{ regex: _syntaxhighlighterRegex.commonRegExp.singleLineCComments, css: 'comments' }, { regex: _syntaxhighlighterRegex.commonRegExp.multiLineCComments, css: 'comments' }, { regex: _syntaxhighlighterRegex.commonRegExp.doubleQuotedString, css: 'string' }, { regex: _syntaxhighlighterRegex.commonRegExp.singleQuotedString, css: 'string' }, { regex: /\$\w+/g, css: 'variable' }, { regex: new RegExp(_this.getKeywords(functions), 'gmi'), css: 'functions' }, { regex: new RegExp(_this.getKeywords(constants), 'gmi'), css: 'constants' }, { regex: new RegExp(_this.getKeywords(keywords), 'gm'), css: 'keyword' }]; 4579 4580 _this.forHtmlScript(_syntaxhighlighterRegex.commonRegExp.phpScriptTags); 4581 return _this; 4582 } 4583 4584 return Brush; 4585 }(_brushBase2.default); 4586 4587 exports.default = Brush; 4588 4589/***/ }, 4590/* 40 */ 4591/***/ function(module, exports, __webpack_require__) { 4592 4593 'use strict'; 4594 4595 var BrushBase = __webpack_require__(22); 4596 var regexLib = __webpack_require__(3).commonRegExp; 4597 4598 function Brush() { 4599 this.regexList = []; 4600 }; 4601 4602 Brush.prototype = new BrushBase(); 4603 Brush.aliases = ['text', 'plain']; 4604 module.exports = Brush; 4605 4606/***/ }, 4607/* 41 */ 4608/***/ function(module, exports, __webpack_require__) { 4609 4610 'use strict'; 4611 4612 var BrushBase = __webpack_require__(22); 4613 var regexLib = __webpack_require__(3).commonRegExp; 4614 4615 function Brush() { 4616 // Contributed by Joel 'Jaykul' Bennett, http://PoshCode.org | http://HuddledMasses.org 4617 var keywords = 'while validateset validaterange validatepattern validatelength validatecount ' + 'until trap switch return ref process param parameter in if global: ' + 'function foreach for finally filter end elseif else dynamicparam do default ' + 'continue cmdletbinding break begin alias \\? % #script #private #local #global ' + 'mandatory parametersetname position valuefrompipeline ' + 'valuefrompipelinebypropertyname valuefromremainingarguments helpmessage '; 4618 4619 var operators = ' and as band bnot bor bxor casesensitive ccontains ceq cge cgt cle ' + 'clike clt cmatch cne cnotcontains cnotlike cnotmatch contains ' + 'creplace eq exact f file ge gt icontains ieq ige igt ile ilike ilt ' + 'imatch ine inotcontains inotlike inotmatch ireplace is isnot le like ' + 'lt match ne not notcontains
4619notlike notmatch or regex replace wildcard'; 4620 4621 var verbs = 'write where wait use update unregister undo trace test tee take suspend ' + 'stop start split sort skip show set send select scroll resume restore ' + 'restart resolve resize reset rename remove register receive read push ' + 'pop ping out new move measure limit join invoke import group get format ' + 'foreach export expand exit enter enable disconnect disable debug cxnew ' + 'copy convertto convertfrom convert connect complete compare clear ' + 'checkpoint aggregate add'; 4622 4623 // I can't find a way to match the comment based help in multi-line comments, because SH won't highlight in highlights, and javascript doesn't support lookbehind 4624 var commenthelp = ' component description example externalhelp forwardhelpcategory forwardhelptargetname forwardhelptargetname functionality inputs link notes outputs parameter remotehelprunspace role synopsis'; 4625 4626 this.regexList = [{ 4627 regex: new RegExp('^\\s*#[#\\s]*\\.(' + this.getKeywords(commenthelp) + ').*$', 'gim'), 4628 css: 'preprocessor help bold' 4629 }, { 4630 regex: regexLib.singleLinePerlComments, 4631 css: 'comments' 4632 }, { 4633 regex: /(<|<)#[\s\S]*?#(>|>)/gm, 4634 css: 'comments here' 4635 }, { 4636 regex: new RegExp('@"\\n[\\s\\S]*?\\n"@', 'gm'), 4637 css: 'script string here' 4638 }, { 4639 regex: new RegExp("@'\\n[\\s\\S]*?\\n'@", 'gm'), 4640 css: 'script string single here' 4641 }, { 4642 regex: new RegExp('"(?:\\$\\([^\\)]*\\)|[^"]|`"|"")*[^`]"', 'g'), 4643 css: 'string' 4644 }, { 4645 regex: new RegExp("'(?:[^']|'')*'", 'g'), 4646 css: 'string single' 4647 }, { 4648 regex: new RegExp('[\\$|@|@@](?:(?:global|script|private|env):)?[A-Z0-9_]+', 'gi'), 4649 css: 'variable' 4650 }, { 4651 regex: new RegExp('(?:\\b' + verbs.replace(/ /g, '\\b|\\b') + ')-[a-zA-Z_][a-zA-Z0-9_]*', 'gmi'), 4652 css: 'functions' 4653 }, { 4654 regex: new RegExp(this.getKeywords(keywords), 'gmi'), 4655 css: 'keyword' 4656 }, { 4657 regex: new RegExp('-' + this.getKeywords(operators), 'gmi'), 4658 css: 'operator value' 4659 }, { 4660 regex: new RegExp('\\[[A-Z_\\[][A-Z0-9_. `,\\[\\]]*\\]', 'gi'), 4661 css: 'constants' 4662 }, { 4663 regex: new RegExp('\\s+-(?!' + this.getKeywords(operators) + ')[a-zA-Z_][a-zA-Z0-9_]*', 'gmi'), 4664 css: 'color1' 4665 }]; 4666 }; 4667 4668 Brush.prototype = new BrushBase(); 4669 Brush.aliases = ['powershell', 'ps', 'posh']; 4670 module.exports = Brush; 4671 4672/***/ }, 4673/* 42 */ 4674/***/ function(module, exports, __webpack_require__) { 4675 4676 'use strict'; 4677 4678 var BrushBase = __webpack_require__(22); 4679 var regexLib = __webpack_require__(3).commonRegExp; 4680 4681 function Brush() { 4682 // Contributed by Gheorghe Milas and Ahmad Sherif 4683 4684 var keywords = 'and assert break class continue def del elif else ' + 'except exec finally for from global if import in is ' + 'lambda not or pass raise return try yield while'; 4685 4686 var funcs = '__import__ abs all any apply basestring bin bool buffer 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 min next ' + 'object oct open ord pow print property range raw_input reduce ' + 'reload repr reversed round set setattr slice sorted staticmethod ' + 'str sum super tuple type type unichr unicode vars xrange zip'; 4687 4688 var special = 'None True False self cls class_'; 4689 4690 this.regexList = [{ 4691 regex: regexLib.singleLinePerlComments, 4692 css: 'comments' 4693 }, { 4694 regex: /^\s*@\w+/gm, 4695 css: 'decorator' 4696 }, { 4697 regex: /(['\"]{3})([^\1])*?\1/gm, 4698 css: 'comments' 4699 }, { 4700 regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, 4701 css: 'string' 4702 }, { 4703 regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, 4704 css: 'string' 4705 }, { 4706 regex: /\+|\-|\*|\/|\%|=|==/gm, 4707 css: 'keyword' 4708 }, { 4709 regex: /\b\d+\.?\w*/g, 4710 css: 'value' 4711 }, { 4712 regex: new RegExp(this.getKeywords(funcs), 'gmi'), 4713 css: 'functions' 4714 }, { 4715 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4716 css: 'keyword' 4717 }, { 4718 regex: new RegExp(this.getKeywords(special), 'gm'), 4719 css: 'color1' 4720 }]; 4721
4722 this.forHtmlScript(regexLib.aspScriptTags); 4723 }; 4724 4725 Brush.prototype = new BrushBase(); 4726 Brush.aliases = ['py', 'python']; 4727 module.exports = Brush; 4728 4729/***/ }, 4730/* 43 */ 4731/***/ function(module, exports, __webpack_require__) { 4732 4733 'use strict'; 4734 4735 var BrushBase = __webpack_require__(22); 4736 var regexLib = __webpack_require__(3).commonRegExp; 4737 4738 function Brush() { 4739 // Contributed by Erik Peterson. 4740 4741 var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + 'self super then throw true undef unless until when while yield'; 4742 4743 var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + 'ThreadGroup Thread Time TrueClass'; 4744 4745 this.regexList = [{ 4746 regex: regexLib.singleLinePerlComments, 4747 css: 'comments' 4748 }, { 4749 regex: regexLib.doubleQuotedString, 4750 css: 'string' 4751 }, { 4752 regex: regexLib.singleQuotedString, 4753 css: 'string' 4754 }, { 4755 regex: /\b[A-Z0-9_]+\b/g, 4756 css: 'constants' 4757 }, { 4758 regex: /:[a-z][A-Za-z0-9_]*/g, 4759 css: 'color2' 4760 }, { 4761 regex: /(\$|@@|@)\w+/g, 4762 css: 'variable bold' 4763 }, { 4764 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4765 css: 'keyword' 4766 }, { 4767 regex: new RegExp(this.getKeywords(builtins), 'gm'), 4768 css: 'color1' 4769 }]; 4770 4771 this.forHtmlScript(regexLib.aspScriptTags); 4772 }; 4773 4774 Brush.prototype = new BrushBase(); 4775 Brush.aliases = ['ruby', 'rails', 'ror', 'rb']; 4776 module.exports = Brush; 4777 4778/***/ }, 4779/* 44 */ 4780/***/ function(module, exports, __webpack_require__) { 4781 4782 'use strict'; 4783 4784 var BrushBase = __webpack_require__(22); 4785 var regexLib = __webpack_require__(3).commonRegExp; 4786 4787 function Brush() { 4788 function getKeywordsCSS(str) { 4789 return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; 4790 }; 4791 4792 function getValuesCSS(str) { 4793 return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; 4794 }; 4795 4796 function getKeywordsPrependedBy(keywords, by) { 4797 return '(?:' + keywords.replace(/^\s+|\s+$/g, '').replace(/\s+/g, '|' + by + '\\b').replace(/^/, by + '\\b') + ')\\b'; 4798 } 4799 4800 var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' + 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index zoom'; 4801 4802 var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder ' + 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed ' + 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero digits disc dotted double ' + 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia ' + 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic ' + 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha ' + 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower ' + 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset ' + 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side ' + 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow ' + 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize ' + 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal ' + 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin ' + 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; 4803 4804 var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; 4805 4806 var statements = 'important default'; 4807 var preprocessor = 'import extend debug warn if else for while mixin function include content media'; 4808 4809 var r = regexLib; 4810 4811 this.regexList = [{ 4812 regex: r.multiLineCComments, 4813 css: 'comments' 4814 }, { 4815 regex: r.singleLineCComments, 4816 css: 'comments' 4817 }, { 4818 regex: r.doubleQuotedString, 4819 css: 'string' 4820 }, { 4821 regex: r.singleQuotedString, 4822 css: 'string' 4823 }, { 4824 regex: /\#[a-fA-F0-9]{3,6}/g, 4825 css: 'value' 4826 }, { 4827 regex: /\b(-?\d+)(\.\d+)?(px|em|rem|pt|\:|\%|)\b/g, 4828 css: 'value' 4829 }, { 4830 regex: /\$[\w-]+/g, 4831 css: 'variable' 4832 }, { 4833 regex: new RegExp(getKeywordsPrependedBy(statements, '!'), 'g'), 4834 css: 'color3' 4835 }, { 4836 regex: new RegExp(getKeywordsPrependedBy(preprocessor, '@'), 'g'), 4837 css: 'preprocessor' 4838 }, { 4839 regex: new RegExp(getKeywordsCSS(keywords), 'gm'), 4840 css: 'keyword' 4841 }, { 4842 regex: new RegExp(getValuesCSS(values), 'g'), 4843 css: 'value' 4844 }, { 4845 regex: new RegExp(this.getKeywords(fonts), 'g'), 4846 css: 'color1' 4847 }]; 4848 }; 4849 4850 Brush.prototype = new BrushBase(); 4851 Brush.aliases = ['sass', 'scss']; 4852 module.exports = Brush; 4853 4854/***/ }, 4855/* 45 */ 4856/***/ function(module, exports, __webpack_require__) { 4857 4858 'use strict'; 4859 4860 var BrushBase = __webpack_require__(22); 4861 var regexLib = __webpack_require__(3).commonRegExp; 4862 4863 function Brush() { 4864 // Contributed by Yegor Jbanov and David Bernard. 4865 4866 var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' + 'override try lazy for var catch throw type extends class while with new final yield abstract ' + 'else do if return protected private this package false'; 4867 4868 var keyops = '[_:=><%#@]+'; 4869 4870 this.regexList = [{ 4871 regex: regexLib.singleLineCComments, 4872 css: 'comments' 4873 }, { 4874 regex: regexLib.multiLineCComments, 4875 css: 'comments' 4876 }, { 4877 regex: regexLib.multiLineSingleQuotedString, 4878 css: 'string' 4879 }, { 4880 regex: regexLib.multiLineDoubleQuotedString, 4881 css: 'string' 4882 }, { 4883 regex: regexLib.singleQuotedString, 4884 css: 'string' 4885 }, { 4886 regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, 4887 css: 'value' 4888 }, { 4889 regex: new RegExp(this.getKeywords(keywords), 'gm'), 4890 css: 'keyword' 4891 }, { 4892 regex: new RegExp(keyops, 'gm'), 4893 css: 'keyword' 4894 }]; 4895 } 4896 4897 Brush.prototype = new BrushBase(); 4898 Brush.aliases = ['scala']; 4899 module.exports = Brush; 4900 4901/***/ }, 4902/* 46 */ 4903/***/ function(module, exports, __webpack_require__) { 4904 4905 'use strict'; 4906 4907 var BrushBase = __webpack_require__(22); 4908 var regexLib = __webpack_require__(3).commonRegExp; 4909 4910 function Brush() { 4911 var funcs = 'abs avg case cast coalesce convert count current_timestamp ' + 'current_user day isnull left lower month nullif replace right ' + '
4911session_user space substring sum system_user upper user year'; 4912 4913 var keywords = 'absolute action add after alter as asc at authorization begin bigint ' + 'binary bit by cascade char character check checkpoint close collate ' + 'column commit committed connect connection constraint contains continue ' + 'create cube current current_date current_time cursor database date ' + 'deallocate dec decimal declare default delete desc distinct double drop ' + 'dynamic else end end-exec escape except exec execute false fetch first ' + 'float for force foreign forward free from full function global goto grant ' + 'group grouping having hour ignore index inner insensitive insert instead ' + 'int integer intersect into is isolation key last level load local max min ' + 'minute modify move name national nchar next no numeric of off on only ' + 'open option order out output partial password precision prepare primary ' + 'prior privileges procedure public read real references relative repeatable ' + 'restrict return returns revoke rollback rollup rows rule schema scroll ' + 'second section select sequence serializable set size smallint static ' + 'statistics table temp temporary then time timestamp to top transaction ' + 'translation trigger true truncate uncommitted union unique update values ' + 'varchar varying view when where with work'; 4914 4915 var operators = 'all and any between cross in join like not null or outer some'; 4916 4917 this.regexList = [{ 4918 regex: /--(.*)$/gm, 4919 css: 'comments' 4920 }, { 4921 regex: /\/\*([^\*][\s\S]*?)?\*\//gm, 4922 css: 'comments' 4923 }, { 4924 regex: regexLib.multiLineDoubleQuotedString, 4925 css: 'string' 4926 }, { 4927 regex: regexLib.multiLineSingleQuotedString, 4928 css: 'string' 4929 }, { 4930 regex: new RegExp(this.getKeywords(funcs), 'gmi'), 4931 css: 'color2' 4932 }, { 4933 regex: new RegExp(this.getKeywords(operators), 'gmi'), 4934 css: 'color1' 4935 }, { 4936 regex: new RegExp(this.getKeywords(keywords), 'gmi'), 4937 css: 'keyword' 4938 }]; 4939 }; 4940 4941 Brush.prototype = new BrushBase(); 4942 Brush.aliases = ['sql']; 4943 module.exports = Brush; 4944 4945/***/ }, 4946/* 47 */ 4947/***/ function(module, exports, __webpack_require__) { 4948 4949 'use strict'; 4950 4951 var BrushBase = __webpack_require__(22); 4952 var regexLib = __webpack_require__(3).commonRegExp; 4953 var Match = __webpack_require__(5).Match; 4954 4955 function Brush() { 4956 // Swift brush contributed by Nate Cook 4957 // http://natecook.com/code/swift-syntax-highlighting 4958 4959 function getKeywordsPrependedBy(keywords, by) { 4960 return '(?:' + keywords.replace(/^\s+|\s+$/g, '').replace(/\s+/g, '|' + by + '\\b').replace(/^/, by + '\\b') + ')\\b'; 4961 } 4962 4963 function multiLineCCommentsAdd(match, regexInfo) { 4964 var str = match[0], 4965 result = [], 4966 pos = 0, 4967 matchStart = 0, 4968 level = 0; 4969 4970 while (pos < str.length - 1) { 4971 var chunk = str.substr(pos, 2); 4972 if (level == 0) { 4973 if (chunk == "/*") { 4974 matchStart = pos; 4975 level++; 4976 pos += 2; 4977 } else { 4978 pos++; 4979 } 4980 } else { 4981 if (chunk == "/*") { 4982 level++; 4983 pos += 2; 4984 } else if (chunk == "*/") { 4985 level--; 4986 if (level == 0) { 4987 result.push(new Match(str.substring(matchStart, pos + 2), matchStart + match.index, regexInfo.css)); 4988 } 4989 pos += 2; 4990 } else { 4991 pos++; 4992 } 4993 } 4994 } 4995 4996 return result; 4997 } 4998 4999 function stringAdd(match, regexInfo) { 5000 var str = match[0], 5001 result = [], 5002 pos = 0, 5003 matchStart = 0, 5004 level = 0; 5005 5006 while (pos < str.length - 1) { 5007 if (level == 0) { 5008 if (str.substr(pos, 2) == "\\(") { 5009 result.push(new Match(str.substring(matchStart, pos + 2), matchStart + match.index, regexInfo.css)); 5010 level++; 5011 pos += 2; 5012 } else { 5013 pos++; 5014 } 5015 } else { 5016 if (str[pos] == "(") { 5017 level++; 5018 } 5019 if (str[pos] == ")") { 5020 level--; 5021 if (level == 0) { 5022 matchStart = pos; 5023 } 5024 } 5025 pos++; 5026 } 5027 } 5028 if (level == 0) { 5029 result.push(new Match(str.substring(matchStart, str.length), matchStart + match.index, regexInfo.css)); 5030 } 5031 5032 return result; 5033 }; 5034 5035 // "Swift-native types" are all the protocols, classes, structs, enums, funcs, vars, and typealiases built into the language 5036 var swiftTypes = 'AbsoluteValuable Any AnyClass Array ArrayBound ArrayBuffer ArrayBufferType ArrayLiteralConvert
5036ible ArrayType AutoreleasingUnsafePointer BidirectionalIndex Bit BitwiseOperations Bool C CBool CChar CChar16 CChar32 CConstPointer CConstVoidPointer CDouble CFloat CInt CLong CLongLong CMutablePointer CMutableVoidPointer COpaquePointer CShort CSignedChar CString CUnsignedChar CUnsignedInt CUnsignedLong CUnsignedLongLong CUnsignedShort CVaListPointer CVarArg CWideChar Character CharacterLiteralConvertible Collection CollectionOfOne Comparable ContiguousArray ContiguousArrayBuffer DebugPrintable Dictionary DictionaryGenerator DictionaryIndex DictionaryLiteralConvertible Double EmptyCollection EmptyGenerator EnumerateGenerator Equatable ExtendedGraphemeClusterLiteralConvertible ExtendedGraphemeClusterType ExtensibleCollection FilterCollectionView FilterCollectionViewIndex FilterGenerator FilterSequenceView Float Float32 Float64 Float80 FloatLiteralConvertible FloatLiteralType FloatingPointClassification FloatingPointNumber ForwardIndex Generator GeneratorOf GeneratorOfOne GeneratorSequence Hashable HeapBuffer HeapBufferStorage HeapBufferStorageBase ImplicitlyUnwrappedOptional IndexingGenerator Int Int16 Int32 Int64 Int8 IntEncoder IntMax Integer IntegerArithmetic IntegerLiteralConvertible IntegerLiteralType Less LifetimeManager LogicValue MapCollectionView MapSequenceGenerator MapSequenceView MaxBuiltinFloatType MaxBuiltinIntegerType Mirror MirrorDisposition MutableCollection MutableSliceable ObjectIdentifier OnHeap Optional OutputStream PermutationGenerator Printable QuickLookObject RandomAccessIndex Range RangeGenerator RawByte RawOptionSet RawRepresentable Reflectable Repeat ReverseIndex ReverseRange ReverseRangeGenerator Rever
5036seView Sequence SequenceOf SignedInteger SignedNumber Sink SinkOf Slice SliceBuffer Sliceable StaticString Streamable StridedRangeGenerator String StringElement StringInterpolationConvertible StringLiteralConvertible StringLiteralType UInt UInt16 UInt32 UInt64 UInt8 UIntMax UTF16 UTF32 UTF8 UWord UnicodeCodec UnicodeScalar Unmanaged UnsafeArray UnsafePointer UnsignedInteger Void Word Zip2 ZipGenerator2 abs advance alignof alignofValue assert bridgeFromObjectiveC bridgeFromObjectiveCUnconditional bridgeToObjectiveC bridgeToObjectiveCUnconditional c contains count countElements countLeadingZeros debugPrint debugPrintln distance dropFirst dropLast dump encodeBitsAsWords enumerate equal false filter find getBridgedObjectiveCType getVaList indices insertionSort isBridgedToObjectiveC isBridgedVerbatimToObjectiveC isUniquelyReferenced join lexicographicalCompare map max maxElement min minElement nil numericCast partition posix print println quickSort reduce reflect reinterpretCast reverse roundUpToAlignment sizeof sizeofValue sort split startsWith strideof strideofValue swap swift toString transcode true underestimateCount unsafeReflect withExtendedLifetime withObjectAtPlusZero withUnsafePointer withUnsafePointerToObject withUnsafePointers withVaList'; 5037 5038 var keywords = 'as break case class continue default deinit do dynamicType else enum ' + 'extension fallthrough for func if import in init is let new protocol ' + 'return self Self static struct subscript super switch Type typealias ' + 'var where while __COLUMN__ __FILE__ __FUNCTION__ __LINE__ associativity ' + 'didSet get infix inout left mutating none nonmutating operator override ' + 'postfix precedence prefix right set unowned unowned(safe) unowned(unsafe) weak willSet'; 5039 5040 var attributes = 'assignment class_protocol exported final lazy noreturn NSCopying NSManaged objc optional required auto_closure noreturn IBAction IBDesignable IBInspectable IBOutlet infix prefix postfix'; 5041 5042 this.regexList = [ 5043 // html entities 5044 { 5045 regex: new RegExp('\&[a-z]+;', 'gi'), 5046 css: 'plain' 5047 }, { 5048 regex: regexLib.singleLineCComments, 5049 css: 'comments' 5050 }, { 5051 regex: new RegExp('\\/\\*[\\s\\S]*\\*\\/', 'g'), 5052 css: 'comments', 5053 func: multiLineCCommentsAdd 5054 }, { 5055 regex: regexLib.doubleQuotedString, 5056 css: 'string', 5057 func: stringAdd 5058 }, { 5059 regex: new RegExp('\\b([\\d_]+(\\.[\\de_]+)?|0x[a-f0-9_]+(\\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b', 'gi'), 5060 css: 'value' 5061 }, { 5062 regex: new RegExp(this.getKeywords(keywords), 'gm'), 5063 css: 'keyword' 5064 }, { 5065 regex: new RegExp(getKeywordsPrependedBy(attributes, '@'), 'gm'), 5066 css: 'color1' 5067 }, { 5068 regex: new RegExp(this.getKeywords(swiftTypes), 'gm'), 5069 css: 'color2' 5070 }, { 5071 regex: new RegExp('\\b([a-zA-Z_][a-zA-Z0-9_]*)\\b', 'gi'), 5072 css: 'variable' 5073 }]; 5074 }; 5075 5076 Brush.prototype = new BrushBase(); 5077 Brush.aliases = ['swift']; 5078 module.exports = Brush; 5079 5080/***/ }, 5081/* 48 */ 5082/***/ function(module, exports, __webpack_require__) { 5083 5084 'use strict'; 5085 5086 var BrushBase = __webpack_require__(22); 5087 var regexLib = __webpack_require__(3).commonRegExp; 5088 5089 function Brush() { 5090 // Contributed by Chad Granum 5091 this.regexList = [{ 5092 regex: new RegExp('^1..\\d+', 'gm'), 5093 css: 'plain bold italic' 5094 }, { 5095 regex: new RegExp('^ok( \\d+)?', 'gm'), 5096 css: 'keyword' 5097 }, { 5098 regex: new RegExp('^not ok( \\d+)?', 'gm'), 5099 css: 'color3 bold' 5100 }, { 5101 regex: new RegExp('(?!^\\s*)#.*$', 'gm'), 5102 css: 'variable bold' 5103 }, { 5104 regex: new RegExp('^#.*$', 'gm'), 5105 css: 'comments bold' 5106 }, { 5107 regex: new RegExp('^(?!(not )?ok)[^1].*$', 'gm'), 5108 css: 'comments' 5109 }, { 5110 regex: regexLib.doubleQuotedString, 5111 css: 'string' 5112 }, { 5113 regex: regexLib.singleQuotedString, 5114 css: 'string' 5115 }]; 5116 } 5117 5118 Brush.prototype = new BrushBase(); 5119 Brush.aliases = ['tap', 'Tap', 'TAP']; 5120 module.exports = Brush; 5121 5122/***/ }, 5123/* 49 */ 5124/***/ function(module, exports, __webpack_require__) { 5125 5126 'use strict'; 5127 5128 var BrushBase = __webpack_require__(22); 5129 var regexLib = __webpack_require__(3).commonRegExp; 5130 5131 function Brush() { 5132 var keywords = 'break case catch class continue ' + 'default delete do else enum export extends false ' + 'for function if implements import in instanceof ' + 'interface let new null package private protected ' + 'static return super switch ' + 'this throw true try typeof var while with yield' + ' any bool declare get module number public set string'; // TypeScript-specific, everything above is common with JavaScript 5133 5134 this.regexList = [{ 5135 regex: regexLib.multiLineDoubleQuotedString, 5136 css: 'string' 5137 }, { 5138 regex: regexLib.multiLineSingleQuotedString, 5139 css: 'string' 5140 }, { 5141 regex: regexLib.singleLineCComments, 5142 css: 'comments' 5143 }, { 5144 regex: regexLib.multiLineCComments, 5145 css: 'comments' 5146 }, { 5147 regex: new RegExp(this.getKeywords(keywords), 'gm'), 5148 css: 'keyword' 5149 }]; 5150 5151 this.forHtmlScript(regexLib.scriptScriptTags); 5152 }; 5153 5154 Brush.prototype = new BrushBase(); 5155 Brush.aliases = ['ts', 'typescript']; 5156 module.exports = Brush; 5157 5158/***/ }, 5159/* 50 */ 5160/***/ function(module, exports, __webpack_require__) { 5161 5162 'use strict'; 5163 5164 var BrushBase = __webpack_require__(22); 5165 var regexLib = __webpack_require__(3).commonRegExp; 5166 5167 function Brush() { 5168 var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' + 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' + 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' + 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' + 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' + 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' + 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' + 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' + 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' + 'Overloads Overridable Overrides ParamArray Preserve Private Property ' + 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' + 'Return Select Set Shadows Shared Short Single Static Step Stop String ' + 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' + 'Variant When While With WithEvents WriteOnly Xor'; 5169 5170 this.regexList = [{ 5171 regex: /'.*$/gm, 5172 css: 'comments' 5173 }, { 5174 regex: regexLib.doubleQuotedString, 5175 css: 'string' 5176 }, { 5177 regex: /^\s*#.*$/gm, 5178 css: 'preprocessor' 5179 }, { 5180 regex: new RegExp(this.getKeywords(keywords), 'gm'), 5181 css: 'keyword' 5182 }]; 5183
5184 this.forHtmlScript(regexLib.aspScriptTags); 5185 }; 5186 5187 Brush.prototype = new BrushBase(); 5188 Brush.aliases = ['vb', 'vbnet']; 5189 module.exports = Brush; 5190 5191/***/ }, 5192/* 51 */ 5193/***/ function(module, exports, __webpack_require__) { 5194 5195 'use strict'; 5196 5197 var BrushBase = __webpack_require__(22); 5198 var regexLib = __webpack_require__(3).commonRegExp; 5199 var XRegExp = __webpack_require__(3).XRegExp; 5200 var Match = __webpack_require__(5).Match; 5201 5202 function Brush() { 5203 function process(match, regexInfo) { 5204 var code = match[0], 5205 tag = XRegExp.exec(code, XRegExp('(<|<)[\\s\\/\\?!]*(?<name>[:\\w-\\.]+)', 'xg')), 5206 result = []; 5207 5208 if (match.attributes != null) { 5209 var attributes, 5210 pos = 0, 5211 regex = XRegExp('(?<name> [\\w:.-]+)' + '\\s*=\\s*' + '(?<value> ".*?"|\'.*?\'|\\w+)', 'xg'); 5212 5213 while ((attributes = XRegExp.exec(code, regex, pos)) != null) { 5214 result.push(new Match(attributes.name, match.index + attributes.index, 'color1')); 5215 result.push(new Match(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); 5216 pos = attributes.index + attributes[0].length; 5217 } 5218 } 5219 5220 if (tag != null) result.push(new Match(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword')); 5221 5222 return result; 5223 } 5224 5225 this.regexList = [{ 5226 regex: XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), 5227 css: 'color2' 5228 }, { 5229 regex: regexLib.xmlComments, 5230 css: 'comments' 5231 }, { 5232 regex: XRegExp('(<|<)[\\s\\/\\?!]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), 5233 func: process 5234 }]; 5235 }; 5236 5237 Brush.prototype = new BrushBase(); 5238 Brush.aliases = ['xml', 'xhtml', 'xslt', 'html', 'plist']; 5239 module.exports = Brush; 5240 5241/***/ }, 5242/* 52 */ 5243/***/ function(module, exports, __webpack_require__) { 5244 5245 'use strict'; 5246 5247 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; 5248 5249 /*! 5250 * domready (c) Dustin Diaz 2014 - License MIT 5251 */ 5252 !function (name, definition) { 5253 5254 if (true) module.exports = definition();else if (typeof define == 'function' && _typeof(define.amd) == 'object') define(definition);else this[name] = definition(); 5255 }('domready', function () { 5256 5257 var fns = [], 5258 _listener, 5259 doc = document, 5260 hack = doc.documentElement.doScroll, 5261 domContentLoaded = 'DOMContentLoaded', 5262 loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState); 5263 5264 if (!loaded) doc.addEventListener(domContentLoaded, _listener = function listener() { 5265 doc.removeEventListener(domContentLoaded, _listener); 5266 loaded = 1; 5267 while (_listener = fns.shift()) { 5268 _listener(); 5269 } 5270 }); 5271 5272 return function (fn) { 5273 loaded ? setTimeout(fn, 0) : fns.push(fn); 5274 }; 5275 }); 5276 5277/***/ }, 5278/* 53 */ 5279/***/ function(module, exports) { 5280 5281 'use strict'; 5282 5283 Object.defineProperty(exports, "__esModule", { 5284 value: true 5285 }); 5286 var string = exports.string = function string(value) { 5287 return value.replace(/^([A-Z])/g, function (_, character) { 5288 return character.toLowerCase(); 5289 }).replace(/([A-Z])/g, function (_, character) { 5290 return '-' + character.toLowerCase(); 5291 }); 5292 }; 5293 5294 var object = exports.object = function object(value) { 5295 var result = {}; 5296 Object.keys(value).forEach(function (key) { 5297 return result[string(key)] = value[key]; 5298 }); 5299 return result; 5300 }; 5301 5302/***/ } 5303/******/ ]); 5304//# sourceMappingURL=syntaxhighlighter.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.