mirror of https://github.com/abpframework/abp.git
522 changed files with 25187 additions and 41858 deletions
@ -1,59 +1,3 @@ |
|||
$(function(){ |
|||
var fileUploadUri = "/api/cms-kit-admin/media"; |
|||
var fileUriPrefix = "/api/cms-kit/media/" |
|||
|
|||
var editor = $('#content-editor'); |
|||
|
|||
function getUppyHeaders() { |
|||
var headers = {}; |
|||
headers[abp.security.antiForgery.tokenHeaderName] = abp.security.antiForgery.getToken(); |
|||
|
|||
return headers; |
|||
} |
|||
|
|||
var uploadImage = function (blob, callback, source) { |
|||
var UPPY_OPTIONS = { |
|||
endpoint: fileUploadUri, |
|||
formData: true, |
|||
fieldName: "file", |
|||
method: "post", |
|||
headers: getUppyHeaders() |
|||
}; |
|||
|
|||
var UPPY = Uppy.Core().use(Uppy.XHRUpload, UPPY_OPTIONS); |
|||
|
|||
UPPY.reset(); |
|||
|
|||
UPPY.addFile({ |
|||
id: "content-file", |
|||
name: blob.name, |
|||
type: blob.type, |
|||
data: blob, |
|||
}); |
|||
|
|||
UPPY.upload().then((result) => { |
|||
if (result.failed.length > 0) { |
|||
abp.message.error("File upload failed"); |
|||
} else { |
|||
var mediaDto = result.successful[0].response.body; |
|||
var fileUrl = (fileUriPrefix + mediaDto.id); |
|||
|
|||
callback(fileUrl, mediaDto.name); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
new toastui.Editor({ |
|||
el: editor[0], |
|||
usageStatistics: false, |
|||
useCommandShortcut: true, |
|||
initialEditType: 'wysiwyg', |
|||
previewStyle: 'tab', |
|||
height: "25em", |
|||
minHeight: "25em", |
|||
language: abp.localization.currentCulture.cultureName, |
|||
hooks: { |
|||
addImageBlobHook: uploadImage, |
|||
}, |
|||
}); |
|||
}); |
|||
}); |
|||
|
|||
@ -1,5 +1,5 @@ |
|||
{ |
|||
"ConnectionStrings": { |
|||
"Default": "Server=localhost;Database=CmsKit_Unified;Trusted_Connection=True" |
|||
"Default": "Server=(localdb)\\.\\MSSQLLocalDB;Database=CmsKit_Unified;Trusted_Connection=True" |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,973 @@ |
|||
/*! |
|||
* clipboard.js v2.0.6 |
|||
* https://clipboardjs.com/
|
|||
* |
|||
* Licensed MIT © Zeno Rocha |
|||
*/ |
|||
(function webpackUniversalModuleDefinition(root, factory) { |
|||
if(typeof exports === 'object' && typeof module === 'object') |
|||
module.exports = factory(); |
|||
else if(typeof define === 'function' && define.amd) |
|||
define([], factory); |
|||
else if(typeof exports === 'object') |
|||
exports["ClipboardJS"] = factory(); |
|||
else |
|||
root["ClipboardJS"] = factory(); |
|||
})(this, function() { |
|||
return /******/ (function(modules) { // webpackBootstrap
|
|||
/******/ // The module cache
|
|||
/******/ var installedModules = {}; |
|||
/******/ |
|||
/******/ // The require function
|
|||
/******/ function __webpack_require__(moduleId) { |
|||
/******/ |
|||
/******/ // Check if module is in cache
|
|||
/******/ if(installedModules[moduleId]) { |
|||
/******/ return installedModules[moduleId].exports; |
|||
/******/ } |
|||
/******/ // Create a new module (and put it into the cache)
|
|||
/******/ var module = installedModules[moduleId] = { |
|||
/******/ i: moduleId, |
|||
/******/ l: false, |
|||
/******/ exports: {} |
|||
/******/ }; |
|||
/******/ |
|||
/******/ // Execute the module function
|
|||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|||
/******/ |
|||
/******/ // Flag the module as loaded
|
|||
/******/ module.l = true; |
|||
/******/ |
|||
/******/ // Return the exports of the module
|
|||
/******/ return module.exports; |
|||
/******/ } |
|||
/******/ |
|||
/******/ |
|||
/******/ // expose the modules object (__webpack_modules__)
|
|||
/******/ __webpack_require__.m = modules; |
|||
/******/ |
|||
/******/ // expose the module cache
|
|||
/******/ __webpack_require__.c = installedModules; |
|||
/******/ |
|||
/******/ // define getter function for harmony exports
|
|||
/******/ __webpack_require__.d = function(exports, name, getter) { |
|||
/******/ if(!__webpack_require__.o(exports, name)) { |
|||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
|||
/******/ } |
|||
/******/ }; |
|||
/******/ |
|||
/******/ // define __esModule on exports
|
|||
/******/ __webpack_require__.r = function(exports) { |
|||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|||
/******/ } |
|||
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|||
/******/ }; |
|||
/******/ |
|||
/******/ // create a fake namespace object
|
|||
/******/ // mode & 1: value is a module id, require it
|
|||
/******/ // mode & 2: merge all properties of value into the ns
|
|||
/******/ // mode & 4: return value when already ns object
|
|||
/******/ // mode & 8|1: behave like require
|
|||
/******/ __webpack_require__.t = function(value, mode) { |
|||
/******/ if(mode & 1) value = __webpack_require__(value); |
|||
/******/ if(mode & 8) return value; |
|||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|||
/******/ var ns = Object.create(null); |
|||
/******/ __webpack_require__.r(ns); |
|||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|||
/******/ return ns; |
|||
/******/ }; |
|||
/******/ |
|||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|||
/******/ __webpack_require__.n = function(module) { |
|||
/******/ var getter = module && module.__esModule ? |
|||
/******/ function getDefault() { return module['default']; } : |
|||
/******/ function getModuleExports() { return module; }; |
|||
/******/ __webpack_require__.d(getter, 'a', getter); |
|||
/******/ return getter; |
|||
/******/ }; |
|||
/******/ |
|||
/******/ // Object.prototype.hasOwnProperty.call
|
|||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|||
/******/ |
|||
/******/ // __webpack_public_path__
|
|||
/******/ __webpack_require__.p = ""; |
|||
/******/ |
|||
/******/ |
|||
/******/ // Load entry module and return exports
|
|||
/******/ return __webpack_require__(__webpack_require__.s = 6); |
|||
/******/ }) |
|||
/************************************************************************/ |
|||
/******/ ([ |
|||
/* 0 */ |
|||
/***/ (function(module, exports) { |
|||
|
|||
function select(element) { |
|||
var selectedText; |
|||
|
|||
if (element.nodeName === 'SELECT') { |
|||
element.focus(); |
|||
|
|||
selectedText = element.value; |
|||
} |
|||
else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { |
|||
var isReadOnly = element.hasAttribute('readonly'); |
|||
|
|||
if (!isReadOnly) { |
|||
element.setAttribute('readonly', ''); |
|||
} |
|||
|
|||
element.select(); |
|||
element.setSelectionRange(0, element.value.length); |
|||
|
|||
if (!isReadOnly) { |
|||
element.removeAttribute('readonly'); |
|||
} |
|||
|
|||
selectedText = element.value; |
|||
} |
|||
else { |
|||
if (element.hasAttribute('contenteditable')) { |
|||
element.focus(); |
|||
} |
|||
|
|||
var selection = window.getSelection(); |
|||
var range = document.createRange(); |
|||
|
|||
range.selectNodeContents(element); |
|||
selection.removeAllRanges(); |
|||
selection.addRange(range); |
|||
|
|||
selectedText = selection.toString(); |
|||
} |
|||
|
|||
return selectedText; |
|||
} |
|||
|
|||
module.exports = select; |
|||
|
|||
|
|||
/***/ }), |
|||
/* 1 */ |
|||
/***/ (function(module, exports) { |
|||
|
|||
function E () { |
|||
// Keep this empty so it's easier to inherit from
|
|||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
|||
} |
|||
|
|||
E.prototype = { |
|||
on: function (name, callback, ctx) { |
|||
var e = this.e || (this.e = {}); |
|||
|
|||
(e[name] || (e[name] = [])).push({ |
|||
fn: callback, |
|||
ctx: ctx |
|||
}); |
|||
|
|||
return this; |
|||
}, |
|||
|
|||
once: function (name, callback, ctx) { |
|||
var self = this; |
|||
function listener () { |
|||
self.off(name, listener); |
|||
callback.apply(ctx, arguments); |
|||
}; |
|||
|
|||
listener._ = callback |
|||
return this.on(name, listener, ctx); |
|||
}, |
|||
|
|||
emit: function (name) { |
|||
var data = [].slice.call(arguments, 1); |
|||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); |
|||
var i = 0; |
|||
var len = evtArr.length; |
|||
|
|||
for (i; i < len; i++) { |
|||
evtArr[i].fn.apply(evtArr[i].ctx, data); |
|||
} |
|||
|
|||
return this; |
|||
}, |
|||
|
|||
off: function (name, callback) { |
|||
var e = this.e || (this.e = {}); |
|||
var evts = e[name]; |
|||
var liveEvents = []; |
|||
|
|||
if (evts && callback) { |
|||
for (var i = 0, len = evts.length; i < len; i++) { |
|||
if (evts[i].fn !== callback && evts[i].fn._ !== callback) |
|||
liveEvents.push(evts[i]); |
|||
} |
|||
} |
|||
|
|||
// Remove event from queue to prevent memory leak
|
|||
// Suggested by https://github.com/lazd
|
|||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
|||
|
|||
(liveEvents.length) |
|||
? e[name] = liveEvents |
|||
: delete e[name]; |
|||
|
|||
return this; |
|||
} |
|||
}; |
|||
|
|||
module.exports = E; |
|||
module.exports.TinyEmitter = E; |
|||
|
|||
|
|||
/***/ }), |
|||
/* 2 */ |
|||
/***/ (function(module, exports, __webpack_require__) { |
|||
|
|||
var is = __webpack_require__(3); |
|||
var delegate = __webpack_require__(4); |
|||
|
|||
/** |
|||
* Validates all params and calls the right |
|||
* listener function based on its target type. |
|||
* |
|||
* @param {String|HTMLElement|HTMLCollection|NodeList} target |
|||
* @param {String} type |
|||
* @param {Function} callback |
|||
* @return {Object} |
|||
*/ |
|||
function listen(target, type, callback) { |
|||
if (!target && !type && !callback) { |
|||
throw new Error('Missing required arguments'); |
|||
} |
|||
|
|||
if (!is.string(type)) { |
|||
throw new TypeError('Second argument must be a String'); |
|||
} |
|||
|
|||
if (!is.fn(callback)) { |
|||
throw new TypeError('Third argument must be a Function'); |
|||
} |
|||
|
|||
if (is.node(target)) { |
|||
return listenNode(target, type, callback); |
|||
} |
|||
else if (is.nodeList(target)) { |
|||
return listenNodeList(target, type, callback); |
|||
} |
|||
else if (is.string(target)) { |
|||
return listenSelector(target, type, callback); |
|||
} |
|||
else { |
|||
throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Adds an event listener to a HTML element |
|||
* and returns a remove listener function. |
|||
* |
|||
* @param {HTMLElement} node |
|||
* @param {String} type |
|||
* @param {Function} callback |
|||
* @return {Object} |
|||
*/ |
|||
function listenNode(node, type, callback) { |
|||
node.addEventListener(type, callback); |
|||
|
|||
return { |
|||
destroy: function() { |
|||
node.removeEventListener(type, callback); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Add an event listener to a list of HTML elements |
|||
* and returns a remove listener function. |
|||
* |
|||
* @param {NodeList|HTMLCollection} nodeList |
|||
* @param {String} type |
|||
* @param {Function} callback |
|||
* @return {Object} |
|||
*/ |
|||
function listenNodeList(nodeList, type, callback) { |
|||
Array.prototype.forEach.call(nodeList, function(node) { |
|||
node.addEventListener(type, callback); |
|||
}); |
|||
|
|||
return { |
|||
destroy: function() { |
|||
Array.prototype.forEach.call(nodeList, function(node) { |
|||
node.removeEventListener(type, callback); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Add an event listener to a selector |
|||
* and returns a remove listener function. |
|||
* |
|||
* @param {String} selector |
|||
* @param {String} type |
|||
* @param {Function} callback |
|||
* @return {Object} |
|||
*/ |
|||
function listenSelector(selector, type, callback) { |
|||
return delegate(document.body, selector, type, callback); |
|||
} |
|||
|
|||
module.exports = listen; |
|||
|
|||
|
|||
/***/ }), |
|||
/* 3 */ |
|||
/***/ (function(module, exports) { |
|||
|
|||
/** |
|||
* Check if argument is a HTML element. |
|||
* |
|||
* @param {Object} value |
|||
* @return {Boolean} |
|||
*/ |
|||
exports.node = function(value) { |
|||
return value !== undefined |
|||
&& value instanceof HTMLElement |
|||
&& value.nodeType === 1; |
|||
}; |
|||
|
|||
/** |
|||
* Check if argument is a list of HTML elements. |
|||
* |
|||
* @param {Object} value |
|||
* @return {Boolean} |
|||
*/ |
|||
exports.nodeList = function(value) { |
|||
var type = Object.prototype.toString.call(value); |
|||
|
|||
return value !== undefined |
|||
&& (type === '[object NodeList]' || type === '[object HTMLCollection]') |
|||
&& ('length' in value) |
|||
&& (value.length === 0 || exports.node(value[0])); |
|||
}; |
|||
|
|||
/** |
|||
* Check if argument is a string. |
|||
* |
|||
* @param {Object} value |
|||
* @return {Boolean} |
|||
*/ |
|||
exports.string = function(value) { |
|||
return typeof value === 'string' |
|||
|| value instanceof String; |
|||
}; |
|||
|
|||
/** |
|||
* Check if argument is a function. |
|||
* |
|||
* @param {Object} value |
|||
* @return {Boolean} |
|||
*/ |
|||
exports.fn = function(value) { |
|||
var type = Object.prototype.toString.call(value); |
|||
|
|||
return type === '[object Function]'; |
|||
}; |
|||
|
|||
|
|||
/***/ }), |
|||
/* 4 */ |
|||
/***/ (function(module, exports, __webpack_require__) { |
|||
|
|||
var closest = __webpack_require__(5); |
|||
|
|||
/** |
|||
* Delegates event to a selector. |
|||
* |
|||
* @param {Element} element |
|||
* @param {String} selector |
|||
* @param {String} type |
|||
* @param {Function} callback |
|||
* @param {Boolean} useCapture |
|||
* @return {Object} |
|||
*/ |
|||
function _delegate(element, selector, type, callback, useCapture) { |
|||
var listenerFn = listener.apply(this, arguments); |
|||
|
|||
element.addEventListener(type, listenerFn, useCapture); |
|||
|
|||
return { |
|||
destroy: function() { |
|||
element.removeEventListener(type, listenerFn, useCapture); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Delegates event to a selector. |
|||
* |
|||
* @param {Element|String|Array} [elements] |
|||
* @param {String} selector |
|||
* @param {String} type |
|||
* @param {Function} callback |
|||
* @param {Boolean} useCapture |
|||
* @return {Object} |
|||
*/ |
|||
function delegate(elements, selector, type, callback, useCapture) { |
|||
// Handle the regular Element usage
|
|||
if (typeof elements.addEventListener === 'function') { |
|||
return _delegate.apply(null, arguments); |
|||
} |
|||
|
|||
// Handle Element-less usage, it defaults to global delegation
|
|||
if (typeof type === 'function') { |
|||
// Use `document` as the first parameter, then apply arguments
|
|||
// This is a short way to .unshift `arguments` without running into deoptimizations
|
|||
return _delegate.bind(null, document).apply(null, arguments); |
|||
} |
|||
|
|||
// Handle Selector-based usage
|
|||
if (typeof elements === 'string') { |
|||
elements = document.querySelectorAll(elements); |
|||
} |
|||
|
|||
// Handle Array-like based usage
|
|||
return Array.prototype.map.call(elements, function (element) { |
|||
return _delegate(element, selector, type, callback, useCapture); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Finds closest match and invokes callback. |
|||
* |
|||
* @param {Element} element |
|||
* @param {String} selector |
|||
* @param {String} type |
|||
* @param {Function} callback |
|||
* @return {Function} |
|||
*/ |
|||
function listener(element, selector, type, callback) { |
|||
return function(e) { |
|||
e.delegateTarget = closest(e.target, selector); |
|||
|
|||
if (e.delegateTarget) { |
|||
callback.call(element, e); |
|||
} |
|||
} |
|||
} |
|||
|
|||
module.exports = delegate; |
|||
|
|||
|
|||
/***/ }), |
|||
/* 5 */ |
|||
/***/ (function(module, exports) { |
|||
|
|||
var DOCUMENT_NODE_TYPE = 9; |
|||
|
|||
/** |
|||
* A polyfill for Element.matches() |
|||
*/ |
|||
if (typeof Element !== 'undefined' && !Element.prototype.matches) { |
|||
var proto = Element.prototype; |
|||
|
|||
proto.matches = proto.matchesSelector || |
|||
proto.mozMatchesSelector || |
|||
proto.msMatchesSelector || |
|||
proto.oMatchesSelector || |
|||
proto.webkitMatchesSelector; |
|||
} |
|||
|
|||
/** |
|||
* Finds the closest parent that matches a selector. |
|||
* |
|||
* @param {Element} element |
|||
* @param {String} selector |
|||
* @return {Function} |
|||
*/ |
|||
function closest (element, selector) { |
|||
while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { |
|||
if (typeof element.matches === 'function' && |
|||
element.matches(selector)) { |
|||
return element; |
|||
} |
|||
element = element.parentNode; |
|||
} |
|||
} |
|||
|
|||
module.exports = closest; |
|||
|
|||
|
|||
/***/ }), |
|||
/* 6 */ |
|||
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|||
|
|||
"use strict"; |
|||
__webpack_require__.r(__webpack_exports__); |
|||
|
|||
// EXTERNAL MODULE: ./node_modules/select/src/select.js
|
|||
var src_select = __webpack_require__(0); |
|||
var select_default = /*#__PURE__*/__webpack_require__.n(src_select); |
|||
|
|||
// CONCATENATED MODULE: ./src/clipboard-action.js
|
|||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
|||
|
|||
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; }; }(); |
|||
|
|||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|||
|
|||
|
|||
|
|||
/** |
|||
* Inner class which performs selection from either `text` or `target` |
|||
* properties and then executes copy or cut operations. |
|||
*/ |
|||
|
|||
var clipboard_action_ClipboardAction = function () { |
|||
/** |
|||
* @param {Object} options |
|||
*/ |
|||
function ClipboardAction(options) { |
|||
_classCallCheck(this, ClipboardAction); |
|||
|
|||
this.resolveOptions(options); |
|||
this.initSelection(); |
|||
} |
|||
|
|||
/** |
|||
* Defines base properties passed from constructor. |
|||
* @param {Object} options |
|||
*/ |
|||
|
|||
|
|||
_createClass(ClipboardAction, [{ |
|||
key: 'resolveOptions', |
|||
value: function resolveOptions() { |
|||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|||
|
|||
this.action = options.action; |
|||
this.container = options.container; |
|||
this.emitter = options.emitter; |
|||
this.target = options.target; |
|||
this.text = options.text; |
|||
this.trigger = options.trigger; |
|||
|
|||
this.selectedText = ''; |
|||
} |
|||
|
|||
/** |
|||
* Decides which selection strategy is going to be applied based |
|||
* on the existence of `text` and `target` properties. |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'initSelection', |
|||
value: function initSelection() { |
|||
if (this.text) { |
|||
this.selectFake(); |
|||
} else if (this.target) { |
|||
this.selectTarget(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Creates a fake textarea element, sets its value from `text` property, |
|||
* and makes a selection on it. |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'selectFake', |
|||
value: function selectFake() { |
|||
var _this = this; |
|||
|
|||
var isRTL = document.documentElement.getAttribute('dir') == 'rtl'; |
|||
|
|||
this.removeFake(); |
|||
|
|||
this.fakeHandlerCallback = function () { |
|||
return _this.removeFake(); |
|||
}; |
|||
this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true; |
|||
|
|||
this.fakeElem = document.createElement('textarea'); |
|||
// Prevent zooming on iOS
|
|||
this.fakeElem.style.fontSize = '12pt'; |
|||
// Reset box model
|
|||
this.fakeElem.style.border = '0'; |
|||
this.fakeElem.style.padding = '0'; |
|||
this.fakeElem.style.margin = '0'; |
|||
// Move element out of screen horizontally
|
|||
this.fakeElem.style.position = 'absolute'; |
|||
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; |
|||
// Move element to the same position vertically
|
|||
var yPosition = window.pageYOffset || document.documentElement.scrollTop; |
|||
this.fakeElem.style.top = yPosition + 'px'; |
|||
|
|||
this.fakeElem.setAttribute('readonly', ''); |
|||
this.fakeElem.value = this.text; |
|||
|
|||
this.container.appendChild(this.fakeElem); |
|||
|
|||
this.selectedText = select_default()(this.fakeElem); |
|||
this.copyText(); |
|||
} |
|||
|
|||
/** |
|||
* Only removes the fake element after another click event, that way |
|||
* a user can hit `Ctrl+C` to copy because selection still exists. |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'removeFake', |
|||
value: function removeFake() { |
|||
if (this.fakeHandler) { |
|||
this.container.removeEventListener('click', this.fakeHandlerCallback); |
|||
this.fakeHandler = null; |
|||
this.fakeHandlerCallback = null; |
|||
} |
|||
|
|||
if (this.fakeElem) { |
|||
this.container.removeChild(this.fakeElem); |
|||
this.fakeElem = null; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Selects the content from element passed on `target` property. |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'selectTarget', |
|||
value: function selectTarget() { |
|||
this.selectedText = select_default()(this.target); |
|||
this.copyText(); |
|||
} |
|||
|
|||
/** |
|||
* Executes the copy operation based on the current selection. |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'copyText', |
|||
value: function copyText() { |
|||
var succeeded = void 0; |
|||
|
|||
try { |
|||
succeeded = document.execCommand(this.action); |
|||
} catch (err) { |
|||
succeeded = false; |
|||
} |
|||
|
|||
this.handleResult(succeeded); |
|||
} |
|||
|
|||
/** |
|||
* Fires an event based on the copy operation result. |
|||
* @param {Boolean} succeeded |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'handleResult', |
|||
value: function handleResult(succeeded) { |
|||
this.emitter.emit(succeeded ? 'success' : 'error', { |
|||
action: this.action, |
|||
text: this.selectedText, |
|||
trigger: this.trigger, |
|||
clearSelection: this.clearSelection.bind(this) |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Moves focus away from `target` and back to the trigger, removes current selection. |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'clearSelection', |
|||
value: function clearSelection() { |
|||
if (this.trigger) { |
|||
this.trigger.focus(); |
|||
} |
|||
document.activeElement.blur(); |
|||
window.getSelection().removeAllRanges(); |
|||
} |
|||
|
|||
/** |
|||
* Sets the `action` to be performed which can be either 'copy' or 'cut'. |
|||
* @param {String} action |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'destroy', |
|||
|
|||
|
|||
/** |
|||
* Destroy lifecycle. |
|||
*/ |
|||
value: function destroy() { |
|||
this.removeFake(); |
|||
} |
|||
}, { |
|||
key: 'action', |
|||
set: function set() { |
|||
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy'; |
|||
|
|||
this._action = action; |
|||
|
|||
if (this._action !== 'copy' && this._action !== 'cut') { |
|||
throw new Error('Invalid "action" value, use either "copy" or "cut"'); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Gets the `action` property. |
|||
* @return {String} |
|||
*/ |
|||
, |
|||
get: function get() { |
|||
return this._action; |
|||
} |
|||
|
|||
/** |
|||
* Sets the `target` property using an element |
|||
* that will be have its content copied. |
|||
* @param {Element} target |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'target', |
|||
set: function set(target) { |
|||
if (target !== undefined) { |
|||
if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) { |
|||
if (this.action === 'copy' && target.hasAttribute('disabled')) { |
|||
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); |
|||
} |
|||
|
|||
if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { |
|||
throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); |
|||
} |
|||
|
|||
this._target = target; |
|||
} else { |
|||
throw new Error('Invalid "target" value, use a valid Element'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Gets the `target` property. |
|||
* @return {String|HTMLElement} |
|||
*/ |
|||
, |
|||
get: function get() { |
|||
return this._target; |
|||
} |
|||
}]); |
|||
|
|||
return ClipboardAction; |
|||
}(); |
|||
|
|||
/* harmony default export */ var clipboard_action = (clipboard_action_ClipboardAction); |
|||
// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
|
|||
var tiny_emitter = __webpack_require__(1); |
|||
var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter); |
|||
|
|||
// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
|
|||
var listen = __webpack_require__(2); |
|||
var listen_default = /*#__PURE__*/__webpack_require__.n(listen); |
|||
|
|||
// CONCATENATED MODULE: ./src/clipboard.js
|
|||
var clipboard_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; |
|||
|
|||
var clipboard_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; }; }(); |
|||
|
|||
function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
|||
|
|||
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; } |
|||
|
|||
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, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* Base class which takes one or more elements, adds event listeners to them, |
|||
* and instantiates a new `ClipboardAction` on each click. |
|||
*/ |
|||
|
|||
var clipboard_Clipboard = function (_Emitter) { |
|||
_inherits(Clipboard, _Emitter); |
|||
|
|||
/** |
|||
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger |
|||
* @param {Object} options |
|||
*/ |
|||
function Clipboard(trigger, options) { |
|||
clipboard_classCallCheck(this, Clipboard); |
|||
|
|||
var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this)); |
|||
|
|||
_this.resolveOptions(options); |
|||
_this.listenClick(trigger); |
|||
return _this; |
|||
} |
|||
|
|||
/** |
|||
* Defines if attributes would be resolved using internal setter functions |
|||
* or custom functions that were passed in the constructor. |
|||
* @param {Object} options |
|||
*/ |
|||
|
|||
|
|||
clipboard_createClass(Clipboard, [{ |
|||
key: 'resolveOptions', |
|||
value: function resolveOptions() { |
|||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|||
|
|||
this.action = typeof options.action === 'function' ? options.action : this.defaultAction; |
|||
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; |
|||
this.text = typeof options.text === 'function' ? options.text : this.defaultText; |
|||
this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; |
|||
} |
|||
|
|||
/** |
|||
* Adds a click event listener to the passed trigger. |
|||
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'listenClick', |
|||
value: function listenClick(trigger) { |
|||
var _this2 = this; |
|||
|
|||
this.listener = listen_default()(trigger, 'click', function (e) { |
|||
return _this2.onClick(e); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Defines a new `ClipboardAction` on each click event. |
|||
* @param {Event} e |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'onClick', |
|||
value: function onClick(e) { |
|||
var trigger = e.delegateTarget || e.currentTarget; |
|||
|
|||
if (this.clipboardAction) { |
|||
this.clipboardAction = null; |
|||
} |
|||
|
|||
this.clipboardAction = new clipboard_action({ |
|||
action: this.action(trigger), |
|||
target: this.target(trigger), |
|||
text: this.text(trigger), |
|||
container: this.container, |
|||
trigger: trigger, |
|||
emitter: this |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Default `action` lookup function. |
|||
* @param {Element} trigger |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'defaultAction', |
|||
value: function defaultAction(trigger) { |
|||
return getAttributeValue('action', trigger); |
|||
} |
|||
|
|||
/** |
|||
* Default `target` lookup function. |
|||
* @param {Element} trigger |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'defaultTarget', |
|||
value: function defaultTarget(trigger) { |
|||
var selector = getAttributeValue('target', trigger); |
|||
|
|||
if (selector) { |
|||
return document.querySelector(selector); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Returns the support of the given action, or all actions if no action is |
|||
* given. |
|||
* @param {String} [action] |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'defaultText', |
|||
|
|||
|
|||
/** |
|||
* Default `text` lookup function. |
|||
* @param {Element} trigger |
|||
*/ |
|||
value: function defaultText(trigger) { |
|||
return getAttributeValue('text', trigger); |
|||
} |
|||
|
|||
/** |
|||
* Destroy lifecycle. |
|||
*/ |
|||
|
|||
}, { |
|||
key: 'destroy', |
|||
value: function destroy() { |
|||
this.listener.destroy(); |
|||
|
|||
if (this.clipboardAction) { |
|||
this.clipboardAction.destroy(); |
|||
this.clipboardAction = null; |
|||
} |
|||
} |
|||
}], [{ |
|||
key: 'isSupported', |
|||
value: function isSupported() { |
|||
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; |
|||
|
|||
var actions = typeof action === 'string' ? [action] : action; |
|||
var support = !!document.queryCommandSupported; |
|||
|
|||
actions.forEach(function (action) { |
|||
support = support && !!document.queryCommandSupported(action); |
|||
}); |
|||
|
|||
return support; |
|||
} |
|||
}]); |
|||
|
|||
return Clipboard; |
|||
}(tiny_emitter_default.a); |
|||
|
|||
/** |
|||
* Helper function to retrieve attribute value. |
|||
* @param {String} suffix |
|||
* @param {Element} element |
|||
*/ |
|||
|
|||
|
|||
function getAttributeValue(suffix, element) { |
|||
var attribute = 'data-clipboard-' + suffix; |
|||
|
|||
if (!element.hasAttribute(attribute)) { |
|||
return; |
|||
} |
|||
|
|||
return element.getAttribute(attribute); |
|||
} |
|||
|
|||
/* harmony default export */ var clipboard = __webpack_exports__["default"] = (clipboard_Clipboard); |
|||
|
|||
/***/ }) |
|||
/******/ ])["default"]; |
|||
}); |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
@ -0,0 +1,31 @@ |
|||
# [Prism](https://prismjs.com/) |
|||
|
|||
[](https://travis-ci.org/PrismJS/prism) |
|||
[](https://www.npmjs.com/package/prismjs) |
|||
|
|||
Prism is a lightweight, robust, elegant syntax highlighting library. It's a spin-off project from [Dabblet](https://dabblet.com/). |
|||
|
|||
You can learn more on [prismjs.com](https://prismjs.com/). |
|||
|
|||
[Why another syntax highlighter?](https://lea.verou.me/2012/07/introducing-prism-an-awesome-new-syntax-highlighter/#more-1841) |
|||
|
|||
[More themes for Prism!](https://github.com/PrismJS/prism-themes) |
|||
|
|||
## Contribute to Prism! |
|||
|
|||
Prism depends on community contributions to expand and cover a wider array of use cases. If you like it, considering giving back by sending a pull request. Here are a few tips: |
|||
|
|||
- Read the [documentation](https://prismjs.com/extending.html). Prism was designed to be extensible. |
|||
- Do not edit `prism.js`, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in the `components/` folder. The minified files are also generated automatically. |
|||
- The build system uses [gulp](https://github.com/gulpjs/gulp) to minify the files and build `prism.js`. Having gulp installed, you just need to run the command `gulp`. |
|||
- Please follow the code conventions used in the files already. For example, I use [tabs for indentation and spaces for alignment](http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/). Opening braces are on the same line, closing braces on their own line regardless of construct. There is a space before the opening brace. etc etc. |
|||
- Please try to err towards more smaller PRs rather than few huge PRs. If a PR includes changes I want to merge and changes I don't, handling it becomes difficult. |
|||
- My time is very limited these days, so it might take a long time to review longer PRs (short ones are usually merged very quickly), especially those modifying the Prism Core. This doesn't mean your PR is rejected. |
|||
- If you contribute a new language definition, you will be responsible for handling bug reports about that language definition. |
|||
- If you add a new language definition, theme or plugin, you need to add it to `components.json` as well and rebuild Prism by running `gulp`, so that it becomes available to the download build page. For new languages, please also add a few [tests](https://prismjs.com/test-suite.html) and an example in the `examples/` folder. |
|||
|
|||
Thank you so much for contributing!! |
|||
|
|||
## Translations |
|||
|
|||
* [](https://www.awesomes.cn/repo/PrismJS/prism) |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
@ -0,0 +1,56 @@ |
|||
const components = require('../components.js'); |
|||
const getLoader = require('../dependencies'); |
|||
|
|||
|
|||
/** |
|||
* The set of all languages which have been loaded using the below function. |
|||
* |
|||
* @type {Set<string>} |
|||
*/ |
|||
const loadedLanguages = new Set(); |
|||
|
|||
/** |
|||
* Loads the given languages and adds them to the current Prism instance. |
|||
* |
|||
* If no languages are provided, __all__ Prism languages will be loaded. |
|||
* |
|||
* @param {string|string[]} [languages] |
|||
* @returns {void} |
|||
*/ |
|||
function loadLanguages(languages) { |
|||
if (languages === undefined) { |
|||
languages = Object.keys(components.languages).filter(l => l != 'meta'); |
|||
} else if (!Array.isArray(languages)) { |
|||
languages = [languages]; |
|||
} |
|||
|
|||
// the user might have loaded languages via some other way or used `prism.js` which already includes some
|
|||
// we don't need to validate the ids because `getLoader` will ignore invalid ones
|
|||
const loaded = [...loadedLanguages, ...Object.keys(Prism.languages)]; |
|||
|
|||
getLoader(components, languages, loaded).load(lang => { |
|||
if (!(lang in components.languages)) { |
|||
if (!loadLanguages.silent) { |
|||
console.warn('Language does not exist: ' + lang); |
|||
} |
|||
return; |
|||
} |
|||
|
|||
const pathToLanguage = './prism-' + lang; |
|||
|
|||
// remove from require cache and from Prism
|
|||
delete require.cache[require.resolve(pathToLanguage)]; |
|||
delete Prism.languages[lang]; |
|||
|
|||
require(pathToLanguage); |
|||
|
|||
loadedLanguages.add(lang); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Set this to `true` to prevent all warning messages `loadLanguages` logs. |
|||
*/ |
|||
loadLanguages.silent = false; |
|||
|
|||
module.exports = loadLanguages; |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,54 @@ |
|||
(function (Prism) { |
|||
|
|||
var coreRules = '(?:ALPHA|BIT|CHAR|CR|CRLF|CTL|DIGIT|DQUOTE|HEXDIG|HTAB|LF|LWSP|OCTET|SP|VCHAR|WSP)'; |
|||
|
|||
Prism.languages.abnf = { |
|||
'comment': /;.*/, |
|||
'string': { |
|||
pattern: /(?:%[is])?"[^"\n\r]*"/, |
|||
greedy: true, |
|||
inside: { |
|||
'punctuation': /^%[is]/ |
|||
} |
|||
}, |
|||
'range': { |
|||
pattern: /%(?:b[01]+-[01]+|d\d+-\d+|x[A-F\d]+-[A-F\d]+)/i, |
|||
alias: 'number' |
|||
}, |
|||
'terminal': { |
|||
pattern: /%(?:b[01]+(?:\.[01]+)*|d\d+(?:\.\d+)*|x[A-F\d]+(?:\.[A-F\d]+)*)/i, |
|||
alias: 'number' |
|||
}, |
|||
'repetition': { |
|||
pattern: /(^|[^\w-])(?:\d*\*\d*|\d+)/, |
|||
lookbehind: true, |
|||
alias: 'operator' |
|||
}, |
|||
'definition': { |
|||
pattern: /(^[ \t]*)(?:[a-z][\w-]*|<[^>\r\n]*>)(?=\s*=)/m, |
|||
lookbehind: true, |
|||
alias: 'keyword', |
|||
inside: { |
|||
'punctuation': /<|>/ |
|||
} |
|||
}, |
|||
'core-rule': { |
|||
pattern: RegExp('(?:(^|[^<\\w-])' + coreRules + '|<' + coreRules + '>)(?![\\w-])', 'i'), |
|||
lookbehind: true, |
|||
alias: ['rule', 'constant'], |
|||
inside: { |
|||
'punctuation': /<|>/ |
|||
} |
|||
}, |
|||
'rule': { |
|||
pattern: /(^|[^<\w-])[a-z][\w-]*|<[^>\r\n]*>/i, |
|||
lookbehind: true, |
|||
inside: { |
|||
'punctuation': /<|>/ |
|||
} |
|||
}, |
|||
'operator': /=\/?|\//, |
|||
'punctuation': /[()\[\]]/ |
|||
}; |
|||
|
|||
})(Prism); |
|||
@ -0,0 +1 @@ |
|||
!function(n){var i="(?:ALPHA|BIT|CHAR|CR|CRLF|CTL|DIGIT|DQUOTE|HEXDIG|HTAB|LF|LWSP|OCTET|SP|VCHAR|WSP)";Prism.languages.abnf={comment:/;.*/,string:{pattern:/(?:%[is])?"[^"\n\r]*"/,greedy:!0,inside:{punctuation:/^%[is]/}},range:{pattern:/%(?:b[01]+-[01]+|d\d+-\d+|x[A-F\d]+-[A-F\d]+)/i,alias:"number"},terminal:{pattern:/%(?:b[01]+(?:\.[01]+)*|d\d+(?:\.\d+)*|x[A-F\d]+(?:\.[A-F\d]+)*)/i,alias:"number"},repetition:{pattern:/(^|[^\w-])(?:\d*\*\d*|\d+)/,lookbehind:!0,alias:"operator"},definition:{pattern:/(^[ \t]*)(?:[a-z][\w-]*|<[^>\r\n]*>)(?=\s*=)/m,lookbehind:!0,alias:"keyword",inside:{punctuation:/<|>/}},"core-rule":{pattern:RegExp("(?:(^|[^<\\w-])"+i+"|<"+i+">)(?![\\w-])","i"),lookbehind:!0,alias:["rule","constant"],inside:{punctuation:/<|>/}},rule:{pattern:/(^|[^<\w-])[a-z][\w-]*|<[^>\r\n]*>/i,lookbehind:!0,inside:{punctuation:/<|>/}},operator:/=\/?|\//,punctuation:/[()\[\]]/}}(); |
|||
@ -0,0 +1,15 @@ |
|||
Prism.languages.actionscript = Prism.languages.extend('javascript', { |
|||
'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/, |
|||
'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/ |
|||
}); |
|||
Prism.languages.actionscript['class-name'].alias = 'function'; |
|||
|
|||
if (Prism.languages.markup) { |
|||
Prism.languages.insertBefore('actionscript', 'string', { |
|||
'xml': { |
|||
pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/, |
|||
lookbehind: true, |
|||
inside: Prism.languages.markup |
|||
} |
|||
}); |
|||
} |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:Prism.languages.markup}}); |
|||
@ -0,0 +1,19 @@ |
|||
Prism.languages.ada = { |
|||
'comment': /--.*/, |
|||
'string': /"(?:""|[^"\r\f\n])*"/i, |
|||
'number': [ |
|||
{ |
|||
pattern: /\b\d(?:_?\d)*#[\dA-F](?:_?[\dA-F])*(?:\.[\dA-F](?:_?[\dA-F])*)?#(?:E[+-]?\d(?:_?\d)*)?/i |
|||
}, |
|||
{ |
|||
pattern: /\b\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:E[+-]?\d(?:_?\d)*)?\b/i |
|||
} |
|||
], |
|||
'attr-name': /\b'\w+/i, |
|||
'keyword': /\b(?:abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|not|null|of|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i, |
|||
'boolean': /\b(?:true|false)\b/i, |
|||
'operator': /<[=>]?|>=?|=>?|:=|\/=?|\*\*?|[&+-]/, |
|||
'punctuation': /\.\.?|[,;():]/, |
|||
'char': /'.'/, |
|||
'variable': /\b[a-z](?:[_a-z\d])*\b/i |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.ada={comment:/--.*/,string:/"(?:""|[^"\r\f\n])*"/i,number:[{pattern:/\b\d(?:_?\d)*#[\dA-F](?:_?[\dA-F])*(?:\.[\dA-F](?:_?[\dA-F])*)?#(?:E[+-]?\d(?:_?\d)*)?/i},{pattern:/\b\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:E[+-]?\d(?:_?\d)*)?\b/i}],"attr-name":/\b'\w+/i,keyword:/\b(?:abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|new|return|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|interface|is|limited|loop|mod|not|null|of|others|out|overriding|package|pragma|private|procedure|protected|raise|range|record|rem|renames|requeue|reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until|use|when|while|with|xor)\b/i,boolean:/\b(?:true|false)\b/i,operator:/<[=>]?|>=?|=>?|:=|\/=?|\*\*?|[&+-]/,punctuation:/\.\.?|[,;():]/,char:/'.'/,variable:/\b[a-z](?:[_a-z\d])*\b/i}; |
|||
@ -0,0 +1,65 @@ |
|||
Prism.languages.antlr4 = { |
|||
'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, |
|||
'string': { |
|||
pattern: /'(?:\\.|[^\\'\r\n])*'/, |
|||
greedy: true |
|||
}, |
|||
'character-class': { |
|||
pattern: /\[(?:\\.|[^\\\]\r\n])*\]/, |
|||
greedy: true, |
|||
alias: 'regex', |
|||
inside: { |
|||
'range': { |
|||
pattern: /([^[]|(?:^|[^\\])(?:\\\\)*\\\[)-(?!\])/, |
|||
lookbehind: true, |
|||
alias: 'punctuation' |
|||
}, |
|||
'escape': /\\(?:u(?:[a-fA-F\d]{4}|\{[a-fA-F\d]+\})|[pP]\{[=\w-]+\}|[^\r\nupP])/, |
|||
'punctuation': /[\[\]]/ |
|||
} |
|||
}, |
|||
'action': { |
|||
pattern: /\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\}/, |
|||
greedy: true, |
|||
inside: { |
|||
'content': { |
|||
// this might be C, C++, Python, Java, C#, or any other language ANTLR4 compiles to
|
|||
pattern: /(\{)[\s\S]+(?=\})/, |
|||
lookbehind: true |
|||
}, |
|||
'punctuation': /[{}]/ |
|||
} |
|||
}, |
|||
'command': { |
|||
pattern: /(->\s*)(?:\s*(?:,\s*)?[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i, |
|||
lookbehind: true, |
|||
inside: { |
|||
'function': /\b\w+(?=\s*(?:[,(]|$))/, |
|||
'punctuation': /[,()]/ |
|||
} |
|||
}, |
|||
'annotation': { |
|||
pattern: /@\w+(?:::\w+)*/, |
|||
alias: 'keyword' |
|||
}, |
|||
'label': { |
|||
pattern: /#[ \t]*\w+/, |
|||
alias: 'punctuation' |
|||
}, |
|||
'keyword': /\b(?:catch|channels|finally|fragment|grammar|import|lexer|locals|mode|options|parser|returns|throws|tokens)\b/, |
|||
'definition': [ |
|||
{ |
|||
pattern: /\b[a-z]\w*(?=\s*:)/, |
|||
alias: ['rule', 'class-name'] |
|||
}, |
|||
{ |
|||
pattern: /\b[A-Z]\w*(?=\s*:)/, |
|||
alias: ['token', 'constant'] |
|||
}, |
|||
], |
|||
'constant': /\b[A-Z][A-Z_]*\b/, |
|||
'operator': /\.\.|->|[|~]|[*+?]\??/, |
|||
'punctuation': /[;:()=]/ |
|||
}; |
|||
|
|||
Prism.languages.g4 = Prism.languages.antlr4; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.antlr4={comment:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,string:{pattern:/'(?:\\.|[^\\'\r\n])*'/,greedy:!0},"character-class":{pattern:/\[(?:\\.|[^\\\]\r\n])*\]/,greedy:!0,alias:"regex",inside:{range:{pattern:/([^[]|(?:^|[^\\])(?:\\\\)*\\\[)-(?!\])/,lookbehind:!0,alias:"punctuation"},escape:/\\(?:u(?:[a-fA-F\d]{4}|\{[a-fA-F\d]+\})|[pP]\{[=\w-]+\}|[^\r\nupP])/,punctuation:/[\[\]]/}},action:{pattern:/\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\}/,greedy:!0,inside:{content:{pattern:/(\{)[\s\S]+(?=\})/,lookbehind:!0},punctuation:/[{}]/}},command:{pattern:/(->\s*)(?:\s*(?:,\s*)?[a-z]\w*(?:\s*\([^()\r\n]*\))?)+(?=\s*;)/i,lookbehind:!0,inside:{function:/\b\w+(?=\s*(?:[,(]|$))/,punctuation:/[,()]/}},annotation:{pattern:/@\w+(?:::\w+)*/,alias:"keyword"},label:{pattern:/#[ \t]*\w+/,alias:"punctuation"},keyword:/\b(?:catch|channels|finally|fragment|grammar|import|lexer|locals|mode|options|parser|returns|throws|tokens)\b/,definition:[{pattern:/\b[a-z]\w*(?=\s*:)/,alias:["rule","class-name"]},{pattern:/\b[A-Z]\w*(?=\s*:)/,alias:["token","constant"]}],constant:/\b[A-Z][A-Z_]*\b/,operator:/\.\.|->|[|~]|[*+?]\??/,punctuation:/[;:()=]/},Prism.languages.g4=Prism.languages.antlr4; |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,32 @@ |
|||
Prism.languages.apl = { |
|||
'comment': /(?:⍝|#[! ]).*$/m, |
|||
'string': { |
|||
pattern: /'(?:[^'\r\n]|'')*'/, |
|||
greedy: true |
|||
}, |
|||
'number': /¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞))?/i, |
|||
'statement': /:[A-Z][a-z][A-Za-z]*\b/, |
|||
'system-function': { |
|||
pattern: /⎕[A-Z]+/i, |
|||
alias: 'function' |
|||
}, |
|||
'constant': /[⍬⌾#⎕⍞]/, |
|||
'function': /[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⊆⊇⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/, |
|||
'monadic-operator': { |
|||
pattern: /[\\\/⌿⍀¨⍨⌶&∥]/, |
|||
alias: 'operator' |
|||
}, |
|||
'dyadic-operator': { |
|||
pattern: /[.⍣⍠⍤∘⌸@⌺]/, |
|||
alias: 'operator' |
|||
}, |
|||
'assignment': { |
|||
pattern: /←/, |
|||
alias: 'keyword' |
|||
}, |
|||
'punctuation': /[\[;\]()◇⋄]/, |
|||
'dfn': { |
|||
pattern: /[{}⍺⍵⍶⍹∇⍫:]/, |
|||
alias: 'builtin' |
|||
} |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.apl={comment:/(?:⍝|#[! ]).*$/m,string:{pattern:/'(?:[^'\r\n]|'')*'/,greedy:!0},number:/¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞))?/i,statement:/:[A-Z][a-z][A-Za-z]*\b/,"system-function":{pattern:/⎕[A-Z]+/i,alias:"function"},constant:/[⍬⌾#⎕⍞]/,function:/[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⊆⊇⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/,"monadic-operator":{pattern:/[\\\/⌿⍀¨⍨⌶&∥]/,alias:"operator"},"dyadic-operator":{pattern:/[.⍣⍠⍤∘⌸@⌺]/,alias:"operator"},assignment:{pattern:/←/,alias:"keyword"},punctuation:/[\[;\]()◇⋄]/,dfn:{pattern:/[{}⍺⍵⍶⍹∇⍫:]/,alias:"builtin"}}; |
|||
@ -0,0 +1,20 @@ |
|||
Prism.languages.applescript = { |
|||
'comment': [ |
|||
// Allow one level of nesting
|
|||
/\(\*(?:\(\*[\s\S]*?\*\)|[\s\S])*?\*\)/, |
|||
/--.+/, |
|||
/#.+/ |
|||
], |
|||
'string': /"(?:\\.|[^"\\\r\n])*"/, |
|||
'number': /(?:\b\d+\.?\d*|\B\.\d+)(?:e-?\d+)?\b/i, |
|||
'operator': [ |
|||
/[&=≠≤≥*+\-\/÷^]|[<>]=?/, |
|||
/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/ |
|||
], |
|||
'keyword': /\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/, |
|||
'class': { |
|||
pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/, |
|||
alias: 'builtin' |
|||
}, |
|||
'punctuation': /[{}():,¬«»《》]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.applescript={comment:[/\(\*(?:\(\*[\s\S]*?\*\)|[\s\S])*?\*\)/,/--.+/,/#.+/],string:/"(?:\\.|[^"\\\r\n])*"/,number:/(?:\b\d+\.?\d*|\B\.\d+)(?:e-?\d+)?\b/i,operator:[/[&=≠≤≥*+\-\/÷^]|[<>]=?/,/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/],keyword:/\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/,class:{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"},punctuation:/[{}():,¬«»《》]/}; |
|||
@ -0,0 +1,41 @@ |
|||
Prism.languages.aql = { |
|||
'comment': /\/\/.*|\/\*[\s\S]*?\*\//, |
|||
'property': { |
|||
pattern: /([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/, |
|||
lookbehind: true, |
|||
greedy: true |
|||
}, |
|||
'string': { |
|||
pattern: /(["'´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/, |
|||
greedy: true |
|||
}, |
|||
'variable': /@@?\w+/, |
|||
'keyword': [ |
|||
{ |
|||
pattern: /(\bWITH\s+)COUNT(?=\s+INTO\b)/i, |
|||
lookbehind: true |
|||
}, |
|||
/\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WITH)\b/i, |
|||
// pseudo keywords get a lookbehind to avoid false positives
|
|||
{ |
|||
pattern: /(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i, |
|||
lookbehind: true |
|||
}, |
|||
{ |
|||
pattern: /(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/, |
|||
lookbehind: true |
|||
}, |
|||
{ |
|||
pattern: /\bOPTIONS(?=\s*{)/i |
|||
} |
|||
], |
|||
'function': /(?!\d)\w+(?=\s*\()/, |
|||
'boolean': /(?:true|false)/i, |
|||
'range': { |
|||
pattern: /\.\./, |
|||
alias: 'operator' |
|||
}, |
|||
'number': /(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i, |
|||
'operator': /\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/, |
|||
'punctuation': /::|[?.:,;()[\]{}]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.aql={comment:/\/\/.*|\/\*[\s\S]*?\*\//,property:{pattern:/([{,]\s*)(?:(?!\d)\w+|(["'´`])(?:(?!\2)[^\\\r\n]|\\.)*\2)(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(["'´`])(?:(?!\1)[^\\\r\n]|\\.)*\1/,greedy:!0},variable:/@@?\w+/,keyword:[{pattern:/(\bWITH\s+)COUNT(?=\s+INTO\b)/i,lookbehind:!0},/\b(?:AGGREGATE|ALL|AND|ANY|ASC|COLLECT|DESC|DISTINCT|FILTER|FOR|GRAPH|IN|INBOUND|INSERT|INTO|K_SHORTEST_PATHS|LET|LIKE|LIMIT|NONE|NOT|NULL|OR|OUTBOUND|REMOVE|REPLACE|RETURN|SHORTEST_PATH|SORT|UPDATE|UPSERT|WITH)\b/i,{pattern:/(^|[^\w.[])(?:KEEP|PRUNE|SEARCH|TO)\b/i,lookbehind:!0},{pattern:/(^|[^\w.[])(?:CURRENT|NEW|OLD)\b/,lookbehind:!0},{pattern:/\bOPTIONS(?=\s*{)/i}],function:/(?!\d)\w+(?=\s*\()/,boolean:/(?:true|false)/i,range:{pattern:/\.\./,alias:"operator"},number:/(?:\B\.\d+|\b(?:0|[1-9]\d*)(?:\.\d+)?)(?:e[+-]?\d+)?/i,operator:/\*{2,}|[=!]~|[!=<>]=?|&&|\|\||[-+*/%]/,punctuation:/::|[?.:,;()[\]{}]/}; |
|||
@ -0,0 +1,5 @@ |
|||
Prism.languages.arduino = Prism.languages.extend('cpp', { |
|||
'keyword': /\b(?:setup|if|else|while|do|for|return|in|instanceof|default|function|loop|goto|switch|case|new|try|throw|catch|finally|null|break|continue|boolean|bool|void|byte|word|string|String|array|int|long|integer|double)\b/, |
|||
'builtin': /\b(?:KeyboardController|MouseController|SoftwareSerial|EthernetServer|EthernetClient|LiquidCrystal|LiquidCrystal_I2C|RobotControl|GSMVoiceCall|EthernetUDP|EsploraTFT|HttpClient|RobotMotor|WiFiClient|GSMScanner|FileSystem|Scheduler|GSMServer|YunClient|YunServer|IPAddress|GSMClient|GSMModem|Keyboard|Ethernet|Console|GSMBand|Esplora|Stepper|Process|WiFiUDP|GSM_SMS|Mailbox|USBHost|Firmata|PImage|Client|Server|GSMPIN|FileIO|Bridge|Serial|EEPROM|Stream|Mouse|Audio|Servo|File|Task|GPRS|WiFi|Wire|TFT|GSM|SPI|SD|runShellCommandAsynchronously|analogWriteResolution|retrieveCallingNumber|printFirmwareVersion|analogReadResolution|sendDigitalPortPair|noListenOnLocalhost|readJoystickButton|setFirmwareVersion|readJoystickSwitch|scrollDisplayRight|getVoiceCallStatus|scrollDisplayLeft|writeMicroseconds|delayMicroseconds|beginTransmission|getSignalStrength|runAsynchronously|getAsynchronously|listenOnLocalhost|getCurrentCarrier|readAccelerometer|messageAvailable|sendDigitalPorts|lineFollowConfig|countryNameWrite|runShellCommand|readStringUntil|rewindDirectory|readTemperature|setClockDivider|readLightSensor|endTransmission|analogReference|detachInterrupt|countryNameRead|attachInterrupt|encryptionType|readBytesUntil|robotNameWrite|readMicrophone|robotNameRead|cityNameWrite|userNameWrite|readJoystickY|readJoystickX|mouseReleased|openNextFile|scanNetworks|noInterrupts|digitalWrite|beginSpeaker|mousePressed|isActionDone|mouseDragged|displayLogos|noAutoscroll|addParameter|remoteNumber|getModifiers|keyboardRead|userNameRead|waitContinue|processInput|parseCommand|printVersion|readNetworks|writeMessage|blinkVersion|cityNameRead|readMessage|setDataMode|parsePacket|isListening|setBitOrder|beginPacket|isDirectory|motorsWrite|drawCompass|digitalRead|clearScreen|serialEvent|rightToLeft|setTextSize|leftToRight|requestFrom|keyReleased|compassRead|analogWrite|interrupts|WiFiServer|disconnect|playMelody|parseFloat|autoscroll|getPINUsed|setPINUsed|setTimeout|sendAnalog|readSlider|analogRead|beginWrite|createChar|motorsStop|keyPressed|tempoWrite|readButton|subnetMask|debugPrint|macAddress|writeGreen|randomSeed|attachGPRS|readString|sendString|remotePort|releaseAll|mouseMoved|background|getXChange|getYChange|answerCall|getResult|voiceCall|endPacket|constrain|getSocket|writeJSON|getButton|available|connected|findUntil|readBytes|exitValue|readGreen|writeBlue|startLoop|IPAddress|isPressed|sendSysex|pauseMode|gatewayIP|setCursor|getOemKey|tuneWrite|noDisplay|loadImage|switchPIN|onRequest|onReceive|changePIN|playFile|noBuffer|parseInt|overflow|checkPIN|knobRead|beginTFT|bitClear|updateIR|bitWrite|position|writeRGB|highByte|writeRed|setSpeed|readBlue|noStroke|remoteIP|transfer|shutdown|hangCall|beginSMS|endWrite|attached|maintain|noCursor|checkReg|checkPUK|shiftOut|isValid|shiftIn|pulseIn|connect|println|localIP|pinMode|getIMEI|display|noBlink|process|getBand|running|beginSD|drawBMP|lowByte|setBand|release|bitRead|prepare|pointTo|readRed|setMode|noFill|remove|listen|stroke|detach|attach|noTone|exists|buffer|height|bitSet|circle|config|cursor|random|IRread|setDNS|endSMS|getKey|micros|millis|begin|print|write|ready|flush|width|isPIN|blink|clear|press|mkdir|rmdir|close|point|yield|image|BSSID|click|delay|read|text|move|peek|beep|rect|line|open|seek|fill|size|turn|stop|home|find|step|tone|sqrt|RSSI|SSID|end|bit|tan|cos|sin|pow|map|abs|max|min|get|run|put)\b/, |
|||
'constant': /\b(?:DIGITAL_MESSAGE|FIRMATA_STRING|ANALOG_MESSAGE|REPORT_DIGITAL|REPORT_ANALOG|INPUT_PULLUP|SET_PIN_MODE|INTERNAL2V56|SYSTEM_RESET|LED_BUILTIN|INTERNAL1V1|SYSEX_START|INTERNAL|EXTERNAL|DEFAULT|OUTPUT|INPUT|HIGH|LOW)\b/ |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.arduino=Prism.languages.extend("cpp",{keyword:/\b(?:setup|if|else|while|do|for|return|in|instanceof|default|function|loop|goto|switch|case|new|try|throw|catch|finally|null|break|continue|boolean|bool|void|byte|word|string|String|array|int|long|integer|double)\b/,builtin:/\b(?:KeyboardController|MouseController|SoftwareSerial|EthernetServer|EthernetClient|LiquidCrystal|LiquidCrystal_I2C|RobotControl|GSMVoiceCall|EthernetUDP|EsploraTFT|HttpClient|RobotMotor|WiFiClient|GSMScanner|FileSystem|Scheduler|GSMServer|YunClient|YunServer|IPAddress|GSMClient|GSMModem|Keyboard|Ethernet|Console|GSMBand|Esplora|Stepper|Process|WiFiUDP|GSM_SMS|Mailbox|USBHost|Firmata|PImage|Client|Server|GSMPIN|FileIO|Bridge|Serial|EEPROM|Stream|Mouse|Audio|Servo|File|Task|GPRS|WiFi|Wire|TFT|GSM|SPI|SD|runShellCommandAsynchronously|analogWriteResolution|retrieveCallingNumber|printFirmwareVersion|analogReadResolution|sendDigitalPortPair|noListenOnLocalhost|readJoystickButton|setFirmwareVersion|readJoystickSwitch|scrollDisplayRight|getVoiceCallStatus|scrollDisplayLeft|writeMicroseconds|delayMicroseconds|beginTransmission|getSignalStrength|runAsynchronously|getAsynchronously|listenOnLocalhost|getCurrentCarrier|readAccelerometer|messageAvailable|sendDigitalPorts|lineFollowConfig|countryNameWrite|runShellCommand|readStringUntil|rewindDirectory|readTemperature|setClockDivider|readLightSensor|endTransmission|analogReference|detachInterrupt|countryNameRead|attachInterrupt|encryptionType|readBytesUntil|robotNameWrite|readMicrophone|robotNameRead|cityNameWrite|userNameWrite|readJoystickY|readJoystickX|mouseReleased|openNextFile|scanNetworks|noInterrupts|digitalWrite|beginSpeaker|mousePressed|isActionDone|mouseDragged|displayLogos|noAutoscroll|addParameter|remoteNumber|getModifiers|keyboardRead|userNameRead|waitContinue|processInput|parseCommand|printVersion|readNetworks|writeMessage|blinkVersion|cityNameRead|readMessage|setDataMode|parsePacket|isListening|setBitOrder|beginPacket|isDirectory|motorsWrite|drawCompass|digitalRead|clearScreen|serialEvent|rightToLeft|setTextSize|leftToRight|requestFrom|keyReleased|compassRead|analogWrite|interrupts|WiFiServer|disconnect|playMelody|parseFloat|autoscroll|getPINUsed|setPINUsed|setTimeout|sendAnalog|readSlider|analogRead|beginWrite|createChar|motorsStop|keyPressed|tempoWrite|readButton|subnetMask|debugPrint|macAddress|writeGreen|randomSeed|attachGPRS|readString|sendString|remotePort|releaseAll|mouseMoved|background|getXChange|getYChange|answerCall|getResult|voiceCall|endPacket|constrain|getSocket|writeJSON|getButton|available|connected|findUntil|readBytes|exitValue|readGreen|writeBlue|startLoop|IPAddress|isPressed|sendSysex|pauseMode|gatewayIP|setCursor|getOemKey|tuneWrite|noDisplay|loadImage|switchPIN|onRequest|onReceive|changePIN|playFile|noBuffer|parseInt|overflow|checkPIN|knobRead|beginTFT|bitClear|updateIR|bitWrite|position|writeRGB|highByte|writeRed|setSpeed|readBlue|noStroke|remoteIP|transfer|shutdown|hangCall|beginSMS|endWrite|attached|maintain|noCursor|checkReg|checkPUK|shiftOut|isValid|shiftIn|pulseIn|connect|println|localIP|pinMode|getIMEI|display|noBlink|process|getBand|running|beginSD|drawBMP|lowByte|setBand|release|bitRead|prepare|pointTo|readRed|setMode|noFill|remove|listen|stroke|detach|attach|noTone|exists|buffer|height|bitSet|circle|config|cursor|random|IRread|setDNS|endSMS|getKey|micros|millis|begin|print|write|ready|flush|width|isPIN|blink|clear|press|mkdir|rmdir|close|point|yield|image|BSSID|click|delay|read|text|move|peek|beep|rect|line|open|seek|fill|size|turn|stop|home|find|step|tone|sqrt|RSSI|SSID|end|bit|tan|cos|sin|pow|map|abs|max|min|get|run|put)\b/,constant:/\b(?:DIGITAL_MESSAGE|FIRMATA_STRING|ANALOG_MESSAGE|REPORT_DIGITAL|REPORT_ANALOG|INPUT_PULLUP|SET_PIN_MODE|INTERNAL2V56|SYSTEM_RESET|LED_BUILTIN|INTERNAL1V1|SYSEX_START|INTERNAL|EXTERNAL|DEFAULT|OUTPUT|INPUT|HIGH|LOW)\b/}); |
|||
@ -0,0 +1,10 @@ |
|||
Prism.languages.arff = { |
|||
'comment': /%.*/, |
|||
'string': { |
|||
pattern: /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/, |
|||
greedy: true |
|||
}, |
|||
'keyword': /@(?:attribute|data|end|relation)\b/i, |
|||
'number': /\b\d+(?:\.\d+)?\b/, |
|||
'punctuation': /[{},]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.arff={comment:/%.*/,string:{pattern:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},keyword:/@(?:attribute|data|end|relation)\b/i,number:/\b\d+(?:\.\d+)?\b/,punctuation:/[{},]/}; |
|||
@ -0,0 +1,234 @@ |
|||
(function (Prism) { |
|||
|
|||
var attributes = { |
|||
pattern: /(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\]\\]|\\.)*\]|[^\]\\]|\\.)*\]/m, |
|||
lookbehind: true, |
|||
inside: { |
|||
'quoted': { |
|||
pattern: /([$`])(?:(?!\1)[^\\]|\\.)*\1/, |
|||
inside: { |
|||
'punctuation': /^[$`]|[$`]$/ |
|||
} |
|||
}, |
|||
'interpreted': { |
|||
pattern: /'(?:[^'\\]|\\.)*'/, |
|||
inside: { |
|||
'punctuation': /^'|'$/ |
|||
// See rest below
|
|||
} |
|||
}, |
|||
'string': /"(?:[^"\\]|\\.)*"/, |
|||
'variable': /\w+(?==)/, |
|||
'punctuation': /^\[|\]$|,/, |
|||
'operator': /=/, |
|||
// The negative look-ahead prevents blank matches
|
|||
'attr-value': /(?!^\s+$).+/ |
|||
} |
|||
}; |
|||
|
|||
var asciidoc = Prism.languages.asciidoc = { |
|||
'comment-block': { |
|||
pattern: /^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m, |
|||
alias: 'comment' |
|||
}, |
|||
'table': { |
|||
pattern: /^\|={3,}(?:(?:\r?\n|\r).*)*?(?:\r?\n|\r)\|={3,}$/m, |
|||
inside: { |
|||
'specifiers': { |
|||
pattern: /(?!\|)(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*])?(?:[<^>](?:\.[<^>])?|\.[<^>])?[a-z]*)(?=\|)/, |
|||
alias: 'attr-value' |
|||
}, |
|||
'punctuation': { |
|||
pattern: /(^|[^\\])[|!]=*/, |
|||
lookbehind: true |
|||
} |
|||
// See rest below
|
|||
} |
|||
}, |
|||
|
|||
'passthrough-block': { |
|||
pattern: /^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m, |
|||
inside: { |
|||
'punctuation': /^\++|\++$/ |
|||
// See rest below
|
|||
} |
|||
}, |
|||
// Literal blocks and listing blocks
|
|||
'literal-block': { |
|||
pattern: /^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m, |
|||
inside: { |
|||
'punctuation': /^(?:-+|\.+)|(?:-+|\.+)$/ |
|||
// See rest below
|
|||
} |
|||
}, |
|||
// Sidebar blocks, quote blocks, example blocks and open blocks
|
|||
'other-block': { |
|||
pattern: /^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m, |
|||
inside: { |
|||
'punctuation': /^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/ |
|||
// See rest below
|
|||
} |
|||
}, |
|||
|
|||
// list-punctuation and list-label must appear before indented-block
|
|||
'list-punctuation': { |
|||
pattern: /(^[ \t]*)(?:-|\*{1,5}|\.{1,5}|(?:[a-z]|\d+)\.|[xvi]+\))(?= )/im, |
|||
lookbehind: true, |
|||
alias: 'punctuation' |
|||
}, |
|||
'list-label': { |
|||
pattern: /(^[ \t]*)[a-z\d].+(?::{2,4}|;;)(?=\s)/im, |
|||
lookbehind: true, |
|||
alias: 'symbol' |
|||
}, |
|||
'indented-block': { |
|||
pattern: /((\r?\n|\r)\2)([ \t]+)\S.*(?:(?:\r?\n|\r)\3.+)*(?=\2{2}|$)/, |
|||
lookbehind: true |
|||
}, |
|||
|
|||
'comment': /^\/\/.*/m, |
|||
'title': { |
|||
pattern: /^.+(?:\r?\n|\r)(?:={3,}|-{3,}|~{3,}|\^{3,}|\+{3,})$|^={1,5} +.+|^\.(?![\s.]).*/m, |
|||
alias: 'important', |
|||
inside: { |
|||
'punctuation': /^(?:\.|=+)|(?:=+|-+|~+|\^+|\++)$/ |
|||
// See rest below
|
|||
} |
|||
}, |
|||
'attribute-entry': { |
|||
pattern: /^:[^:\r\n]+:(?: .*?(?: \+(?:\r?\n|\r).*?)*)?$/m, |
|||
alias: 'tag' |
|||
}, |
|||
'attributes': attributes, |
|||
'hr': { |
|||
pattern: /^'{3,}$/m, |
|||
alias: 'punctuation' |
|||
}, |
|||
'page-break': { |
|||
pattern: /^<{3,}$/m, |
|||
alias: 'punctuation' |
|||
}, |
|||
'admonition': { |
|||
pattern: /^(?:TIP|NOTE|IMPORTANT|WARNING|CAUTION):/m, |
|||
alias: 'keyword' |
|||
}, |
|||
'callout': [ |
|||
{ |
|||
pattern: /(^[ \t]*)<?\d*>/m, |
|||
lookbehind: true, |
|||
alias: 'symbol' |
|||
}, |
|||
{ |
|||
pattern: /<\d+>/, |
|||
alias: 'symbol' |
|||
} |
|||
], |
|||
'macro': { |
|||
pattern: /\b[a-z\d][a-z\d-]*::?(?:(?:\S+)??\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/, |
|||
inside: { |
|||
'function': /^[a-z\d-]+(?=:)/, |
|||
'punctuation': /^::?/, |
|||
'attributes': { |
|||
pattern: /(?:\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/, |
|||
inside: attributes.inside |
|||
} |
|||
} |
|||
}, |
|||
'inline': { |
|||
/* |
|||
The initial look-behind prevents the highlighting of escaped quoted text. |
|||
|
|||
Quoted text can be multi-line but cannot span an empty line. |
|||
All quoted text can have attributes before [foobar, 'foobar', baz="bar"]. |
|||
|
|||
First, we handle the constrained quotes. |
|||
Those must be bounded by non-word chars and cannot have spaces between the delimiter and the first char. |
|||
They are, in order: _emphasis_, ``double quotes'', `single quotes', `monospace`, 'emphasis', *strong*, +monospace+ and #unquoted#
|
|||
|
|||
Then we handle the unconstrained quotes. |
|||
Those do not have the restrictions of the constrained quotes. |
|||
They are, in order: __emphasis__, **strong**, ++monospace++, +++passthrough+++, ##unquoted##, $$passthrough$$, ~subscript~, ^superscript^, {attribute-reference}, [[anchor]], [[[bibliography anchor]]], <<xref>>, (((indexes))) and ((indexes)) |
|||
*/ |
|||
pattern: /(^|[^\\])(?:(?:\B\[(?:[^\]\\"]|(["'])(?:(?!\2)[^\\]|\\.)*\2|\\.)*\])?(?:\b_(?!\s)(?: _|[^_\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: _|[^_\\\r\n]|\\.)+)*_\b|\B``(?!\s).+?(?:(?:\r?\n|\r).+?)*''\B|\B`(?!\s)(?: ['`]|.)+?(?:(?:\r?\n|\r)(?: ['`]|.)+?)*['`]\B|\B(['*+#])(?!\s)(?: \3|(?!\3)[^\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: \3|(?!\3)[^\\\r\n]|\\.)+)*\3\B)|(?:\[(?:[^\]\\"]|(["'])(?:(?!\4)[^\\]|\\.)*\4|\\.)*\])?(?:(__|\*\*|\+\+\+?|##|\$\$|[~^]).+?(?:(?:\r?\n|\r).+?)*\5|\{[^}\r\n]+\}|\[\[\[?.+?(?:(?:\r?\n|\r).+?)*\]?\]\]|<<.+?(?:(?:\r?\n|\r).+?)*>>|\(\(\(?.+?(?:(?:\r?\n|\r).+?)*\)?\)\)))/m, |
|||
lookbehind: true, |
|||
inside: { |
|||
'attributes': attributes, |
|||
'url': { |
|||
pattern: /^(?:\[\[\[?.+?\]?\]\]|<<.+?>>)$/, |
|||
inside: { |
|||
'punctuation': /^(?:\[\[\[?|<<)|(?:\]\]\]?|>>)$/ |
|||
} |
|||
}, |
|||
'attribute-ref': { |
|||
pattern: /^\{.+\}$/, |
|||
inside: { |
|||
'variable': { |
|||
pattern: /(^\{)[a-z\d,+_-]+/, |
|||
lookbehind: true |
|||
}, |
|||
'operator': /^[=?!#%@$]|!(?=[:}])/, |
|||
'punctuation': /^\{|\}$|::?/ |
|||
} |
|||
}, |
|||
'italic': { |
|||
pattern: /^(['_])[\s\S]+\1$/, |
|||
inside: { |
|||
'punctuation': /^(?:''?|__?)|(?:''?|__?)$/ |
|||
} |
|||
}, |
|||
'bold': { |
|||
pattern: /^\*[\s\S]+\*$/, |
|||
inside: { |
|||
punctuation: /^\*\*?|\*\*?$/ |
|||
} |
|||
}, |
|||
'punctuation': /^(?:``?|\+{1,3}|##?|\$\$|[~^]|\(\(\(?)|(?:''?|\+{1,3}|##?|\$\$|[~^`]|\)?\)\))$/ |
|||
} |
|||
}, |
|||
'replacement': { |
|||
pattern: /\((?:C|TM|R)\)/, |
|||
alias: 'builtin' |
|||
}, |
|||
'entity': /&#?[\da-z]{1,8};/i, |
|||
'line-continuation': { |
|||
pattern: /(^| )\+$/m, |
|||
lookbehind: true, |
|||
alias: 'punctuation' |
|||
} |
|||
}; |
|||
|
|||
|
|||
// Allow some nesting. There is no recursion though, so cloning should not be needed.
|
|||
|
|||
function copyFromAsciiDoc(keys) { |
|||
keys = keys.split(' '); |
|||
|
|||
var o = {}; |
|||
for (var i = 0, l = keys.length; i < l; i++) { |
|||
o[keys[i]] = asciidoc[keys[i]]; |
|||
} |
|||
return o; |
|||
} |
|||
|
|||
attributes.inside['interpreted'].inside.rest = copyFromAsciiDoc('macro inline replacement entity'); |
|||
|
|||
asciidoc['passthrough-block'].inside.rest = copyFromAsciiDoc('macro'); |
|||
|
|||
asciidoc['literal-block'].inside.rest = copyFromAsciiDoc('callout'); |
|||
|
|||
asciidoc['table'].inside.rest = copyFromAsciiDoc('comment-block passthrough-block literal-block other-block list-punctuation indented-block comment title attribute-entry attributes hr page-break admonition list-label callout macro inline replacement entity line-continuation'); |
|||
|
|||
asciidoc['other-block'].inside.rest = copyFromAsciiDoc('table list-punctuation indented-block comment attribute-entry attributes hr page-break admonition list-label macro inline replacement entity line-continuation'); |
|||
|
|||
asciidoc['title'].inside.rest = copyFromAsciiDoc('macro inline replacement entity'); |
|||
|
|||
|
|||
// Plugin to make entity title show the real entity, idea by Roman Komarov
|
|||
Prism.hooks.add('wrap', function (env) { |
|||
if (env.type === 'entity') { |
|||
env.attributes['title'] = env.content.replace(/&/, '&'); |
|||
} |
|||
}); |
|||
|
|||
Prism.languages.adoc = Prism.languages.asciidoc; |
|||
}(Prism)); |
|||
@ -0,0 +1 @@ |
|||
!function(t){var n={pattern:/(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\]\\]|\\.)*\]|[^\]\\]|\\.)*\]/m,lookbehind:!0,inside:{quoted:{pattern:/([$`])(?:(?!\1)[^\\]|\\.)*\1/,inside:{punctuation:/^[$`]|[$`]$/}},interpreted:{pattern:/'(?:[^'\\]|\\.)*'/,inside:{punctuation:/^'|'$/}},string:/"(?:[^"\\]|\\.)*"/,variable:/\w+(?==)/,punctuation:/^\[|\]$|,/,operator:/=/,"attr-value":/(?!^\s+$).+/}},a=t.languages.asciidoc={"comment-block":{pattern:/^(\/{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1/m,alias:"comment"},table:{pattern:/^\|={3,}(?:(?:\r?\n|\r).*)*?(?:\r?\n|\r)\|={3,}$/m,inside:{specifiers:{pattern:/(?!\|)(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*])?(?:[<^>](?:\.[<^>])?|\.[<^>])?[a-z]*)(?=\|)/,alias:"attr-value"},punctuation:{pattern:/(^|[^\\])[|!]=*/,lookbehind:!0}}},"passthrough-block":{pattern:/^(\+{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^\++|\++$/}},"literal-block":{pattern:/^(-{4,}|\.{4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^(?:-+|\.+)|(?:-+|\.+)$/}},"other-block":{pattern:/^(--|\*{4,}|_{4,}|={4,})(?:\r?\n|\r)(?:[\s\S]*(?:\r?\n|\r))??\1$/m,inside:{punctuation:/^(?:-+|\*+|_+|=+)|(?:-+|\*+|_+|=+)$/}},"list-punctuation":{pattern:/(^[ \t]*)(?:-|\*{1,5}|\.{1,5}|(?:[a-z]|\d+)\.|[xvi]+\))(?= )/im,lookbehind:!0,alias:"punctuation"},"list-label":{pattern:/(^[ \t]*)[a-z\d].+(?::{2,4}|;;)(?=\s)/im,lookbehind:!0,alias:"symbol"},"indented-block":{pattern:/((\r?\n|\r)\2)([ \t]+)\S.*(?:(?:\r?\n|\r)\3.+)*(?=\2{2}|$)/,lookbehind:!0},comment:/^\/\/.*/m,title:{pattern:/^.+(?:\r?\n|\r)(?:={3,}|-{3,}|~{3,}|\^{3,}|\+{3,})$|^={1,5} +.+|^\.(?![\s.]).*/m,alias:"important",inside:{punctuation:/^(?:\.|=+)|(?:=+|-+|~+|\^+|\++)$/}},"attribute-entry":{pattern:/^:[^:\r\n]+:(?: .*?(?: \+(?:\r?\n|\r).*?)*)?$/m,alias:"tag"},attributes:n,hr:{pattern:/^'{3,}$/m,alias:"punctuation"},"page-break":{pattern:/^<{3,}$/m,alias:"punctuation"},admonition:{pattern:/^(?:TIP|NOTE|IMPORTANT|WARNING|CAUTION):/m,alias:"keyword"},callout:[{pattern:/(^[ \t]*)<?\d*>/m,lookbehind:!0,alias:"symbol"},{pattern:/<\d+>/,alias:"symbol"}],macro:{pattern:/\b[a-z\d][a-z\d-]*::?(?:(?:\S+)??\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,inside:{function:/^[a-z\d-]+(?=:)/,punctuation:/^::?/,attributes:{pattern:/(?:\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,inside:n.inside}}},inline:{pattern:/(^|[^\\])(?:(?:\B\[(?:[^\]\\"]|(["'])(?:(?!\2)[^\\]|\\.)*\2|\\.)*\])?(?:\b_(?!\s)(?: _|[^_\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: _|[^_\\\r\n]|\\.)+)*_\b|\B``(?!\s).+?(?:(?:\r?\n|\r).+?)*''\B|\B`(?!\s)(?: ['`]|.)+?(?:(?:\r?\n|\r)(?: ['`]|.)+?)*['`]\B|\B(['*+#])(?!\s)(?: \3|(?!\3)[^\\\r\n]|\\.)+(?:(?:\r?\n|\r)(?: \3|(?!\3)[^\\\r\n]|\\.)+)*\3\B)|(?:\[(?:[^\]\\"]|(["'])(?:(?!\4)[^\\]|\\.)*\4|\\.)*\])?(?:(__|\*\*|\+\+\+?|##|\$\$|[~^]).+?(?:(?:\r?\n|\r).+?)*\5|\{[^}\r\n]+\}|\[\[\[?.+?(?:(?:\r?\n|\r).+?)*\]?\]\]|<<.+?(?:(?:\r?\n|\r).+?)*>>|\(\(\(?.+?(?:(?:\r?\n|\r).+?)*\)?\)\)))/m,lookbehind:!0,inside:{attributes:n,url:{pattern:/^(?:\[\[\[?.+?\]?\]\]|<<.+?>>)$/,inside:{punctuation:/^(?:\[\[\[?|<<)|(?:\]\]\]?|>>)$/}},"attribute-ref":{pattern:/^\{.+\}$/,inside:{variable:{pattern:/(^\{)[a-z\d,+_-]+/,lookbehind:!0},operator:/^[=?!#%@$]|!(?=[:}])/,punctuation:/^\{|\}$|::?/}},italic:{pattern:/^(['_])[\s\S]+\1$/,inside:{punctuation:/^(?:''?|__?)|(?:''?|__?)$/}},bold:{pattern:/^\*[\s\S]+\*$/,inside:{punctuation:/^\*\*?|\*\*?$/}},punctuation:/^(?:``?|\+{1,3}|##?|\$\$|[~^]|\(\(\(?)|(?:''?|\+{1,3}|##?|\$\$|[~^`]|\)?\)\))$/}},replacement:{pattern:/\((?:C|TM|R)\)/,alias:"builtin"},entity:/&#?[\da-z]{1,8};/i,"line-continuation":{pattern:/(^| )\+$/m,lookbehind:!0,alias:"punctuation"}};function i(t){for(var n={},i=0,e=(t=t.split(" ")).length;i<e;i++)n[t[i]]=a[t[i]];return n}n.inside.interpreted.inside.rest=i("macro inline replacement entity"),a["passthrough-block"].inside.rest=i("macro"),a["literal-block"].inside.rest=i("callout"),a.table.inside.rest=i("comment-block passthrough-block literal-block other-block list-punctuation indented-block comment title attribute-entry attributes hr page-break admonition list-label callout macro inline replacement entity line-continuation"),a["other-block"].inside.rest=i("table list-punctuation indented-block comment attribute-entry attributes hr page-break admonition list-label macro inline replacement entity line-continuation"),a.title.inside.rest=i("macro inline replacement entity"),t.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))}),t.languages.adoc=t.languages.asciidoc}(Prism); |
|||
@ -0,0 +1,28 @@ |
|||
Prism.languages.asm6502 = { |
|||
'comment': /;.*/, |
|||
'directive': { |
|||
pattern: /\.\w+(?= )/, |
|||
alias: 'keyword' |
|||
}, |
|||
'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/, |
|||
'opcode': { |
|||
pattern: /\b(?:adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya|ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\b/, |
|||
alias: 'property' |
|||
}, |
|||
'hexnumber': { |
|||
pattern: /#?\$[\da-f]{2,4}/i, |
|||
alias: 'string' |
|||
}, |
|||
'binarynumber': { |
|||
pattern: /#?%[01]+/, |
|||
alias: 'string' |
|||
}, |
|||
'decimalnumber': { |
|||
pattern: /#?\d+/, |
|||
alias: 'string' |
|||
}, |
|||
'register': { |
|||
pattern: /\b[xya]\b/i, |
|||
alias: 'variable' |
|||
} |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.asm6502={comment:/;.*/,directive:{pattern:/\.\w+(?= )/,alias:"keyword"},string:/(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,opcode:{pattern:/\b(?:adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya|ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\b/,alias:"property"},hexnumber:{pattern:/#?\$[\da-f]{2,4}/i,alias:"string"},binarynumber:{pattern:/#?%[01]+/,alias:"string"},decimalnumber:{pattern:/#?\d+/,alias:"string"},register:{pattern:/\b[xya]\b/i,alias:"variable"}}; |
|||
@ -0,0 +1,48 @@ |
|||
Prism.languages.aspnet = Prism.languages.extend('markup', { |
|||
'page-directive': { |
|||
pattern: /<%\s*@.*%>/i, |
|||
alias: 'tag', |
|||
inside: { |
|||
'page-directive': { |
|||
pattern: /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i, |
|||
alias: 'tag' |
|||
}, |
|||
rest: Prism.languages.markup.tag.inside |
|||
} |
|||
}, |
|||
'directive': { |
|||
pattern: /<%.*%>/i, |
|||
alias: 'tag', |
|||
inside: { |
|||
'directive': { |
|||
pattern: /<%\s*?[$=%#:]{0,2}|%>/i, |
|||
alias: 'tag' |
|||
}, |
|||
rest: Prism.languages.csharp |
|||
} |
|||
} |
|||
}); |
|||
// Regexp copied from prism-markup, with a negative look-ahead added
|
|||
Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i; |
|||
|
|||
// match directives of attribute value foo="<% Bar %>"
|
|||
Prism.languages.insertBefore('inside', 'punctuation', { |
|||
'directive': Prism.languages.aspnet['directive'] |
|||
}, Prism.languages.aspnet.tag.inside["attr-value"]); |
|||
|
|||
Prism.languages.insertBefore('aspnet', 'comment', { |
|||
'asp-comment': { |
|||
pattern: /<%--[\s\S]*?--%>/, |
|||
alias: ['asp', 'comment'] |
|||
} |
|||
}); |
|||
|
|||
// script runat="server" contains csharp, not javascript
|
|||
Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', { |
|||
'asp-script': { |
|||
pattern: /(<script(?=.*runat=['"]?server['"]?)[\s\S]*?>)[\s\S]*?(?=<\/script>)/i, |
|||
lookbehind: true, |
|||
alias: ['asp', 'script'], |
|||
inside: Prism.languages.csharp || {} |
|||
} |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.aspnet=Prism.languages.extend("markup",{"page-directive":{pattern:/<%\s*@.*%>/i,alias:"tag",inside:{"page-directive":{pattern:/<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,alias:"tag"},rest:Prism.languages.markup.tag.inside}},directive:{pattern:/<%.*%>/i,alias:"tag",inside:{directive:{pattern:/<%\s*?[$=%#:]{0,2}|%>/i,alias:"tag"},rest:Prism.languages.csharp}}}),Prism.languages.aspnet.tag.pattern=/<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,Prism.languages.insertBefore("inside","punctuation",{directive:Prism.languages.aspnet.directive},Prism.languages.aspnet.tag.inside["attr-value"]),Prism.languages.insertBefore("aspnet","comment",{"asp-comment":{pattern:/<%--[\s\S]*?--%>/,alias:["asp","comment"]}}),Prism.languages.insertBefore("aspnet",Prism.languages.javascript?"script":"tag",{"asp-script":{pattern:/(<script(?=.*runat=['"]?server['"]?)[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,lookbehind:!0,alias:["asp","script"],inside:Prism.languages.csharp||{}}}); |
|||
@ -0,0 +1,27 @@ |
|||
// NOTES - follows first-first highlight method, block is locked after highlight, different from SyntaxHl
|
|||
Prism.languages.autohotkey= { |
|||
'comment': { |
|||
pattern: /(^[^";\n]*(?:"[^"\n]*?"[^"\n]*?)*)(?:;.*$|^\s*\/\*[\s\S]*\n\*\/)/m, |
|||
lookbehind: true |
|||
}, |
|||
'string': /"(?:[^"\n\r]|"")*"/m, |
|||
'function': /[^(); \t,\n+*\-=?>:\\\/<&%\[\]]+?(?=\()/m, //function - don't use .*\) in the end bcoz string locks it
|
|||
'tag': /^[ \t]*[^\s:]+?(?=:(?:[^:]|$))/m, //labels
|
|||
'variable': /%\w+%/, |
|||
'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/, |
|||
'operator': /\?|\/\/?=?|:=|\|[=|]?|&[=&]?|\+[=+]?|-[=-]?|\*[=*]?|<(?:<=?|>|=)?|>>?=?|[.^!=~]=?|\b(?:AND|NOT|OR)\b/, |
|||
'punctuation': /[{}[\]():,]/, |
|||
'boolean': /\b(?:true|false)\b/, |
|||
|
|||
'selector': /\b(?:AutoTrim|BlockInput|Break|Click|ClipWait|Continue|Control|ControlClick|ControlFocus|ControlGet|ControlGetFocus|ControlGetPos|ControlGetText|ControlMove|ControlSend|ControlSendRaw|ControlSetText|CoordMode|Critical|DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|DriveSpaceFree|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|FileDelete|FileEncoding|FileGetAttrib|FileGetShortcut|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|GuiControlGet|Hotkey|ImageSearch|IniDelete|IniRead|IniWrite|Input|InputBox|KeyWait|ListHotkeys|ListLines|ListVars|Loop|Menu|MouseClick|MouseClickDrag|MouseGetPos|MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|PixelSearch|PostMessage|Process|Progress|Random|RegDelete|RegRead|RegWrite|Reload|Repeat|Return|Run|RunAs|RunWait|Send|SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|SetBatchLines|SetCapslockState|SetControlDelay|SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|SetMouseDelay|SetNumlockState|SetScrollLockState|SetStoreCapslockMode|SetTimer|SetTitleMatchMode|SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|StringGetPos|StringLeft|StringLen|StringLower|StringMid|StringReplace|StringRight|StringSplit|StringTrimLeft|StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|Transform|TrayTip|URLDownloadToFile|WinActivate|WinActivateBottom|WinClose|WinGet|WinGetActiveStats|WinGetActiveTitle|WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinHide|WinKill|WinMaximize|WinMenuSelectItem|WinMinimize|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinRestore|WinSet|WinSetTitle|WinShow|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/i, |
|||
|
|||
'constant': /\b(?:a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_isunicode|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\b/i, |
|||
|
|||
'builtin': /\b(?:abs|acos|asc|asin|atan|ceil|chr|class|cos|dllcall|exp|fileexist|Fileopen|floor|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|IsObject|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|strsplit|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist|__New|__Call|__Get|__Set)\b/i, |
|||
|
|||
'symbol': /\b(?:alt|altdown|altup|appskey|backspace|browser_back|browser_favorites|browser_forward|browser_home|browser_refresh|browser_search|browser_stop|bs|capslock|ctrl|ctrlbreak|ctrldown|ctrlup|del|delete|down|end|enter|esc|escape|f1|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f2|f20|f21|f22|f23|f24|f3|f4|f5|f6|f7|f8|f9|home|ins|insert|joy1|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy2|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy3|joy30|joy31|joy32|joy4|joy5|joy6|joy7|joy8|joy9|joyaxes|joybuttons|joyinfo|joyname|joypov|joyr|joyu|joyv|joyx|joyy|joyz|lalt|launch_app1|launch_app2|launch_mail|launch_media|lbutton|lcontrol|lctrl|left|lshift|lwin|lwindown|lwinup|mbutton|media_next|media_play_pause|media_prev|media_stop|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadadd|numpadclear|numpaddel|numpaddiv|numpaddot|numpaddown|numpadend|numpadenter|numpadhome|numpadins|numpadleft|numpadmult|numpadpgdn|numpadpgup|numpadright|numpadsub|numpadup|pgdn|pgup|printscreen|ralt|rbutton|rcontrol|rctrl|right|rshift|rwin|rwindown|rwinup|scrolllock|shift|shiftdown|shiftup|space|tab|up|volume_down|volume_mute|volume_up|wheeldown|wheelleft|wheelright|wheelup|xbutton1|xbutton2)\b/i, |
|||
|
|||
'important': /#\b(?:AllowSameLineComments|ClipboardTimeout|CommentFlag|ErrorStdOut|EscapeChar|HotkeyInterval|HotkeyModifierTimeout|Hotstring|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Include|IncludeAgain|InstallKeybdHook|InstallMouseHook|KeyHistory|LTrim|MaxHotkeysPerInterval|MaxMem|MaxThreads|MaxThreadsBuffer|MaxThreadsPerHotkey|NoEnv|NoTrayIcon|Persistent|SingleInstance|UseHook|WinActivateForce)\b/i, |
|||
|
|||
'keyword': /\b(?:Abort|AboveNormal|Add|ahk_class|ahk_group|ahk_id|ahk_pid|All|Alnum|Alpha|AltSubmit|AltTab|AltTabAndMenu|AltTabMenu|AltTabMenuDismiss|AlwaysOnTop|AutoSize|Background|BackgroundTrans|BelowNormal|between|BitAnd|BitNot|BitOr|BitShiftLeft|BitShiftRight|BitXOr|Bold|Border|Button|ByRef|Checkbox|Checked|CheckedGray|Choose|ChooseString|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|Expand|ExStyle|FileSystem|First|Flash|Float|FloatFast|Focus|Font|for|global|Grid|Group|GroupBox|GuiClose|GuiContextMenu|GuiDropFiles|GuiEscape|GuiSize|Hdr|Hidden|Hide|High|HKCC|HKCR|HKCU|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKLM|HKU|Hours|HScroll|Icon|IconSmall|ID|IDLast|If|IfEqual|IfExist|IfGreater|IfGreaterOrEqual|IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Ignore|ImageList|in|Integer|IntegerFast|Interrupt|is|italic|Join|Label|LastFound|LastFoundExist|Limit|Lines|List|ListBox|ListView|local|Lock|Logoff|Low|Lower|Lowercase|MainWindow|Margin|Maximize|MaximizeBox|MaxSize|Minimize|MinimizeBox|MinMax|MinSize|Minutes|MonthCal|Mouse|Move|Multi|NA|No|NoActivate|NoDefault|NoHide|NoIcon|NoMainWindow|norm|Normal|NoSort|NoSortHdr|NoStandard|Not|NoTab|NoTimers|Number|Off|Ok|On|OwnDialogs|Owner|Parse|Password|Picture|Pixel|Pos|Pow|Priority|ProcessName|Radio|Range|Read|ReadOnly|Realtime|Redraw|REG_BINARY|REG_DWORD|REG_EXPAND_SZ|REG_MULTI_SZ|REG_SZ|Region|Relative|Rename|Report|Resize|Restore|Retry|RGB|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|Tab2|TabStop|Text|Theme|Tile|ToggleCheck|ToggleEnable|ToolWindow|Top|Topmost|TransColor|Transparent|Tray|TreeView|TryAgain|Type|UnCheck|underline|Unicode|Unlock|UpDown|Upper|Uppercase|UseErrorLevel|Vis|VisFirst|Visible|VScroll|Wait|WaitClose|WantCtrlA|WantF2|WantReturn|While|Wrap|Xdigit|xm|xp|xs|Yes|ym|yp|ys)\b/i |
|||
}; |
|||
File diff suppressed because one or more lines are too long
@ -0,0 +1,34 @@ |
|||
Prism.languages.autoit = { |
|||
"comment": [ |
|||
/;.*/, |
|||
{ |
|||
// The multi-line comments delimiters can actually be commented out with ";"
|
|||
pattern: /(^\s*)#(?:comments-start|cs)[\s\S]*?^\s*#(?:comments-end|ce)/m, |
|||
lookbehind: true |
|||
} |
|||
], |
|||
"url": { |
|||
pattern: /(^\s*#include\s+)(?:<[^\r\n>]+>|"[^\r\n"]+")/m, |
|||
lookbehind: true |
|||
}, |
|||
"string": { |
|||
pattern: /(["'])(?:\1\1|(?!\1)[^\r\n])*\1/, |
|||
greedy: true, |
|||
inside: { |
|||
"variable": /([%$@])\w+\1/ |
|||
} |
|||
}, |
|||
"directive": { |
|||
pattern: /(^\s*)#\w+/m, |
|||
lookbehind: true, |
|||
alias: 'keyword' |
|||
}, |
|||
"function": /\b\w+(?=\()/, |
|||
// Variables and macros
|
|||
"variable": /[$@]\w+/, |
|||
"keyword": /\b(?:Case|Const|Continue(?:Case|Loop)|Default|Dim|Do|Else(?:If)?|End(?:Func|If|Select|Switch|With)|Enum|Exit(?:Loop)?|For|Func|Global|If|In|Local|Next|Null|ReDim|Select|Static|Step|Switch|Then|To|Until|Volatile|WEnd|While|With)\b/i, |
|||
"number": /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i, |
|||
"boolean": /\b(?:True|False)\b/i, |
|||
"operator": /<[=>]?|[-+*\/=&>]=?|[?^]|\b(?:And|Or|Not)\b/i, |
|||
"punctuation": /[\[\]().,:]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.autoit={comment:[/;.*/,{pattern:/(^\s*)#(?:comments-start|cs)[\s\S]*?^\s*#(?:comments-end|ce)/m,lookbehind:!0}],url:{pattern:/(^\s*#include\s+)(?:<[^\r\n>]+>|"[^\r\n"]+")/m,lookbehind:!0},string:{pattern:/(["'])(?:\1\1|(?!\1)[^\r\n])*\1/,greedy:!0,inside:{variable:/([%$@])\w+\1/}},directive:{pattern:/(^\s*)#\w+/m,lookbehind:!0,alias:"keyword"},function:/\b\w+(?=\()/,variable:/[$@]\w+/,keyword:/\b(?:Case|Const|Continue(?:Case|Loop)|Default|Dim|Do|Else(?:If)?|End(?:Func|If|Select|Switch|With)|Enum|Exit(?:Loop)?|For|Func|Global|If|In|Local|Next|Null|ReDim|Select|Static|Step|Switch|Then|To|Until|Volatile|WEnd|While|With)\b/i,number:/\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i,boolean:/\b(?:True|False)\b/i,operator:/<[=>]?|[-+*\/=&>]=?|[?^]|\b(?:And|Or|Not)\b/i,punctuation:/[\[\]().,:]/}; |
|||
@ -0,0 +1,198 @@ |
|||
(function(Prism) { |
|||
// $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
|
|||
// + LC_ALL, RANDOM, REPLY, SECONDS.
|
|||
// + make sure PS1..4 are here as they are not always set,
|
|||
// - some useless things.
|
|||
var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b'; |
|||
var insideString = { |
|||
'environment': { |
|||
pattern: RegExp("\\$" + envVars), |
|||
alias: 'constant' |
|||
}, |
|||
'variable': [ |
|||
// [0]: Arithmetic Environment
|
|||
{ |
|||
pattern: /\$?\(\([\s\S]+?\)\)/, |
|||
greedy: true, |
|||
inside: { |
|||
// If there is a $ sign at the beginning highlight $(( and )) as variable
|
|||
'variable': [ |
|||
{ |
|||
pattern: /(^\$\(\([\s\S]+)\)\)/, |
|||
lookbehind: true |
|||
}, |
|||
/^\$\(\(/ |
|||
], |
|||
'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/, |
|||
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
|
|||
'operator': /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/, |
|||
// If there is no $ sign at the beginning highlight (( and )) as punctuation
|
|||
'punctuation': /\(\(?|\)\)?|,|;/ |
|||
} |
|||
}, |
|||
// [1]: Command Substitution
|
|||
{ |
|||
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/, |
|||
greedy: true, |
|||
inside: { |
|||
'variable': /^\$\(|^`|\)$|`$/ |
|||
} |
|||
}, |
|||
// [2]: Brace expansion
|
|||
{ |
|||
pattern: /\$\{[^}]+\}/, |
|||
greedy: true, |
|||
inside: { |
|||
'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/, |
|||
'punctuation': /[\[\]]/, |
|||
'environment': { |
|||
pattern: RegExp("(\\{)" + envVars), |
|||
lookbehind: true, |
|||
alias: 'constant' |
|||
} |
|||
} |
|||
}, |
|||
/\$(?:\w+|[#?*!@$])/ |
|||
], |
|||
// Escape sequences from echo and printf's manuals, and escaped quotes.
|
|||
'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/ |
|||
}; |
|||
|
|||
Prism.languages.bash = { |
|||
'shebang': { |
|||
pattern: /^#!\s*\/.*/, |
|||
alias: 'important' |
|||
}, |
|||
'comment': { |
|||
pattern: /(^|[^"{\\$])#.*/, |
|||
lookbehind: true |
|||
}, |
|||
'function-name': [ |
|||
// a) function foo {
|
|||
// b) foo() {
|
|||
// c) function foo() {
|
|||
// but not “foo {”
|
|||
{ |
|||
// a) and c)
|
|||
pattern: /(\bfunction\s+)\w+(?=(?:\s*\(?:\s*\))?\s*\{)/, |
|||
lookbehind: true, |
|||
alias: 'function' |
|||
}, |
|||
{ |
|||
// b)
|
|||
pattern: /\b\w+(?=\s*\(\s*\)\s*\{)/, |
|||
alias: 'function' |
|||
} |
|||
], |
|||
// Highlight variable names as variables in for and select beginnings.
|
|||
'for-or-select': { |
|||
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/, |
|||
alias: 'variable', |
|||
lookbehind: true |
|||
}, |
|||
// Highlight variable names as variables in the left-hand part
|
|||
// of assignments (“=” and “+=”).
|
|||
'assign-left': { |
|||
pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/, |
|||
inside: { |
|||
'environment': { |
|||
pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars), |
|||
lookbehind: true, |
|||
alias: 'constant' |
|||
} |
|||
}, |
|||
alias: 'variable', |
|||
lookbehind: true |
|||
}, |
|||
'string': [ |
|||
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
|
|||
{ |
|||
pattern: /((?:^|[^<])<<-?\s*)(\w+?)\s*(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\2/, |
|||
lookbehind: true, |
|||
greedy: true, |
|||
inside: insideString |
|||
}, |
|||
// Here-document with quotes around the tag
|
|||
// → No expansion (so no “inside”).
|
|||
{ |
|||
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s*(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\3/, |
|||
lookbehind: true, |
|||
greedy: true |
|||
}, |
|||
// “Normal” string
|
|||
{ |
|||
pattern: /(^|[^\\](?:\\\\)*)(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\2)[^\\])*\2/, |
|||
lookbehind: true, |
|||
greedy: true, |
|||
inside: insideString |
|||
} |
|||
], |
|||
'environment': { |
|||
pattern: RegExp("\\$?" + envVars), |
|||
alias: 'constant' |
|||
}, |
|||
'variable': insideString.variable, |
|||
'function': { |
|||
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/, |
|||
lookbehind: true |
|||
}, |
|||
'keyword': { |
|||
pattern: /(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/, |
|||
lookbehind: true |
|||
}, |
|||
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
|||
'builtin': { |
|||
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/, |
|||
lookbehind: true, |
|||
// Alias added to make those easier to distinguish from strings.
|
|||
alias: 'class-name' |
|||
}, |
|||
'boolean': { |
|||
pattern: /(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/, |
|||
lookbehind: true |
|||
}, |
|||
'file-descriptor': { |
|||
pattern: /\B&\d\b/, |
|||
alias: 'important' |
|||
}, |
|||
'operator': { |
|||
// Lots of redirections here, but not just that.
|
|||
pattern: /\d?<>|>\||\+=|==?|!=?|=~|<<[<-]?|[&\d]?>>|\d?[<>]&?|&[>&]?|\|[&|]?|<=?|>=?/, |
|||
inside: { |
|||
'file-descriptor': { |
|||
pattern: /^\d/, |
|||
alias: 'important' |
|||
} |
|||
} |
|||
}, |
|||
'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/, |
|||
'number': { |
|||
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/, |
|||
lookbehind: true |
|||
} |
|||
}; |
|||
|
|||
/* Patterns in command substitution. */ |
|||
var toBeCopied = [ |
|||
'comment', |
|||
'function-name', |
|||
'for-or-select', |
|||
'assign-left', |
|||
'string', |
|||
'environment', |
|||
'function', |
|||
'keyword', |
|||
'builtin', |
|||
'boolean', |
|||
'file-descriptor', |
|||
'operator', |
|||
'punctuation', |
|||
'number' |
|||
]; |
|||
var inside = insideString.variable[1].inside; |
|||
for(var i = 0; i < toBeCopied.length; i++) { |
|||
inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]]; |
|||
} |
|||
|
|||
Prism.languages.shell = Prism.languages.bash; |
|||
})(Prism); |
|||
File diff suppressed because one or more lines are too long
@ -0,0 +1,17 @@ |
|||
Prism.languages.basic = { |
|||
'comment': { |
|||
pattern: /(?:!|REM\b).+/i, |
|||
inside: { |
|||
'keyword': /^REM/i |
|||
} |
|||
}, |
|||
'string': { |
|||
pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i, |
|||
greedy: true |
|||
}, |
|||
'number': /(?:\b\d+\.?\d*|\B\.\d+)(?:E[+-]?\d+)?/i, |
|||
'keyword': /\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SHARED|SINGLE|SELECT CASE|SHELL|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i, |
|||
'function': /\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i, |
|||
'operator': /<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i, |
|||
'punctuation': /[,;:()]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^_ +\-.A-Z\d])*"/i,greedy:!0},number:/(?:\b\d+\.?\d*|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SHARED|SINGLE|SELECT CASE|SHELL|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}; |
|||
@ -0,0 +1,99 @@ |
|||
(function (Prism) { |
|||
var variable = /%%?[~:\w]+%?|!\S+!/; |
|||
var parameter = { |
|||
pattern: /\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im, |
|||
alias: 'attr-name', |
|||
inside: { |
|||
'punctuation': /:/ |
|||
} |
|||
}; |
|||
var string = /"[^"]*"/; |
|||
var number = /(?:\b|-)\d+\b/; |
|||
|
|||
Prism.languages.batch = { |
|||
'comment': [ |
|||
/^::.*/m, |
|||
{ |
|||
pattern: /((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im, |
|||
lookbehind: true |
|||
} |
|||
], |
|||
'label': { |
|||
pattern: /^:.*/m, |
|||
alias: 'property' |
|||
}, |
|||
'command': [ |
|||
{ |
|||
// FOR command
|
|||
pattern: /((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* \S+ in \([^)]+\) do/im, |
|||
lookbehind: true, |
|||
inside: { |
|||
'keyword': /^for\b|\b(?:in|do)\b/i, |
|||
'string': string, |
|||
'parameter': parameter, |
|||
'variable': variable, |
|||
'number': number, |
|||
'punctuation': /[()',]/ |
|||
} |
|||
}, |
|||
{ |
|||
// IF command
|
|||
pattern: /((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|\S+)?(?:==| (?:equ|neq|lss|leq|gtr|geq) )(?:"[^"]*"|\S+))/im, |
|||
lookbehind: true, |
|||
inside: { |
|||
'keyword': /^if\b|\b(?:not|cmdextversion|defined|errorlevel|exist)\b/i, |
|||
'string': string, |
|||
'parameter': parameter, |
|||
'variable': variable, |
|||
'number': number, |
|||
'operator': /\^|==|\b(?:equ|neq|lss|leq|gtr|geq)\b/i |
|||
} |
|||
}, |
|||
{ |
|||
// ELSE command
|
|||
pattern: /((?:^|[&()])[ \t]*)else\b/im, |
|||
lookbehind: true, |
|||
inside: { |
|||
'keyword': /^else\b/i |
|||
} |
|||
}, |
|||
{ |
|||
// SET command
|
|||
pattern: /((?:^|[&(])[ \t]*)set(?: ?\/[a-z](?:[ :](?:"[^"]*"|\S+))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im, |
|||
lookbehind: true, |
|||
inside: { |
|||
'keyword': /^set\b/i, |
|||
'string': string, |
|||
'parameter': parameter, |
|||
'variable': [ |
|||
variable, |
|||
/\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/ |
|||
], |
|||
'number': number, |
|||
'operator': /[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/, |
|||
'punctuation': /[()',]/ |
|||
} |
|||
}, |
|||
{ |
|||
// Other commands
|
|||
pattern: /((?:^|[&(])[ \t]*@?)\w+\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im, |
|||
lookbehind: true, |
|||
inside: { |
|||
'keyword': /^\w+\b/i, |
|||
'string': string, |
|||
'parameter': parameter, |
|||
'label': { |
|||
pattern: /(^\s*):\S+/m, |
|||
lookbehind: true, |
|||
alias: 'property' |
|||
}, |
|||
'variable': variable, |
|||
'number': number, |
|||
'operator': /\^/ |
|||
} |
|||
} |
|||
], |
|||
'operator': /[&@]/, |
|||
'punctuation': /[()']/ |
|||
}; |
|||
}(Prism)); |
|||
@ -0,0 +1 @@ |
|||
!function(e){var r=/%%?[~:\w]+%?|!\S+!/,t={pattern:/\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,alias:"attr-name",inside:{punctuation:/:/}},n=/"[^"]*"/,i=/(?:\b|-)\d+\b/;Prism.languages.batch={comment:[/^::.*/m,{pattern:/((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,lookbehind:!0}],label:{pattern:/^:.*/m,alias:"property"},command:[{pattern:/((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* \S+ in \([^)]+\) do/im,lookbehind:!0,inside:{keyword:/^for\b|\b(?:in|do)\b/i,string:n,parameter:t,variable:r,number:i,punctuation:/[()',]/}},{pattern:/((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|\S+)?(?:==| (?:equ|neq|lss|leq|gtr|geq) )(?:"[^"]*"|\S+))/im,lookbehind:!0,inside:{keyword:/^if\b|\b(?:not|cmdextversion|defined|errorlevel|exist)\b/i,string:n,parameter:t,variable:r,number:i,operator:/\^|==|\b(?:equ|neq|lss|leq|gtr|geq)\b/i}},{pattern:/((?:^|[&()])[ \t]*)else\b/im,lookbehind:!0,inside:{keyword:/^else\b/i}},{pattern:/((?:^|[&(])[ \t]*)set(?: ?\/[a-z](?:[ :](?:"[^"]*"|\S+))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,lookbehind:!0,inside:{keyword:/^set\b/i,string:n,parameter:t,variable:[r,/\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/],number:i,operator:/[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/,punctuation:/[()',]/}},{pattern:/((?:^|[&(])[ \t]*@?)\w+\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,lookbehind:!0,inside:{keyword:/^\w+\b/i,string:n,parameter:t,label:{pattern:/(^\s*):\S+/m,lookbehind:!0,alias:"property"},variable:r,number:i,operator:/\^/}}],operator:/[&@]/,punctuation:/[()']/}}(); |
|||
@ -0,0 +1,29 @@ |
|||
Prism.languages.bbcode = { |
|||
'tag': { |
|||
pattern: /\[\/?[^\s=\]]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))?(?:\s+[^\s=\]]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))*\s*\]/, |
|||
inside: { |
|||
'tag': { |
|||
pattern: /^\[\/?[^\s=\]]+/, |
|||
inside: { |
|||
'punctuation': /^\[\/?/ |
|||
} |
|||
}, |
|||
'attr-value': { |
|||
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+)/i, |
|||
inside: { |
|||
'punctuation': [ |
|||
/^=/, |
|||
{ |
|||
pattern: /^(\s*)["']|["']$/, |
|||
lookbehind: true |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
'punctuation': /\]/, |
|||
'attr-name': /[^\s=\]]+/ |
|||
} |
|||
} |
|||
}; |
|||
|
|||
Prism.languages.shortcode = Prism.languages.bbcode; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.bbcode={tag:{pattern:/\[\/?[^\s=\]]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))?(?:\s+[^\s=\]]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+))*\s*\]/,inside:{tag:{pattern:/^\[\/?[^\s=\]]+/,inside:{punctuation:/^\[\/?/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'"\]=]+)/i,inside:{punctuation:[/^=/,{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\]/,"attr-name":/[^\s=\]]+/}}},Prism.languages.shortcode=Prism.languages.bbcode; |
|||
@ -0,0 +1,39 @@ |
|||
Prism.languages.bison = Prism.languages.extend('c', {}); |
|||
|
|||
Prism.languages.insertBefore('bison', 'comment', { |
|||
'bison': { |
|||
// This should match all the beginning of the file
|
|||
// including the prologue(s), the bison declarations and
|
|||
// the grammar rules.
|
|||
pattern: /^[\s\S]*?%%[\s\S]*?%%/, |
|||
inside: { |
|||
'c': { |
|||
// Allow for one level of nested braces
|
|||
pattern: /%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/, |
|||
inside: { |
|||
'delimiter': { |
|||
pattern: /^%?\{|%?\}$/, |
|||
alias: 'punctuation' |
|||
}, |
|||
'bison-variable': { |
|||
pattern: /[$@](?:<[^\s>]+>)?[\w$]+/, |
|||
alias: 'variable', |
|||
inside: { |
|||
'punctuation': /<|>/ |
|||
} |
|||
}, |
|||
rest: Prism.languages.c |
|||
} |
|||
}, |
|||
'comment': Prism.languages.c.comment, |
|||
'string': Prism.languages.c.string, |
|||
'property': /\S+(?=:)/, |
|||
'keyword': /%\w+/, |
|||
'number': { |
|||
pattern: /(^|[^@])\b(?:0x[\da-f]+|\d+)/i, |
|||
lookbehind: true |
|||
}, |
|||
'punctuation': /%[%?]|[|:;\[\]<>]/ |
|||
} |
|||
} |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.bison=Prism.languages.extend("c",{}),Prism.languages.insertBefore("bison","comment",{bison:{pattern:/^[\s\S]*?%%[\s\S]*?%%/,inside:{c:{pattern:/%\{[\s\S]*?%\}|\{(?:\{[^}]*\}|[^{}])*\}/,inside:{delimiter:{pattern:/^%?\{|%?\}$/,alias:"punctuation"},"bison-variable":{pattern:/[$@](?:<[^\s>]+>)?[\w$]+/,alias:"variable",inside:{punctuation:/<|>/}},rest:Prism.languages.c}},comment:Prism.languages.c.comment,string:Prism.languages.c.string,property:/\S+(?=:)/,keyword:/%\w+/,number:{pattern:/(^|[^@])\b(?:0x[\da-f]+|\d+)/i,lookbehind:!0},punctuation:/%[%?]|[|:;\[\]<>]/}}}); |
|||
@ -0,0 +1,21 @@ |
|||
Prism.languages.bnf = { |
|||
'string': { |
|||
pattern: /"[^\r\n"]*"|'[^\r\n']*'/ |
|||
}, |
|||
'definition': { |
|||
pattern: /<[^<>\r\n\t]+>(?=\s*::=)/, |
|||
alias: ['rule', 'keyword'], |
|||
inside: { |
|||
'punctuation': /^<|>$/ |
|||
} |
|||
}, |
|||
'rule': { |
|||
pattern: /<[^<>\r\n\t]+>/, |
|||
inside: { |
|||
'punctuation': /^<|>$/ |
|||
} |
|||
}, |
|||
'operator': /::=|[|()[\]{}*+?]|\.{3}/ |
|||
}; |
|||
|
|||
Prism.languages.rbnf = Prism.languages.bnf; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.bnf={string:{pattern:/"[^\r\n"]*"|'[^\r\n']*'/},definition:{pattern:/<[^<>\r\n\t]+>(?=\s*::=)/,alias:["rule","keyword"],inside:{punctuation:/^<|>$/}},rule:{pattern:/<[^<>\r\n\t]+>/,inside:{punctuation:/^<|>$/}},operator:/::=|[|()[\]{}*+?]|\.{3}/},Prism.languages.rbnf=Prism.languages.bnf; |
|||
@ -0,0 +1,20 @@ |
|||
Prism.languages.brainfuck = { |
|||
'pointer': { |
|||
pattern: /<|>/, |
|||
alias: 'keyword' |
|||
}, |
|||
'increment': { |
|||
pattern: /\+/, |
|||
alias: 'inserted' |
|||
}, |
|||
'decrement': { |
|||
pattern: /-/, |
|||
alias: 'deleted' |
|||
}, |
|||
'branching': { |
|||
pattern: /\[|\]/, |
|||
alias: 'important' |
|||
}, |
|||
'operator': /[.,]/, |
|||
'comment': /\S+/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.brainfuck={pointer:{pattern:/<|>/,alias:"keyword"},increment:{pattern:/\+/,alias:"inserted"},decrement:{pattern:/-/,alias:"deleted"},branching:{pattern:/\[|\]/,alias:"important"},operator:/[.,]/,comment:/\S+/}; |
|||
@ -0,0 +1,44 @@ |
|||
Prism.languages.brightscript = { |
|||
'comment': /(?:\brem|').*/i, |
|||
'directive-statement': { |
|||
pattern: /(^[\t ]*)#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if).*/im, |
|||
lookbehind: true, |
|||
alias: 'property', |
|||
inside: { |
|||
'error-message': { |
|||
pattern: /(^#error).+/, |
|||
lookbehind: true |
|||
}, |
|||
'directive': { |
|||
pattern: /^#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if)/, |
|||
alias: 'keyword' |
|||
}, |
|||
'expression': { |
|||
pattern: /[\s\S]+/, |
|||
inside: null // see below
|
|||
} |
|||
} |
|||
}, |
|||
'property': { |
|||
pattern: /([\r\n{,][\t ]*)(?:(?!\d)\w+|"(?:[^"\r\n]|"")*"(?!"))(?=[ \t]*:)/, |
|||
lookbehind: true, |
|||
greedy: true |
|||
}, |
|||
'string': { |
|||
pattern: /"(?:[^"\r\n]|"")*"(?!")/, |
|||
greedy: true |
|||
}, |
|||
'class-name': { |
|||
pattern: /(\bAs[\t ]+)\w+/i, |
|||
lookbehind: true |
|||
}, |
|||
'keyword': /\b(?:As|Dim|Each|Else|Elseif|End|Exit|For|Function|Goto|If|In|Print|Return|Step|Stop|Sub|Then|To|While)\b/i, |
|||
'boolean': /\b(?:true|false)\b/i, |
|||
'function': /\b(?!\d)\w+(?=[\t ]*\()/i, |
|||
'number': /(?:\b\d+(?:\.\d+)?(?:[ed][+-]\d+)?|&h[a-f\d]+)\b[%&!#]?/i, |
|||
'operator': /--|\+\+|>>=?|<<=?|<>|[-+*/\\<>]=?|[:^=?]|\b(?:and|mod|not|or)\b/i, |
|||
'punctuation': /[.,;()[\]{}]/, |
|||
'constant': /\b(?:LINE_NUM)\b/i |
|||
}; |
|||
|
|||
Prism.languages.brightscript['directive-statement'].inside.expression.inside = Prism.languages.brightscript; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.brightscript={comment:/(?:\brem|').*/i,"directive-statement":{pattern:/(^[\t ]*)#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if).*/im,lookbehind:!0,alias:"property",inside:{"error-message":{pattern:/(^#error).+/,lookbehind:!0},directive:{pattern:/^#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if)/,alias:"keyword"},expression:{pattern:/[\s\S]+/,inside:null}}},property:{pattern:/([\r\n{,][\t ]*)(?:(?!\d)\w+|"(?:[^"\r\n]|"")*"(?!"))(?=[ \t]*:)/,lookbehind:!0,greedy:!0},string:{pattern:/"(?:[^"\r\n]|"")*"(?!")/,greedy:!0},"class-name":{pattern:/(\bAs[\t ]+)\w+/i,lookbehind:!0},keyword:/\b(?:As|Dim|Each|Else|Elseif|End|Exit|For|Function|Goto|If|In|Print|Return|Step|Stop|Sub|Then|To|While)\b/i,boolean:/\b(?:true|false)\b/i,function:/\b(?!\d)\w+(?=[\t ]*\()/i,number:/(?:\b\d+(?:\.\d+)?(?:[ed][+-]\d+)?|&h[a-f\d]+)\b[%&!#]?/i,operator:/--|\+\+|>>=?|<<=?|<>|[-+*/\\<>]=?|[:^=?]|\b(?:and|mod|not|or)\b/i,punctuation:/[.,;()[\]{}]/,constant:/\b(?:LINE_NUM)\b/i},Prism.languages.brightscript["directive-statement"].inside.expression.inside=Prism.languages.brightscript; |
|||
@ -0,0 +1,48 @@ |
|||
Prism.languages.bro = { |
|||
|
|||
'comment': { |
|||
pattern: /(^|[^\\$])#.*/, |
|||
lookbehind: true, |
|||
inside: { |
|||
'italic': /\b(?:TODO|FIXME|XXX)\b/ |
|||
} |
|||
}, |
|||
|
|||
'string': { |
|||
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, |
|||
greedy: true |
|||
}, |
|||
|
|||
'boolean': /\b[TF]\b/, |
|||
|
|||
'function': { |
|||
pattern: /(?:function|hook|event) \w+(?:::\w+)?/, |
|||
inside: { |
|||
keyword: /^(?:function|hook|event)/ |
|||
} |
|||
}, |
|||
|
|||
'variable': { |
|||
pattern: /(?:global|local) \w+/i, |
|||
inside: { |
|||
keyword: /(?:global|local)/ |
|||
} |
|||
}, |
|||
|
|||
'builtin': /(?:@(?:load(?:-(?:sigs|plugin))?|unload|prefixes|ifn?def|else|(?:end)?if|DIR|FILENAME))|(?:&?(?:redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|group|error_handler|type_column))/, |
|||
|
|||
'constant': { |
|||
pattern: /const \w+/i, |
|||
inside: { |
|||
keyword: /const/ |
|||
} |
|||
}, |
|||
|
|||
'keyword': /\b(?:break|next|continue|alarm|using|of|add|delete|export|print|return|schedule|when|timeout|addr|any|bool|count|double|enum|file|int|interval|pattern|opaque|port|record|set|string|subnet|table|time|vector|for|if|else|in|module|function)\b/, |
|||
|
|||
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/, |
|||
|
|||
'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, |
|||
|
|||
'punctuation': /[{}[\];(),.:]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.bro={comment:{pattern:/(^|[^\\$])#.*/,lookbehind:!0,inside:{italic:/\b(?:TODO|FIXME|XXX)\b/}},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},boolean:/\b[TF]\b/,function:{pattern:/(?:function|hook|event) \w+(?:::\w+)?/,inside:{keyword:/^(?:function|hook|event)/}},variable:{pattern:/(?:global|local) \w+/i,inside:{keyword:/(?:global|local)/}},builtin:/(?:@(?:load(?:-(?:sigs|plugin))?|unload|prefixes|ifn?def|else|(?:end)?if|DIR|FILENAME))|(?:&?(?:redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|group|error_handler|type_column))/,constant:{pattern:/const \w+/i,inside:{keyword:/const/}},keyword:/\b(?:break|next|continue|alarm|using|of|add|delete|export|print|return|schedule|when|timeout|addr|any|bool|count|double|enum|file|int|interval|pattern|opaque|port|record|set|string|subnet|table|time|vector|for|if|else|in|module|function)\b/,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,punctuation:/[{}[\];(),.:]/}; |
|||
@ -0,0 +1,41 @@ |
|||
Prism.languages.c = Prism.languages.extend('clike', { |
|||
'comment': { |
|||
pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/, |
|||
greedy: true |
|||
}, |
|||
'class-name': { |
|||
pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+/, |
|||
lookbehind: true |
|||
}, |
|||
'keyword': /\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/, |
|||
'function': /[a-z_]\w*(?=\s*\()/i, |
|||
'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/, |
|||
'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('c', 'string', { |
|||
'macro': { |
|||
// allow for multiline macro definitions
|
|||
// spaces after the # character compile fine with gcc
|
|||
pattern: /(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im, |
|||
lookbehind: true, |
|||
alias: 'property', |
|||
inside: { |
|||
// highlight the path of the include statement as a string
|
|||
'string': { |
|||
pattern: /(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/, |
|||
lookbehind: true |
|||
}, |
|||
// highlight macro directives as keywords
|
|||
'directive': { |
|||
pattern: /(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/, |
|||
lookbehind: true, |
|||
alias: 'keyword' |
|||
} |
|||
} |
|||
}, |
|||
// highlight predefined macros as constants
|
|||
'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/ |
|||
}); |
|||
|
|||
delete Prism.languages.c['boolean']; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+/,lookbehind:!0},keyword:/\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,function:/[a-z_]\w*(?=\s*\()/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,number:/(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,lookbehind:!0},directive:{pattern:/(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,lookbehind:!0,alias:"keyword"}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete Prism.languages.c.boolean; |
|||
@ -0,0 +1,27 @@ |
|||
Prism.languages.cil = { |
|||
'comment': /\/\/.*/, |
|||
|
|||
'string': { |
|||
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, |
|||
greedy: true |
|||
}, |
|||
|
|||
'directive': { |
|||
pattern: /(^|\W)\.[a-z]+(?=\s)/, |
|||
lookbehind: true, |
|||
alias: 'class-name' |
|||
}, |
|||
|
|||
// Actually an assembly reference
|
|||
'variable': /\[[\w\.]+\]/, |
|||
|
|||
|
|||
'keyword': /\b(?:abstract|ansi|assembly|auto|autochar|beforefieldinit|bool|bstr|byvalstr|catch|char|cil|class|currency|date|decimal|default|enum|error|explicit|extends|extern|famandassem|family|famorassem|final(?:ly)?|float32|float64|hidebysig|iant|idispatch|implements|import|initonly|instance|u?int(?:8|16|32|64)?|interface|iunknown|literal|lpstr|lpstruct|lptstr|lpwstr|managed|method|native(?:Type)?|nested|newslot|object(?:ref)?|pinvokeimpl|private|privatescope|public|reqsecobj|rtspecialname|runtime|sealed|sequential|serializable|specialname|static|string|struct|syschar|tbstr|unicode|unmanagedexp|unsigned|value(?:type)?|variant|virtual|void)\b/, |
|||
|
|||
'function': /\b(?:(?:constrained|unaligned|volatile|readonly|tail|no)\.)?(?:conv\.(?:[iu][1248]?|ovf\.[iu][1248]?(?:\.un)?|r\.un|r4|r8)|ldc\.(?:i4(?:\.[0-9]+|\.[mM]1|\.s)?|i8|r4|r8)|ldelem(?:\.[iu][1248]?|\.r[48]|\.ref|a)?|ldind\.(?:[iu][1248]?|r[48]|ref)|stelem\.?(?:i[1248]?|r[48]|ref)?|stind\.(?:i[1248]?|r[48]|ref)?|end(?:fault|filter|finally)|ldarg(?:\.[0-3s]|a(?:\.s)?)?|ldloc(?:\.[0-9]+|\.s)?|sub(?:\.ovf(?:\.un)?)?|mul(?:\.ovf(?:\.un)?)?|add(?:\.ovf(?:\.un)?)?|stloc(?:\.[0-3s])?|refany(?:type|val)|blt(?:\.un)?(?:\.s)?|ble(?:\.un)?(?:\.s)?|bgt(?:\.un)?(?:\.s)?|bge(?:\.un)?(?:\.s)?|unbox(?:\.any)?|init(?:blk|obj)|call(?:i|virt)?|brfalse(?:\.s)?|bne\.un(?:\.s)?|ldloca(?:\.s)?|brzero(?:\.s)?|brtrue(?:\.s)?|brnull(?:\.s)?|brinst(?:\.s)?|starg(?:\.s)?|leave(?:\.s)?|shr(?:\.un)?|rem(?:\.un)?|div(?:\.un)?|clt(?:\.un)?|alignment|ldvirtftn|castclass|beq(?:\.s)?|mkrefany|localloc|ckfinite|rethrow|ldtoken|ldsflda|cgt\.un|arglist|switch|stsfld|sizeof|newobj|newarr|ldsfld|ldnull|ldflda|isinst|throw|stobj|stloc|stfld|ldstr|ldobj|ldlen|ldftn|ldfld|cpobj|cpblk|break|br\.s|xor|shl|ret|pop|not|nop|neg|jmp|dup|clt|cgt|ceq|box|and|or|br)\b/, |
|||
|
|||
'boolean': /\b(?:true|false)\b/, |
|||
'number': /\b-?(?:0x[0-9a-fA-F]+|[0-9]+)(?:\.[0-9a-fA-F]+)?\b/i, |
|||
|
|||
'punctuation': /[{}[\];(),:=]|IL_[0-9A-Za-z]+/ |
|||
} |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.cil={comment:/\/\/.*/,string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},directive:{pattern:/(^|\W)\.[a-z]+(?=\s)/,lookbehind:!0,alias:"class-name"},variable:/\[[\w\.]+\]/,keyword:/\b(?:abstract|ansi|assembly|auto|autochar|beforefieldinit|bool|bstr|byvalstr|catch|char|cil|class|currency|date|decimal|default|enum|error|explicit|extends|extern|famandassem|family|famorassem|final(?:ly)?|float32|float64|hidebysig|iant|idispatch|implements|import|initonly|instance|u?int(?:8|16|32|64)?|interface|iunknown|literal|lpstr|lpstruct|lptstr|lpwstr|managed|method|native(?:Type)?|nested|newslot|object(?:ref)?|pinvokeimpl|private|privatescope|public|reqsecobj|rtspecialname|runtime|sealed|sequential|serializable|specialname|static|string|struct|syschar|tbstr|unicode|unmanagedexp|unsigned|value(?:type)?|variant|virtual|void)\b/,function:/\b(?:(?:constrained|unaligned|volatile|readonly|tail|no)\.)?(?:conv\.(?:[iu][1248]?|ovf\.[iu][1248]?(?:\.un)?|r\.un|r4|r8)|ldc\.(?:i4(?:\.[0-9]+|\.[mM]1|\.s)?|i8|r4|r8)|ldelem(?:\.[iu][1248]?|\.r[48]|\.ref|a)?|ldind\.(?:[iu][1248]?|r[48]|ref)|stelem\.?(?:i[1248]?|r[48]|ref)?|stind\.(?:i[1248]?|r[48]|ref)?|end(?:fault|filter|finally)|ldarg(?:\.[0-3s]|a(?:\.s)?)?|ldloc(?:\.[0-9]+|\.s)?|sub(?:\.ovf(?:\.un)?)?|mul(?:\.ovf(?:\.un)?)?|add(?:\.ovf(?:\.un)?)?|stloc(?:\.[0-3s])?|refany(?:type|val)|blt(?:\.un)?(?:\.s)?|ble(?:\.un)?(?:\.s)?|bgt(?:\.un)?(?:\.s)?|bge(?:\.un)?(?:\.s)?|unbox(?:\.any)?|init(?:blk|obj)|call(?:i|virt)?|brfalse(?:\.s)?|bne\.un(?:\.s)?|ldloca(?:\.s)?|brzero(?:\.s)?|brtrue(?:\.s)?|brnull(?:\.s)?|brinst(?:\.s)?|starg(?:\.s)?|leave(?:\.s)?|shr(?:\.un)?|rem(?:\.un)?|div(?:\.un)?|clt(?:\.un)?|alignment|ldvirtftn|castclass|beq(?:\.s)?|mkrefany|localloc|ckfinite|rethrow|ldtoken|ldsflda|cgt\.un|arglist|switch|stsfld|sizeof|newobj|newarr|ldsfld|ldnull|ldflda|isinst|throw|stobj|stloc|stfld|ldstr|ldobj|ldlen|ldftn|ldfld|cpobj|cpblk|break|br\.s|xor|shl|ret|pop|not|nop|neg|jmp|dup|clt|cgt|ceq|box|and|or|br)\b/,boolean:/\b(?:true|false)\b/,number:/\b-?(?:0x[0-9a-fA-F]+|[0-9]+)(?:\.[0-9a-fA-F]+)?\b/i,punctuation:/[{}[\];(),:=]|IL_[0-9A-Za-z]+/}; |
|||
@ -0,0 +1,30 @@ |
|||
Prism.languages.clike = { |
|||
'comment': [ |
|||
{ |
|||
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, |
|||
lookbehind: true |
|||
}, |
|||
{ |
|||
pattern: /(^|[^\\:])\/\/.*/, |
|||
lookbehind: true, |
|||
greedy: true |
|||
} |
|||
], |
|||
'string': { |
|||
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, |
|||
greedy: true |
|||
}, |
|||
'class-name': { |
|||
pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i, |
|||
lookbehind: true, |
|||
inside: { |
|||
'punctuation': /[.\\]/ |
|||
} |
|||
}, |
|||
'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, |
|||
'boolean': /\b(?:true|false)\b/, |
|||
'function': /\w+(?=\()/, |
|||
'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i, |
|||
'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/, |
|||
'punctuation': /[{}[\];(),.:]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}; |
|||
@ -0,0 +1,16 @@ |
|||
// Copied from https://github.com/jeluard/prism-clojure
|
|||
Prism.languages.clojure = { |
|||
'comment': /;.*/, |
|||
'string': { |
|||
pattern: /"(?:[^"\\]|\\.)*"/, |
|||
greedy: true |
|||
}, |
|||
'operator': /(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i, //used for symbols and keywords
|
|||
'keyword': { |
|||
pattern: /([^\w+*'?-])(?:def|if|do|let|\.\.|quote|var|->>|->|fn|loop|recur|throw|try|monitor-enter|\.|new|set!|def\-|defn|defn\-|defmacro|defmulti|defmethod|defstruct|defonce|declare|definline|definterface|defprotocol|==|defrecord|>=|deftype|<=|defproject|ns|\*|\+|\-|\/|<|=|>|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|conj|cons|constantly|cond|if-not|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|deref|difference|disj|dissoc|distinct|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|for|fnseq|frest|gensym|get-proxy-class|get|hash-map|hash-set|identical\?|identity|if-let|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|line-seq|list\*|list|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|time|to-array|to-array-2d|tree-seq|true\?|union|up|update-proxy|val|vals|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper)(?=[^\w+*'?-])/, |
|||
lookbehind: true |
|||
}, |
|||
'boolean': /\b(?:true|false|nil)\b/, |
|||
'number': /\b[\da-f]+\b/i, |
|||
'punctuation': /[{}\[\](),]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.clojure={comment:/;.*/,string:{pattern:/"(?:[^"\\]|\\.)*"/,greedy:!0},operator:/(?:::|[:|'])\b[a-z][\w*+!?-]*\b/i,keyword:{pattern:/([^\w+*'?-])(?:def|if|do|let|\.\.|quote|var|->>|->|fn|loop|recur|throw|try|monitor-enter|\.|new|set!|def\-|defn|defn\-|defmacro|defmulti|defmethod|defstruct|defonce|declare|definline|definterface|defprotocol|==|defrecord|>=|deftype|<=|defproject|ns|\*|\+|\-|\/|<|=|>|accessor|agent|agent-errors|aget|alength|all-ns|alter|and|append-child|apply|array-map|aset|aset-boolean|aset-byte|aset-char|aset-double|aset-float|aset-int|aset-long|aset-short|assert|assoc|await|await-for|bean|binding|bit-and|bit-not|bit-or|bit-shift-left|bit-shift-right|bit-xor|boolean|branch\?|butlast|byte|cast|char|children|class|clear-agent-errors|comment|commute|comp|comparator|complement|concat|conj|cons|constantly|cond|if-not|construct-proxy|contains\?|count|create-ns|create-struct|cycle|dec|deref|difference|disj|dissoc|distinct|doall|doc|dorun|doseq|dosync|dotimes|doto|double|down|drop|drop-while|edit|end\?|ensure|eval|every\?|false\?|ffirst|file-seq|filter|find|find-doc|find-ns|find-var|first|float|flush|for|fnseq|frest|gensym|get-proxy-class|get|hash-map|hash-set|identical\?|identity|if-let|import|in-ns|inc|index|insert-child|insert-left|insert-right|inspect-table|inspect-tree|instance\?|int|interleave|intersection|into|into-array|iterate|join|key|keys|keyword|keyword\?|last|lazy-cat|lazy-cons|left|lefts|line-seq|list\*|list|load|load-file|locking|long|loop|macroexpand|macroexpand-1|make-array|make-node|map|map-invert|map\?|mapcat|max|max-key|memfn|merge|merge-with|meta|min|min-key|name|namespace|neg\?|new|newline|next|nil\?|node|not|not-any\?|not-every\?|not=|ns-imports|ns-interns|ns-map|ns-name|ns-publics|ns-refers|ns-resolve|ns-unmap|nth|nthrest|or|parse|partial|path|peek|pop|pos\?|pr|pr-str|print|print-str|println|println-str|prn|prn-str|project|proxy|proxy-mappings|quot|rand|rand-int|range|re-find|re-groups|re-matcher|re-matches|re-pattern|re-seq|read|read-line|reduce|ref|ref-set|refer|rem|remove|remove-method|remove-ns|rename|rename-keys|repeat|replace|replicate|resolve|rest|resultset-seq|reverse|rfirst|right|rights|root|rrest|rseq|second|select|select-keys|send|send-off|seq|seq-zip|seq\?|set|short|slurp|some|sort|sort-by|sorted-map|sorted-map-by|sorted-set|special-symbol\?|split-at|split-with|str|string\?|struct|struct-map|subs|subvec|symbol|symbol\?|sync|take|take-nth|take-while|test|time|to-array|to-array-2d|tree-seq|true\?|union|up|update-proxy|val|vals|var-get|var-set|var\?|vector|vector-zip|vector\?|when|when-first|when-let|when-not|with-local-vars|with-meta|with-open|with-out-str|xml-seq|xml-zip|zero\?|zipmap|zipper)(?=[^\w+*'?-])/,lookbehind:!0},boolean:/\b(?:true|false|nil)\b/,number:/\b[\da-f]+\b/i,punctuation:/[{}\[\](),]/}; |
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,92 @@ |
|||
(function(Prism) { |
|||
|
|||
// Ignore comments starting with { to privilege string interpolation highlighting
|
|||
var comment = /#(?!\{).+/, |
|||
interpolation = { |
|||
pattern: /#\{[^}]+\}/, |
|||
alias: 'variable' |
|||
}; |
|||
|
|||
Prism.languages.coffeescript = Prism.languages.extend('javascript', { |
|||
'comment': comment, |
|||
'string': [ |
|||
|
|||
// Strings are multiline
|
|||
{ |
|||
pattern: /'(?:\\[\s\S]|[^\\'])*'/, |
|||
greedy: true |
|||
}, |
|||
|
|||
{ |
|||
// Strings are multiline
|
|||
pattern: /"(?:\\[\s\S]|[^\\"])*"/, |
|||
greedy: true, |
|||
inside: { |
|||
'interpolation': interpolation |
|||
} |
|||
} |
|||
], |
|||
'keyword': /\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/, |
|||
'class-member': { |
|||
pattern: /@(?!\d)\w+/, |
|||
alias: 'variable' |
|||
} |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('coffeescript', 'comment', { |
|||
'multiline-comment': { |
|||
pattern: /###[\s\S]+?###/, |
|||
alias: 'comment' |
|||
}, |
|||
|
|||
// Block regexp can contain comments and interpolation
|
|||
'block-regex': { |
|||
pattern: /\/{3}[\s\S]*?\/{3}/, |
|||
alias: 'regex', |
|||
inside: { |
|||
'comment': comment, |
|||
'interpolation': interpolation |
|||
} |
|||
} |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('coffeescript', 'string', { |
|||
'inline-javascript': { |
|||
pattern: /`(?:\\[\s\S]|[^\\`])*`/, |
|||
inside: { |
|||
'delimiter': { |
|||
pattern: /^`|`$/, |
|||
alias: 'punctuation' |
|||
}, |
|||
rest: Prism.languages.javascript |
|||
} |
|||
}, |
|||
|
|||
// Block strings
|
|||
'multiline-string': [ |
|||
{ |
|||
pattern: /'''[\s\S]*?'''/, |
|||
greedy: true, |
|||
alias: 'string' |
|||
}, |
|||
{ |
|||
pattern: /"""[\s\S]*?"""/, |
|||
greedy: true, |
|||
alias: 'string', |
|||
inside: { |
|||
interpolation: interpolation |
|||
} |
|||
} |
|||
] |
|||
|
|||
}); |
|||
|
|||
Prism.languages.insertBefore('coffeescript', 'keyword', { |
|||
// Object property
|
|||
'property': /(?!\d)\w+(?=\s*:(?!:))/ |
|||
}); |
|||
|
|||
delete Prism.languages.coffeescript['template-string']; |
|||
|
|||
Prism.languages.coffee = Prism.languages.coffeescript; |
|||
}(Prism)); |
|||
@ -0,0 +1 @@ |
|||
!function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},rest:e.languages.javascript}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(Prism); |
|||
@ -0,0 +1,48 @@ |
|||
Prism.languages.concurnas = { |
|||
'comment': [ |
|||
{ |
|||
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, |
|||
lookbehind: true |
|||
}, |
|||
{ |
|||
pattern: /(^|[^\\:])\/\/.*/, |
|||
lookbehind: true, |
|||
greedy: true |
|||
} |
|||
], |
|||
'langext': { |
|||
pattern: /\w+\s*\|\|[\s\S]+?\|\|/, |
|||
greedy: true, |
|||
alias: 'string' |
|||
}, |
|||
'function': { |
|||
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/, |
|||
lookbehind: true |
|||
}, |
|||
'keyword': /\b(?:abstract|actor|also|annotation|assert|async|await|bool|boolean|break|byte|case|catch|changed|char|class|closed|constant|continue|def|default|del|double|elif|else|enum|every|extends|false|finally|float|for|from|global|gpudef|gpukernel|if|import|in|init|inject|int|lambda|local|long|loop|match|new|nodefault|null|of|onchange|open|out|override|package|parfor|parforsync|post|pre|private|protected|provide|provider|public|return|shared|short|single|size_t|sizeof|super|sync|this|throw|trait|trans|transient|true|try|typedef|unchecked|using|val|var|void|while|with)\b/, |
|||
'boolean': /\b(?:false|true)\b/, |
|||
'number': /\b0b[01][01_]*L?\b|\b0x[\da-f_]*\.?[\da-f_p+-]+\b|(?:\b\d[\d_]*\.?[\d_]*|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfls]?/i, |
|||
'punctuation': /[{}[\];(),.:]/, |
|||
'operator': /<==|>==|=>|->|<-|<>|\^|&==|&<>|!|\?|\?:|\.\?|\+\+|--|[-+*/=<>]=?|\b(?:and|as|band|bor|bxor|comp|is|isnot|mod|or)\b=?/, |
|||
'annotation': { |
|||
pattern: /@(?:\w+:)?(?:\w*|\[[^\]]+\])/, |
|||
alias: 'builtin' |
|||
} |
|||
}; |
|||
|
|||
Prism.languages.insertBefore('concurnas', 'langext', { |
|||
'string': { |
|||
pattern: /[rs]?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, |
|||
greedy: true, |
|||
inside: { |
|||
'interpolation': { |
|||
pattern: /((?:^|[^\\])(?:\\{2})*){(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/, |
|||
lookbehind: true, |
|||
inside: Prism.languages.concurnas |
|||
}, |
|||
'string': /[\s\S]+/ |
|||
} |
|||
} |
|||
}); |
|||
|
|||
Prism.languages.conc = Prism.languages.concurnas; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.concurnas={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],langext:{pattern:/\w+\s*\|\|[\s\S]+?\|\|/,greedy:!0,alias:"string"},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/,lookbehind:!0},keyword:/\b(?:abstract|actor|also|annotation|assert|async|await|bool|boolean|break|byte|case|catch|changed|char|class|closed|constant|continue|def|default|del|double|elif|else|enum|every|extends|false|finally|float|for|from|global|gpudef|gpukernel|if|import|in|init|inject|int|lambda|local|long|loop|match|new|nodefault|null|of|onchange|open|out|override|package|parfor|parforsync|post|pre|private|protected|provide|provider|public|return|shared|short|single|size_t|sizeof|super|sync|this|throw|trait|trans|transient|true|try|typedef|unchecked|using|val|var|void|while|with)\b/,boolean:/\b(?:false|true)\b/,number:/\b0b[01][01_]*L?\b|\b0x[\da-f_]*\.?[\da-f_p+-]+\b|(?:\b\d[\d_]*\.?[\d_]*|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfls]?/i,punctuation:/[{}[\];(),.:]/,operator:/<==|>==|=>|->|<-|<>|\^|&==|&<>|!|\?|\?:|\.\?|\+\+|--|[-+*/=<>]=?|\b(?:and|as|band|bor|bxor|comp|is|isnot|mod|or)\b=?/,annotation:{pattern:/@(?:\w+:)?(?:\w*|\[[^\]]+\])/,alias:"builtin"}},Prism.languages.insertBefore("concurnas","langext",{string:{pattern:/[rs]?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*){(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:Prism.languages.concurnas},string:/[\s\S]+/}}}),Prism.languages.conc=Prism.languages.concurnas; |
|||
@ -0,0 +1,725 @@ |
|||
var _self = (typeof window !== 'undefined') |
|||
? window // if in browser
|
|||
: ( |
|||
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) |
|||
? self // if in worker
|
|||
: {} // if in node js
|
|||
); |
|||
|
|||
/** |
|||
* Prism: Lightweight, robust, elegant syntax highlighting |
|||
* MIT license http://www.opensource.org/licenses/mit-license.php/
|
|||
* @author Lea Verou http://lea.verou.me
|
|||
*/ |
|||
|
|||
var Prism = (function (_self){ |
|||
|
|||
// Private helper vars
|
|||
var lang = /\blang(?:uage)?-([\w-]+)\b/i; |
|||
var uniqueId = 0; |
|||
|
|||
|
|||
var _ = { |
|||
manual: _self.Prism && _self.Prism.manual, |
|||
disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler, |
|||
util: { |
|||
encode: function encode(tokens) { |
|||
if (tokens instanceof Token) { |
|||
return new Token(tokens.type, encode(tokens.content), tokens.alias); |
|||
} else if (Array.isArray(tokens)) { |
|||
return tokens.map(encode); |
|||
} else { |
|||
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' '); |
|||
} |
|||
}, |
|||
|
|||
type: function (o) { |
|||
return Object.prototype.toString.call(o).slice(8, -1); |
|||
}, |
|||
|
|||
objId: function (obj) { |
|||
if (!obj['__id']) { |
|||
Object.defineProperty(obj, '__id', { value: ++uniqueId }); |
|||
} |
|||
return obj['__id']; |
|||
}, |
|||
|
|||
// Deep clone a language definition (e.g. to extend it)
|
|||
clone: function deepClone(o, visited) { |
|||
var clone, id, type = _.util.type(o); |
|||
visited = visited || {}; |
|||
|
|||
switch (type) { |
|||
case 'Object': |
|||
id = _.util.objId(o); |
|||
if (visited[id]) { |
|||
return visited[id]; |
|||
} |
|||
clone = {}; |
|||
visited[id] = clone; |
|||
|
|||
for (var key in o) { |
|||
if (o.hasOwnProperty(key)) { |
|||
clone[key] = deepClone(o[key], visited); |
|||
} |
|||
} |
|||
|
|||
return clone; |
|||
|
|||
case 'Array': |
|||
id = _.util.objId(o); |
|||
if (visited[id]) { |
|||
return visited[id]; |
|||
} |
|||
clone = []; |
|||
visited[id] = clone; |
|||
|
|||
o.forEach(function (v, i) { |
|||
clone[i] = deepClone(v, visited); |
|||
}); |
|||
|
|||
return clone; |
|||
|
|||
default: |
|||
return o; |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class. |
|||
* |
|||
* If no language is set for the element or the element is `null` or `undefined`, `none` will be returned. |
|||
* |
|||
* @param {Element} element |
|||
* @returns {string} |
|||
*/ |
|||
getLanguage: function (element) { |
|||
while (element && !lang.test(element.className)) { |
|||
element = element.parentElement; |
|||
} |
|||
if (element) { |
|||
return (element.className.match(lang) || [, 'none'])[1].toLowerCase(); |
|||
} |
|||
return 'none'; |
|||
}, |
|||
|
|||
/** |
|||
* Returns the script element that is currently executing. |
|||
* |
|||
* This does __not__ work for line script element. |
|||
* |
|||
* @returns {HTMLScriptElement | null} |
|||
*/ |
|||
currentScript: function () { |
|||
if (typeof document === 'undefined') { |
|||
return null; |
|||
} |
|||
if ('currentScript' in document) { |
|||
return document.currentScript; |
|||
} |
|||
|
|||
// IE11 workaround
|
|||
// we'll get the src of the current script by parsing IE11's error stack trace
|
|||
// this will not work for inline scripts
|
|||
|
|||
try { |
|||
throw new Error(); |
|||
} catch (err) { |
|||
// Get file src url from stack. Specifically works with the format of stack traces in IE.
|
|||
// A stack will look like this:
|
|||
//
|
|||
// Error
|
|||
// at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
|
|||
// at Global code (http://localhost/components/prism-core.js:606:1)
|
|||
|
|||
var src = (/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(err.stack) || [])[1]; |
|||
if (src) { |
|||
var scripts = document.getElementsByTagName('script'); |
|||
for (var i in scripts) { |
|||
if (scripts[i].src == src) { |
|||
return scripts[i]; |
|||
} |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
} |
|||
}, |
|||
|
|||
languages: { |
|||
extend: function (id, redef) { |
|||
var lang = _.util.clone(_.languages[id]); |
|||
|
|||
for (var key in redef) { |
|||
lang[key] = redef[key]; |
|||
} |
|||
|
|||
return lang; |
|||
}, |
|||
|
|||
/** |
|||
* Insert a token before another token in a language literal |
|||
* As this needs to recreate the object (we cannot actually insert before keys in object literals), |
|||
* we cannot just provide an object, we need an object and a key. |
|||
* @param inside The key (or language id) of the parent |
|||
* @param before The key to insert before. |
|||
* @param insert Object with the key/value pairs to insert |
|||
* @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted. |
|||
*/ |
|||
insertBefore: function (inside, before, insert, root) { |
|||
root = root || _.languages; |
|||
var grammar = root[inside]; |
|||
var ret = {}; |
|||
|
|||
for (var token in grammar) { |
|||
if (grammar.hasOwnProperty(token)) { |
|||
|
|||
if (token == before) { |
|||
for (var newToken in insert) { |
|||
if (insert.hasOwnProperty(newToken)) { |
|||
ret[newToken] = insert[newToken]; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Do not insert token which also occur in insert. See #1525
|
|||
if (!insert.hasOwnProperty(token)) { |
|||
ret[token] = grammar[token]; |
|||
} |
|||
} |
|||
} |
|||
|
|||
var old = root[inside]; |
|||
root[inside] = ret; |
|||
|
|||
// Update references in other language definitions
|
|||
_.languages.DFS(_.languages, function(key, value) { |
|||
if (value === old && key != inside) { |
|||
this[key] = ret; |
|||
} |
|||
}); |
|||
|
|||
return ret; |
|||
}, |
|||
|
|||
// Traverse a language definition with Depth First Search
|
|||
DFS: function DFS(o, callback, type, visited) { |
|||
visited = visited || {}; |
|||
|
|||
var objId = _.util.objId; |
|||
|
|||
for (var i in o) { |
|||
if (o.hasOwnProperty(i)) { |
|||
callback.call(o, i, o[i], type || i); |
|||
|
|||
var property = o[i], |
|||
propertyType = _.util.type(property); |
|||
|
|||
if (propertyType === 'Object' && !visited[objId(property)]) { |
|||
visited[objId(property)] = true; |
|||
DFS(property, callback, null, visited); |
|||
} |
|||
else if (propertyType === 'Array' && !visited[objId(property)]) { |
|||
visited[objId(property)] = true; |
|||
DFS(property, callback, i, visited); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
plugins: {}, |
|||
|
|||
highlightAll: function(async, callback) { |
|||
_.highlightAllUnder(document, async, callback); |
|||
}, |
|||
|
|||
highlightAllUnder: function(container, async, callback) { |
|||
var env = { |
|||
callback: callback, |
|||
container: container, |
|||
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code' |
|||
}; |
|||
|
|||
_.hooks.run('before-highlightall', env); |
|||
|
|||
env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector)); |
|||
|
|||
_.hooks.run('before-all-elements-highlight', env); |
|||
|
|||
for (var i = 0, element; element = env.elements[i++];) { |
|||
_.highlightElement(element, async === true, env.callback); |
|||
} |
|||
}, |
|||
|
|||
highlightElement: function(element, async, callback) { |
|||
// Find language
|
|||
var language = _.util.getLanguage(element); |
|||
var grammar = _.languages[language]; |
|||
|
|||
// Set language on the element, if not present
|
|||
element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; |
|||
|
|||
// Set language on the parent, for styling
|
|||
var parent = element.parentNode; |
|||
if (parent && parent.nodeName.toLowerCase() === 'pre') { |
|||
parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; |
|||
} |
|||
|
|||
var code = element.textContent; |
|||
|
|||
var env = { |
|||
element: element, |
|||
language: language, |
|||
grammar: grammar, |
|||
code: code |
|||
}; |
|||
|
|||
function insertHighlightedCode(highlightedCode) { |
|||
env.highlightedCode = highlightedCode; |
|||
|
|||
_.hooks.run('before-insert', env); |
|||
|
|||
env.element.innerHTML = env.highlightedCode; |
|||
|
|||
_.hooks.run('after-highlight', env); |
|||
_.hooks.run('complete', env); |
|||
callback && callback.call(env.element); |
|||
} |
|||
|
|||
_.hooks.run('before-sanity-check', env); |
|||
|
|||
if (!env.code) { |
|||
_.hooks.run('complete', env); |
|||
callback && callback.call(env.element); |
|||
return; |
|||
} |
|||
|
|||
_.hooks.run('before-highlight', env); |
|||
|
|||
if (!env.grammar) { |
|||
insertHighlightedCode(_.util.encode(env.code)); |
|||
return; |
|||
} |
|||
|
|||
if (async && _self.Worker) { |
|||
var worker = new Worker(_.filename); |
|||
|
|||
worker.onmessage = function(evt) { |
|||
insertHighlightedCode(evt.data); |
|||
}; |
|||
|
|||
worker.postMessage(JSON.stringify({ |
|||
language: env.language, |
|||
code: env.code, |
|||
immediateClose: true |
|||
})); |
|||
} |
|||
else { |
|||
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language)); |
|||
} |
|||
}, |
|||
|
|||
highlight: function (text, grammar, language) { |
|||
var env = { |
|||
code: text, |
|||
grammar: grammar, |
|||
language: language |
|||
}; |
|||
_.hooks.run('before-tokenize', env); |
|||
env.tokens = _.tokenize(env.code, env.grammar); |
|||
_.hooks.run('after-tokenize', env); |
|||
return Token.stringify(_.util.encode(env.tokens), env.language); |
|||
}, |
|||
|
|||
tokenize: function(text, grammar) { |
|||
var rest = grammar.rest; |
|||
if (rest) { |
|||
for (var token in rest) { |
|||
grammar[token] = rest[token]; |
|||
} |
|||
|
|||
delete grammar.rest; |
|||
} |
|||
|
|||
var tokenList = new LinkedList(); |
|||
addAfter(tokenList, tokenList.head, text); |
|||
|
|||
matchGrammar(text, tokenList, grammar, tokenList.head, 0); |
|||
|
|||
return toArray(tokenList); |
|||
}, |
|||
|
|||
hooks: { |
|||
all: {}, |
|||
|
|||
add: function (name, callback) { |
|||
var hooks = _.hooks.all; |
|||
|
|||
hooks[name] = hooks[name] || []; |
|||
|
|||
hooks[name].push(callback); |
|||
}, |
|||
|
|||
run: function (name, env) { |
|||
var callbacks = _.hooks.all[name]; |
|||
|
|||
if (!callbacks || !callbacks.length) { |
|||
return; |
|||
} |
|||
|
|||
for (var i=0, callback; callback = callbacks[i++];) { |
|||
callback(env); |
|||
} |
|||
} |
|||
}, |
|||
|
|||
Token: Token |
|||
}; |
|||
|
|||
_self.Prism = _; |
|||
|
|||
function Token(type, content, alias, matchedStr, greedy) { |
|||
this.type = type; |
|||
this.content = content; |
|||
this.alias = alias; |
|||
// Copy of the full string this token was created from
|
|||
this.length = (matchedStr || '').length|0; |
|||
this.greedy = !!greedy; |
|||
} |
|||
|
|||
Token.stringify = function stringify(o, language) { |
|||
if (typeof o == 'string') { |
|||
return o; |
|||
} |
|||
if (Array.isArray(o)) { |
|||
var s = ''; |
|||
o.forEach(function (e) { |
|||
s += stringify(e, language); |
|||
}); |
|||
return s; |
|||
} |
|||
|
|||
var env = { |
|||
type: o.type, |
|||
content: stringify(o.content, language), |
|||
tag: 'span', |
|||
classes: ['token', o.type], |
|||
attributes: {}, |
|||
language: language |
|||
}; |
|||
|
|||
var aliases = o.alias; |
|||
if (aliases) { |
|||
if (Array.isArray(aliases)) { |
|||
Array.prototype.push.apply(env.classes, aliases); |
|||
} else { |
|||
env.classes.push(aliases); |
|||
} |
|||
} |
|||
|
|||
_.hooks.run('wrap', env); |
|||
|
|||
var attributes = ''; |
|||
for (var name in env.attributes) { |
|||
attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"'; |
|||
} |
|||
|
|||
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>'; |
|||
}; |
|||
|
|||
/** |
|||
* @param {string} text |
|||
* @param {LinkedList<string | Token>} tokenList |
|||
* @param {any} grammar |
|||
* @param {LinkedListNode<string | Token>} startNode |
|||
* @param {number} startPos |
|||
* @param {boolean} [oneshot=false] |
|||
* @param {string} [target] |
|||
*/ |
|||
function matchGrammar(text, tokenList, grammar, startNode, startPos, oneshot, target) { |
|||
for (var token in grammar) { |
|||
if (!grammar.hasOwnProperty(token) || !grammar[token]) { |
|||
continue; |
|||
} |
|||
|
|||
var patterns = grammar[token]; |
|||
patterns = Array.isArray(patterns) ? patterns : [patterns]; |
|||
|
|||
for (var j = 0; j < patterns.length; ++j) { |
|||
if (target && target == token + ',' + j) { |
|||
return; |
|||
} |
|||
|
|||
var pattern = patterns[j], |
|||
inside = pattern.inside, |
|||
lookbehind = !!pattern.lookbehind, |
|||
greedy = !!pattern.greedy, |
|||
lookbehindLength = 0, |
|||
alias = pattern.alias; |
|||
|
|||
if (greedy && !pattern.pattern.global) { |
|||
// Without the global flag, lastIndex won't work
|
|||
var flags = pattern.pattern.toString().match(/[imsuy]*$/)[0]; |
|||
pattern.pattern = RegExp(pattern.pattern.source, flags + 'g'); |
|||
} |
|||
|
|||
pattern = pattern.pattern || pattern; |
|||
|
|||
for ( // iterate the token list and keep track of the current token/string position
|
|||
var currentNode = startNode.next, pos = startPos; |
|||
currentNode !== tokenList.tail; |
|||
pos += currentNode.value.length, currentNode = currentNode.next |
|||
) { |
|||
|
|||
var str = currentNode.value; |
|||
|
|||
if (tokenList.length > text.length) { |
|||
// Something went terribly wrong, ABORT, ABORT!
|
|||
return; |
|||
} |
|||
|
|||
if (str instanceof Token) { |
|||
continue; |
|||
} |
|||
|
|||
var removeCount = 1; // this is the to parameter of removeBetween
|
|||
|
|||
if (greedy && currentNode != tokenList.tail.prev) { |
|||
pattern.lastIndex = pos; |
|||
var match = pattern.exec(text); |
|||
if (!match) { |
|||
break; |
|||
} |
|||
|
|||
var from = match.index + (lookbehind && match[1] ? match[1].length : 0); |
|||
var to = match.index + match[0].length; |
|||
var p = pos; |
|||
|
|||
// find the node that contains the match
|
|||
p += currentNode.value.length; |
|||
while (from >= p) { |
|||
currentNode = currentNode.next; |
|||
p += currentNode.value.length; |
|||
} |
|||
// adjust pos (and p)
|
|||
p -= currentNode.value.length; |
|||
pos = p; |
|||
|
|||
// the current node is a Token, then the match starts inside another Token, which is invalid
|
|||
if (currentNode.value instanceof Token) { |
|||
continue; |
|||
} |
|||
|
|||
// find the last node which is affected by this match
|
|||
for ( |
|||
var k = currentNode; |
|||
k !== tokenList.tail && (p < to || (typeof k.value === 'string' && !k.prev.value.greedy)); |
|||
k = k.next |
|||
) { |
|||
removeCount++; |
|||
p += k.value.length; |
|||
} |
|||
removeCount--; |
|||
|
|||
// replace with the new match
|
|||
str = text.slice(pos, p); |
|||
match.index -= pos; |
|||
} else { |
|||
pattern.lastIndex = 0; |
|||
|
|||
var match = pattern.exec(str); |
|||
} |
|||
|
|||
if (!match) { |
|||
if (oneshot) { |
|||
break; |
|||
} |
|||
|
|||
continue; |
|||
} |
|||
|
|||
if (lookbehind) { |
|||
lookbehindLength = match[1] ? match[1].length : 0; |
|||
} |
|||
|
|||
var from = match.index + lookbehindLength, |
|||
match = match[0].slice(lookbehindLength), |
|||
to = from + match.length, |
|||
before = str.slice(0, from), |
|||
after = str.slice(to); |
|||
|
|||
var removeFrom = currentNode.prev; |
|||
|
|||
if (before) { |
|||
removeFrom = addAfter(tokenList, removeFrom, before); |
|||
pos += before.length; |
|||
} |
|||
|
|||
removeRange(tokenList, removeFrom, removeCount); |
|||
|
|||
var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias, match, greedy); |
|||
currentNode = addAfter(tokenList, removeFrom, wrapped); |
|||
|
|||
if (after) { |
|||
addAfter(tokenList, currentNode, after); |
|||
} |
|||
|
|||
|
|||
if (removeCount > 1) |
|||
matchGrammar(text, tokenList, grammar, currentNode.prev, pos, true, token + ',' + j); |
|||
|
|||
if (oneshot) |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @typedef LinkedListNode |
|||
* @property {T} value |
|||
* @property {LinkedListNode<T> | null} prev The previous node. |
|||
* @property {LinkedListNode<T> | null} next The next node. |
|||
* @template T |
|||
*/ |
|||
|
|||
/** |
|||
* @template T |
|||
*/ |
|||
function LinkedList() { |
|||
/** @type {LinkedListNode<T>} */ |
|||
var head = { value: null, prev: null, next: null }; |
|||
/** @type {LinkedListNode<T>} */ |
|||
var tail = { value: null, prev: head, next: null }; |
|||
head.next = tail; |
|||
|
|||
/** @type {LinkedListNode<T>} */ |
|||
this.head = head; |
|||
/** @type {LinkedListNode<T>} */ |
|||
this.tail = tail; |
|||
this.length = 0; |
|||
} |
|||
|
|||
/** |
|||
* Adds a new node with the given value to the list. |
|||
* @param {LinkedList<T>} list |
|||
* @param {LinkedListNode<T>} node |
|||
* @param {T} value |
|||
* @returns {LinkedListNode<T>} The added node. |
|||
* @template T |
|||
*/ |
|||
function addAfter(list, node, value) { |
|||
// assumes that node != list.tail && values.length >= 0
|
|||
var next = node.next; |
|||
|
|||
var newNode = { value: value, prev: node, next: next }; |
|||
node.next = newNode; |
|||
next.prev = newNode; |
|||
list.length++; |
|||
|
|||
return newNode; |
|||
} |
|||
/** |
|||
* Removes `count` nodes after the given node. The given node will not be removed. |
|||
* @param {LinkedList<T>} list |
|||
* @param {LinkedListNode<T>} node |
|||
* @param {number} count |
|||
* @template T |
|||
*/ |
|||
function removeRange(list, node, count) { |
|||
var next = node.next; |
|||
for (var i = 0; i < count && next !== list.tail; i++) { |
|||
next = next.next; |
|||
} |
|||
node.next = next; |
|||
next.prev = node; |
|||
list.length -= i; |
|||
} |
|||
/** |
|||
* @param {LinkedList<T>} list |
|||
* @returns {T[]} |
|||
* @template T |
|||
*/ |
|||
function toArray(list) { |
|||
var array = []; |
|||
var node = list.head.next; |
|||
while (node !== list.tail) { |
|||
array.push(node.value); |
|||
node = node.next; |
|||
} |
|||
return array; |
|||
} |
|||
|
|||
|
|||
if (!_self.document) { |
|||
if (!_self.addEventListener) { |
|||
// in Node.js
|
|||
return _; |
|||
} |
|||
|
|||
if (!_.disableWorkerMessageHandler) { |
|||
// In worker
|
|||
_self.addEventListener('message', function (evt) { |
|||
var message = JSON.parse(evt.data), |
|||
lang = message.language, |
|||
code = message.code, |
|||
immediateClose = message.immediateClose; |
|||
|
|||
_self.postMessage(_.highlight(code, _.languages[lang], lang)); |
|||
if (immediateClose) { |
|||
_self.close(); |
|||
} |
|||
}, false); |
|||
} |
|||
|
|||
return _; |
|||
} |
|||
|
|||
//Get current script and highlight
|
|||
var script = _.util.currentScript(); |
|||
|
|||
if (script) { |
|||
_.filename = script.src; |
|||
|
|||
if (script.hasAttribute('data-manual')) { |
|||
_.manual = true; |
|||
} |
|||
} |
|||
|
|||
function highlightAutomaticallyCallback() { |
|||
if (!_.manual) { |
|||
_.highlightAll(); |
|||
} |
|||
} |
|||
|
|||
if (!_.manual) { |
|||
// If the document state is "loading", then we'll use DOMContentLoaded.
|
|||
// If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
|
|||
// DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
|
|||
// might take longer one animation frame to execute which can create a race condition where only some plugins have
|
|||
// been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
|
|||
// See https://github.com/PrismJS/prism/issues/2102
|
|||
var readyState = document.readyState; |
|||
if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) { |
|||
document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback); |
|||
} else { |
|||
if (window.requestAnimationFrame) { |
|||
window.requestAnimationFrame(highlightAutomaticallyCallback); |
|||
} else { |
|||
window.setTimeout(highlightAutomaticallyCallback, 16); |
|||
} |
|||
} |
|||
} |
|||
|
|||
return _; |
|||
|
|||
})(_self); |
|||
|
|||
if (typeof module !== 'undefined' && module.exports) { |
|||
module.exports = Prism; |
|||
} |
|||
|
|||
// hack for components to work correctly in node.js
|
|||
if (typeof global !== 'undefined') { |
|||
global.Prism = Prism; |
|||
} |
|||
File diff suppressed because one or more lines are too long
@ -0,0 +1,21 @@ |
|||
Prism.languages.cpp = Prism.languages.extend('c', { |
|||
'class-name': { |
|||
pattern: /(\b(?:class|enum|struct)\s+)\w+/, |
|||
lookbehind: true |
|||
}, |
|||
'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/, |
|||
'number': { |
|||
pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i, |
|||
greedy: true |
|||
}, |
|||
'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/, |
|||
'boolean': /\b(?:true|false)\b/ |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('cpp', 'string', { |
|||
'raw-string': { |
|||
pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/, |
|||
alias: 'string', |
|||
greedy: true |
|||
} |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.cpp=Prism.languages.extend("c",{"class-name":{pattern:/(\b(?:class|enum|struct)\s+)\w+/,lookbehind:!0},keyword:/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i,greedy:!0},operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:true|false)\b/}),Prism.languages.insertBefore("cpp","string",{"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}); |
|||
@ -0,0 +1,51 @@ |
|||
(function(Prism) { |
|||
Prism.languages.crystal = Prism.languages.extend('ruby', { |
|||
keyword: [ |
|||
/\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__)\b/, |
|||
{ |
|||
pattern: /(\.\s*)(?:is_a|responds_to)\?/, |
|||
lookbehind: true |
|||
} |
|||
], |
|||
|
|||
number: /\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[\da-fA-F_]*[\da-fA-F]|(?:\d(?:[\d_]*\d)?)(?:\.[\d_]*\d)?(?:[eE][+-]?[\d_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b/ |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('crystal', 'string', { |
|||
attribute: { |
|||
pattern: /@\[.+?\]/, |
|||
alias: 'attr-name', |
|||
inside: { |
|||
delimiter: { |
|||
pattern: /^@\[|\]$/, |
|||
alias: 'tag' |
|||
}, |
|||
rest: Prism.languages.crystal |
|||
} |
|||
}, |
|||
|
|||
expansion: [ |
|||
{ |
|||
pattern: /\{\{.+?\}\}/, |
|||
inside: { |
|||
delimiter: { |
|||
pattern: /^\{\{|\}\}$/, |
|||
alias: 'tag' |
|||
}, |
|||
rest: Prism.languages.crystal |
|||
} |
|||
}, |
|||
{ |
|||
pattern: /\{%.+?%\}/, |
|||
inside: { |
|||
delimiter: { |
|||
pattern: /^\{%|%\}$/, |
|||
alias: 'tag' |
|||
}, |
|||
rest: Prism.languages.crystal |
|||
} |
|||
} |
|||
] |
|||
}); |
|||
|
|||
}(Prism)); |
|||
@ -0,0 +1 @@ |
|||
!function(e){e.languages.crystal=e.languages.extend("ruby",{keyword:[/\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__)\b/,{pattern:/(\.\s*)(?:is_a|responds_to)\?/,lookbehind:!0}],number:/\b(?:0b[01_]*[01]|0o[0-7_]*[0-7]|0x[\da-fA-F_]*[\da-fA-F]|(?:\d(?:[\d_]*\d)?)(?:\.[\d_]*\d)?(?:[eE][+-]?[\d_]*\d)?)(?:_(?:[uif](?:8|16|32|64))?)?\b/}),e.languages.insertBefore("crystal","string",{attribute:{pattern:/@\[.+?\]/,alias:"attr-name",inside:{delimiter:{pattern:/^@\[|\]$/,alias:"tag"},rest:e.languages.crystal}},expansion:[{pattern:/\{\{.+?\}\}/,inside:{delimiter:{pattern:/^\{\{|\}\}$/,alias:"tag"},rest:e.languages.crystal}},{pattern:/\{%.+?%\}/,inside:{delimiter:{pattern:/^\{%|%\}$/,alias:"tag"},rest:e.languages.crystal}}]})}(Prism); |
|||
@ -0,0 +1,360 @@ |
|||
(function (Prism) { |
|||
|
|||
/** |
|||
* Replaces all placeholders "<<n>>" of given pattern with the n-th replacement (zero based). |
|||
* |
|||
* Note: This is a simple text based replacement. Be careful when using backreferences! |
|||
* |
|||
* @param {string} pattern the given pattern. |
|||
* @param {string[]} replacements a list of replacement which can be inserted into the given pattern. |
|||
* @returns {string} the pattern with all placeholders replaced with their corresponding replacements. |
|||
* @example replace(/a<<0>>a/.source, [/b+/.source]) === /a(?:b+)a/.source |
|||
*/ |
|||
function replace(pattern, replacements) { |
|||
return pattern.replace(/<<(\d+)>>/g, function (m, index) { |
|||
return '(?:' + replacements[+index] + ')'; |
|||
}); |
|||
} |
|||
/** |
|||
* @param {string} pattern |
|||
* @param {string[]} replacements |
|||
* @param {string} [flags] |
|||
* @returns {RegExp} |
|||
*/ |
|||
function re(pattern, replacements, flags) { |
|||
return RegExp(replace(pattern, replacements), flags || ''); |
|||
} |
|||
|
|||
/** |
|||
* Creates a nested pattern where all occurrences of the string `<<self>>` are replaced with the pattern itself. |
|||
* |
|||
* @param {string} pattern |
|||
* @param {number} depthLog2 |
|||
* @returns {string} |
|||
*/ |
|||
function nested(pattern, depthLog2) { |
|||
for (var i = 0; i < depthLog2; i++) { |
|||
pattern = pattern.replace(/<<self>>/g, function () { return '(?:' + pattern + ')'; }); |
|||
} |
|||
return pattern.replace(/<<self>>/g, '[^\\s\\S]'); |
|||
} |
|||
|
|||
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/
|
|||
var keywordKinds = { |
|||
// keywords which represent a return or variable type
|
|||
type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void', |
|||
// keywords which are used to declare a type
|
|||
typeDeclaration: 'class enum interface struct', |
|||
// contextual keywords
|
|||
// ("var" and "dynamic" are missing because they are used like types)
|
|||
contextual: 'add alias ascending async await by descending from get global group into join let nameof notnull on orderby partial remove select set unmanaged value when where where', |
|||
// all other keywords
|
|||
other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield' |
|||
}; |
|||
|
|||
// keywords
|
|||
function keywordsToPattern(words) { |
|||
return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b'; |
|||
} |
|||
var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration); |
|||
var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other)); |
|||
var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other); |
|||
var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other); |
|||
|
|||
// types
|
|||
var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2); // the idea behind the other forbidden characters is to prevent false positives. Same for tupleElement.
|
|||
var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2); |
|||
var name = /@?\b[A-Za-z_]\w*\b/.source; |
|||
var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]); |
|||
var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [nonTypeKeywords, genericName]); |
|||
var array = /\[\s*(?:,\s*)*\]/.source; |
|||
var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [generic, nestedRound, array]) |
|||
var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]); |
|||
var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [tuple, identifier, array]); |
|||
|
|||
var typeInside = { |
|||
'keyword': keywords, |
|||
'punctuation': /[<>()?,.:[\]]/ |
|||
}; |
|||
|
|||
// strings & characters
|
|||
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#character-literals
|
|||
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#string-literals
|
|||
var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source; // simplified pattern
|
|||
var regularString = /"(?:\\.|[^\\"\r\n])*"/.source; |
|||
var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source; |
|||
|
|||
|
|||
Prism.languages.csharp = Prism.languages.extend('clike', { |
|||
'string': [ |
|||
{ |
|||
pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]), |
|||
lookbehind: true, |
|||
greedy: true |
|||
}, |
|||
{ |
|||
pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]), |
|||
lookbehind: true, |
|||
greedy: true |
|||
}, |
|||
{ |
|||
pattern: RegExp(character), |
|||
greedy: true, |
|||
alias: 'character' |
|||
} |
|||
], |
|||
'class-name': [ |
|||
{ |
|||
// Using static
|
|||
// using static System.Math;
|
|||
pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]), |
|||
lookbehind: true, |
|||
inside: typeInside |
|||
}, |
|||
{ |
|||
// Using alias (type)
|
|||
// using Project = PC.MyCompany.Project;
|
|||
pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [name, typeExpression]), |
|||
lookbehind: true, |
|||
inside: typeInside |
|||
}, |
|||
{ |
|||
// Using alias (alias)
|
|||
// using Project = PC.MyCompany.Project;
|
|||
pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]), |
|||
lookbehind: true |
|||
}, |
|||
{ |
|||
// Type declarations
|
|||
// class Foo<A, B>
|
|||
// interface Foo<out A, B>
|
|||
pattern: re(/(\b<<0>>\s+)<<1>>/.source, [typeDeclarationKeywords, genericName]), |
|||
lookbehind: true, |
|||
inside: typeInside |
|||
}, |
|||
{ |
|||
// Single catch exception declaration
|
|||
// catch(Foo)
|
|||
// (things like catch(Foo e) is covered by variable declaration)
|
|||
pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]), |
|||
lookbehind: true, |
|||
inside: typeInside |
|||
}, |
|||
{ |
|||
// Name of the type parameter of generic constraints
|
|||
// where Foo : class
|
|||
pattern: re(/(\bwhere\s+)<<0>>/.source, [name]), |
|||
lookbehind: true |
|||
}, |
|||
{ |
|||
// Casts and checks via as and is.
|
|||
// as Foo<A>, is Bar<B>
|
|||
// (things like if(a is Foo b) is covered by variable declaration)
|
|||
pattern: re(/(\b(?:is|as)\s+)<<0>>/.source, [typeExpression]), |
|||
lookbehind: true, |
|||
inside: typeInside |
|||
}, |
|||
{ |
|||
// Variable, field and parameter declaration
|
|||
// (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
|
|||
pattern: re(/\b<<0>>(?=\s+(?!<<1>>)<<2>>(?:\s*[=,;:{)\]]|\s+in))/.source, [typeExpression, nonContextualKeywords, name]), |
|||
inside: typeInside |
|||
} |
|||
], |
|||
'keyword': keywords, |
|||
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals
|
|||
'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:ul|lu|[dflmu])?\b/i, |
|||
'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/, |
|||
'punctuation': /\?\.?|::|[{}[\];(),.:]/ |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('csharp', 'number', { |
|||
'range': { |
|||
pattern: /\.\./, |
|||
alias: 'operator' |
|||
} |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('csharp', 'punctuation', { |
|||
'named-parameter': { |
|||
pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]), |
|||
lookbehind: true, |
|||
alias: 'punctuation' |
|||
} |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('csharp', 'class-name', { |
|||
'namespace': { |
|||
// namespace Foo.Bar {}
|
|||
// using Foo.Bar;
|
|||
pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]), |
|||
lookbehind: true, |
|||
inside: { |
|||
'punctuation': /\./ |
|||
} |
|||
}, |
|||
'type-expression': { |
|||
// default(Foo), typeof(Foo<Bar>), sizeof(int)
|
|||
pattern: re(/(\b(?:default|typeof|sizeof)\s*\(\s*)(?:[^()\s]|\s(?!\s*\))|<<0>>)*(?=\s*\))/.source, [nestedRound]), |
|||
lookbehind: true, |
|||
alias: 'class-name', |
|||
inside: typeInside |
|||
}, |
|||
'return-type': { |
|||
// Foo<Bar> ForBar(); Foo IFoo.Bar() => 0
|
|||
// int this[int index] => 0; T IReadOnlyList<T>.this[int index] => this[index];
|
|||
// int Foo => 0; int Foo { get; set } = 0;
|
|||
pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [typeExpression, identifier]), |
|||
inside: typeInside, |
|||
alias: 'class-name' |
|||
}, |
|||
'constructor-invocation': { |
|||
// new List<Foo<Bar[]>> { }
|
|||
pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]), |
|||
lookbehind: true, |
|||
inside: typeInside, |
|||
alias: 'class-name' |
|||
}, |
|||
/*'explicit-implementation': { |
|||
// int IFoo<Foo>.Bar => 0; void IFoo<Foo<Foo>>.Foo<T>();
|
|||
pattern: replace(/\b<<0>>(?=\.<<1>>)/, className, methodOrPropertyDeclaration), |
|||
inside: classNameInside, |
|||
alias: 'class-name' |
|||
},*/ |
|||
'generic-method': { |
|||
// foo<Bar>()
|
|||
pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [name, generic]), |
|||
inside: { |
|||
'function': re(/^<<0>>/.source, [name]), |
|||
'generic': { |
|||
pattern: RegExp(generic), |
|||
alias: 'class-name', |
|||
inside: typeInside |
|||
} |
|||
} |
|||
}, |
|||
'type-list': { |
|||
// The list of types inherited or of generic constraints
|
|||
// class Foo<F> : Bar, IList<FooBar>
|
|||
// where F : Bar, IList<int>
|
|||
pattern: re( |
|||
/\b((?:<<0>>\s+<<1>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>)(?:\s*,\s*(?:<<3>>|<<4>>))*(?=\s*(?:where|[{;]|=>|$))/.source, |
|||
[typeDeclarationKeywords, genericName, name, typeExpression, keywords.source] |
|||
), |
|||
lookbehind: true, |
|||
inside: { |
|||
'keyword': keywords, |
|||
'class-name': { |
|||
pattern: RegExp(typeExpression), |
|||
greedy: true, |
|||
inside: typeInside |
|||
}, |
|||
'punctuation': /,/ |
|||
} |
|||
}, |
|||
'preprocessor': { |
|||
pattern: /(^\s*)#.*/m, |
|||
lookbehind: true, |
|||
alias: 'property', |
|||
inside: { |
|||
// highlight preprocessor directives as keywords
|
|||
'directive': { |
|||
pattern: /(\s*#)\b(?:define|elif|else|endif|endregion|error|if|line|pragma|region|undef|warning)\b/, |
|||
lookbehind: true, |
|||
alias: 'keyword' |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
|
|||
// attributes
|
|||
var regularStringOrCharacter = regularString + '|' + character; |
|||
var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*[\s\S]*?\*\/|<<0>>/.source, [regularStringOrCharacter]); |
|||
var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2); |
|||
|
|||
// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/#attribute-targets
|
|||
var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source; |
|||
var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [identifier, roundExpression]); |
|||
|
|||
Prism.languages.insertBefore('csharp', 'class-name', { |
|||
'attribute': { |
|||
// Attributes
|
|||
// [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
|
|||
pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [attrTarget, attr]), |
|||
lookbehind: true, |
|||
greedy: true, |
|||
inside: { |
|||
'target': { |
|||
pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]), |
|||
alias: 'keyword' |
|||
}, |
|||
'attribute-arguments': { |
|||
pattern: re(/\(<<0>>*\)/.source, [roundExpression]), |
|||
inside: Prism.languages.csharp |
|||
}, |
|||
'class-name': { |
|||
pattern: RegExp(identifier), |
|||
inside: { |
|||
'punctuation': /\./ |
|||
} |
|||
}, |
|||
'punctuation': /[:,]/ |
|||
} |
|||
} |
|||
}); |
|||
|
|||
|
|||
// string interpolation
|
|||
var formatString = /:[^}\r\n]+/.source; |
|||
// multi line
|
|||
var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2) |
|||
var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]); |
|||
// single line
|
|||
var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*.*?\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2) |
|||
var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]); |
|||
|
|||
function createInterpolationInside(interpolation, interpolationRound) { |
|||
return { |
|||
'interpolation': { |
|||
pattern: re(/([^{](?:\{\{)*)<<0>>/.source, [interpolation]), |
|||
lookbehind: true, |
|||
inside: { |
|||
'format-string': { |
|||
pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [interpolationRound, formatString]), |
|||
lookbehind: true, |
|||
inside: { |
|||
'punctuation': /^:/ |
|||
} |
|||
}, |
|||
'punctuation': /^\{|\}$/, |
|||
'expression': { |
|||
pattern: /[\s\S]+/, |
|||
alias: 'language-csharp', |
|||
inside: Prism.languages.csharp |
|||
} |
|||
} |
|||
}, |
|||
'string': /[\s\S]+/ |
|||
}; |
|||
} |
|||
|
|||
Prism.languages.insertBefore('csharp', 'string', { |
|||
'interpolation-string': [ |
|||
{ |
|||
pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]), |
|||
lookbehind: true, |
|||
greedy: true, |
|||
inside: createInterpolationInside(mInterpolation, mInterpolationRound), |
|||
}, |
|||
{ |
|||
pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]), |
|||
lookbehind: true, |
|||
greedy: true, |
|||
inside: createInterpolationInside(sInterpolation, sInterpolationRound), |
|||
} |
|||
] |
|||
}); |
|||
|
|||
}(Prism)); |
|||
|
|||
Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp; |
|||
File diff suppressed because one or more lines are too long
@ -0,0 +1,25 @@ |
|||
/** |
|||
* Original by Scott Helme. |
|||
* |
|||
* Reference: https://scotthelme.co.uk/csp-cheat-sheet/
|
|||
* |
|||
* Supports the following: |
|||
* - CSP Level 1 |
|||
* - CSP Level 2 |
|||
* - CSP Level 3 |
|||
*/ |
|||
|
|||
Prism.languages.csp = { |
|||
'directive': { |
|||
pattern: /\b(?:(?:base-uri|form-action|frame-ancestors|plugin-types|referrer|reflected-xss|report-to|report-uri|require-sri-for|sandbox) |(?:block-all-mixed-content|disown-opener|upgrade-insecure-requests)(?: |;)|(?:child|connect|default|font|frame|img|manifest|media|object|script|style|worker)-src )/i, |
|||
alias: 'keyword' |
|||
}, |
|||
'safe': { |
|||
pattern: /'(?:self|none|strict-dynamic|(?:nonce-|sha(?:256|384|512)-)[a-zA-Z\d+=/]+)'/, |
|||
alias: 'selector' |
|||
}, |
|||
'unsafe': { |
|||
pattern: /(?:'unsafe-inline'|'unsafe-eval'|'unsafe-hashed-attributes'|\*)/, |
|||
alias: 'function' |
|||
} |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.csp={directive:{pattern:/\b(?:(?:base-uri|form-action|frame-ancestors|plugin-types|referrer|reflected-xss|report-to|report-uri|require-sri-for|sandbox) |(?:block-all-mixed-content|disown-opener|upgrade-insecure-requests)(?: |;)|(?:child|connect|default|font|frame|img|manifest|media|object|script|style|worker)-src )/i,alias:"keyword"},safe:{pattern:/'(?:self|none|strict-dynamic|(?:nonce-|sha(?:256|384|512)-)[a-zA-Z\d+=/]+)'/,alias:"selector"},unsafe:{pattern:/(?:'unsafe-inline'|'unsafe-eval'|'unsafe-hashed-attributes'|\*)/,alias:"function"}}; |
|||
@ -0,0 +1,109 @@ |
|||
(function (Prism) { |
|||
|
|||
var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/; |
|||
var selectorInside; |
|||
|
|||
Prism.languages.css.selector = { |
|||
pattern: Prism.languages.css.selector, |
|||
inside: selectorInside = { |
|||
'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/, |
|||
'pseudo-class': /:[-\w]+/, |
|||
'class': /\.[-:.\w]+/, |
|||
'id': /#[-:.\w]+/, |
|||
'attribute': { |
|||
pattern: RegExp('\\[(?:[^[\\]"\']|' + string.source + ')*\\]'), |
|||
greedy: true, |
|||
inside: { |
|||
'punctuation': /^\[|\]$/, |
|||
'case-sensitivity': { |
|||
pattern: /(\s)[si]$/i, |
|||
lookbehind: true, |
|||
alias: 'keyword' |
|||
}, |
|||
'namespace': { |
|||
pattern: /^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/, |
|||
lookbehind: true, |
|||
inside: { |
|||
'punctuation': /\|$/ |
|||
} |
|||
}, |
|||
'attribute': { |
|||
pattern: /^(\s*)[-\w\xA0-\uFFFF]+/, |
|||
lookbehind: true |
|||
}, |
|||
'value': [ |
|||
string, |
|||
{ |
|||
pattern: /(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/, |
|||
lookbehind: true |
|||
} |
|||
], |
|||
'operator': /[|~*^$]?=/ |
|||
} |
|||
}, |
|||
'n-th': [ |
|||
{ |
|||
pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/, |
|||
lookbehind: true, |
|||
inside: { |
|||
'number': /[\dn]+/, |
|||
'operator': /[+-]/ |
|||
} |
|||
}, |
|||
{ |
|||
pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i, |
|||
lookbehind: true |
|||
} |
|||
], |
|||
'punctuation': /[()]/ |
|||
} |
|||
}; |
|||
|
|||
Prism.languages.css['atrule'].inside['selector-function-argument'].inside = selectorInside; |
|||
|
|||
Prism.languages.insertBefore('css', 'property', { |
|||
'variable': { |
|||
pattern: /(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i, |
|||
lookbehind: true |
|||
} |
|||
}); |
|||
|
|||
var unit = { |
|||
pattern: /(\d)(?:%|[a-z]+)/, |
|||
lookbehind: true |
|||
}; |
|||
// 123 -123 .123 -.123 12.3 -12.3
|
|||
var number = { |
|||
pattern: /(^|[^\w.-])-?\d*\.?\d+/, |
|||
lookbehind: true |
|||
}; |
|||
|
|||
Prism.languages.insertBefore('css', 'function', { |
|||
'operator': { |
|||
pattern: /(\s)[+\-*\/](?=\s)/, |
|||
lookbehind: true |
|||
}, |
|||
// CAREFUL!
|
|||
// Previewers and Inline color use hexcode and color.
|
|||
'hexcode': { |
|||
pattern: /\B#(?:[\da-f]{1,2}){3,4}\b/i, |
|||
alias: 'color' |
|||
}, |
|||
'color': [ |
|||
/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i, |
|||
{ |
|||
pattern: /\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i, |
|||
inside: { |
|||
'unit': unit, |
|||
'number': number, |
|||
'function': /[\w-]+(?=\()/, |
|||
'punctuation': /[(),]/ |
|||
} |
|||
} |
|||
], |
|||
'entity': /\\[\da-f]{1,8}/i, |
|||
'unit': unit, |
|||
'number': number |
|||
}); |
|||
|
|||
})(Prism); |
|||
@ -0,0 +1 @@ |
|||
!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},attribute:{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},value:[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],punctuation:/[()]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var r={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},i={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:i,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:i})}(Prism); |
|||
@ -0,0 +1,63 @@ |
|||
(function (Prism) { |
|||
|
|||
var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/; |
|||
|
|||
Prism.languages.css = { |
|||
'comment': /\/\*[\s\S]*?\*\//, |
|||
'atrule': { |
|||
pattern: /@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/, |
|||
inside: { |
|||
'rule': /^@[\w-]+/, |
|||
'selector-function-argument': { |
|||
pattern: /(\bselector\s*\((?!\s*\))\s*)(?:[^()]|\((?:[^()]|\([^()]*\))*\))+?(?=\s*\))/, |
|||
lookbehind: true, |
|||
alias: 'selector' |
|||
} |
|||
// See rest below
|
|||
} |
|||
}, |
|||
'url': { |
|||
pattern: RegExp('url\\((?:' + string.source + '|[^\n\r()]*)\\)', 'i'), |
|||
greedy: true, |
|||
inside: { |
|||
'function': /^url/i, |
|||
'punctuation': /^\(|\)$/ |
|||
} |
|||
}, |
|||
'selector': RegExp('[^{}\\s](?:[^{};"\']|' + string.source + ')*?(?=\\s*\\{)'), |
|||
'string': { |
|||
pattern: string, |
|||
greedy: true |
|||
}, |
|||
'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i, |
|||
'important': /!important\b/i, |
|||
'function': /[-a-z0-9]+(?=\()/i, |
|||
'punctuation': /[(){};:,]/ |
|||
}; |
|||
|
|||
Prism.languages.css['atrule'].inside.rest = Prism.languages.css; |
|||
|
|||
var markup = Prism.languages.markup; |
|||
if (markup) { |
|||
markup.tag.addInlined('style', 'css'); |
|||
|
|||
Prism.languages.insertBefore('inside', 'attr-value', { |
|||
'style-attr': { |
|||
pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i, |
|||
inside: { |
|||
'attr-name': { |
|||
pattern: /^\s*style/i, |
|||
inside: markup.tag.inside |
|||
}, |
|||
'punctuation': /^\s*=\s*['"]|['"]\s*$/, |
|||
'attr-value': { |
|||
pattern: /.+/i, |
|||
inside: Prism.languages.css |
|||
} |
|||
}, |
|||
alias: 'language-css' |
|||
} |
|||
}, markup.tag); |
|||
} |
|||
|
|||
}(Prism)); |
|||
@ -0,0 +1 @@ |
|||
!function(s){var e=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\((?!\s*\))\s*)(?:[^()]|\((?:[^()]|\([^()]*\))*\))+?(?=\s*\))/,lookbehind:!0,alias:"selector"}}},url:{pattern:RegExp("url\\((?:"+e.source+"|[^\n\r()]*)\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/}},selector:RegExp("[^{}\\s](?:[^{};\"']|"+e.source+")*?(?=\\s*\\{)"),string:{pattern:e,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var t=s.languages.markup;t&&(t.tag.addInlined("style","css"),s.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:t.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:s.languages.css}},alias:"language-css"}},t.tag))}(Prism); |
|||
@ -0,0 +1,79 @@ |
|||
Prism.languages.d = Prism.languages.extend('clike', { |
|||
'comment': [ |
|||
{ |
|||
// Shebang
|
|||
pattern: /^\s*#!.+/, |
|||
greedy: true |
|||
}, |
|||
{ |
|||
pattern: RegExp(/(^|[^\\])/.source + '(?:' + [ |
|||
// /+ comment +/
|
|||
// Allow one level of nesting
|
|||
/\/\+(?:\/\+[\s\S]*?\+\/|(?!\/\+)[\s\S])*?\+\//.source, |
|||
// // comment
|
|||
/\/\/.*/.source, |
|||
// /* comment */
|
|||
/\/\*[\s\S]*?\*\//.source |
|||
].join('|') + ')'), |
|||
lookbehind: true, |
|||
greedy: true |
|||
} |
|||
], |
|||
'string': [ |
|||
{ |
|||
pattern: RegExp([ |
|||
// r"", x""
|
|||
/\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/.source, |
|||
|
|||
// q"[]", q"()", q"<>", q"{}"
|
|||
/\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/.source, |
|||
|
|||
// q"IDENT
|
|||
// ...
|
|||
// IDENT"
|
|||
/\bq"((?!\d)\w+)$[\s\S]*?^\1"/.source, |
|||
|
|||
// q"//", q"||", etc.
|
|||
/\bq"(.)[\s\S]*?\2"/.source, |
|||
|
|||
// Characters
|
|||
// 'a', '\\', '\n', '\xFF', '\377', '\uFFFF', '\U0010FFFF', '\quot'
|
|||
/'(?:\\(?:\W|\w+)|[^\\])'/.source, |
|||
|
|||
/(["`])(?:\\[\s\S]|(?!\3)[^\\])*\3[cwd]?/.source |
|||
].join('|'), 'm'), |
|||
greedy: true |
|||
}, |
|||
{ |
|||
pattern: /\bq\{(?:\{[^{}]*\}|[^{}])*\}/, |
|||
greedy: true, |
|||
alias: 'token-string' |
|||
} |
|||
], |
|||
|
|||
'number': [ |
|||
// The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator
|
|||
// Hexadecimal numbers must be handled separately to avoid problems with exponent "e"
|
|||
/\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i, |
|||
{ |
|||
pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i, |
|||
lookbehind: true |
|||
} |
|||
], |
|||
|
|||
// In order: $, keywords and special tokens, globally defined symbols
|
|||
'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/, |
|||
'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/ |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('d', 'keyword', { |
|||
'property': /\B@\w*/ |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('d', 'function', { |
|||
'register': { |
|||
// Iasm registers
|
|||
pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/, |
|||
alias: 'variable' |
|||
} |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.d=Prism.languages.extend("clike",{comment:[{pattern:/^\s*#!.+/,greedy:!0},{pattern:RegExp("(^|[^\\\\])(?:"+["\\/\\+(?:\\/\\+[\\s\\S]*?\\+\\/|(?!\\/\\+)[\\s\\S])*?\\+\\/","\\/\\/.*","\\/\\*[\\s\\S]*?\\*\\/"].join("|")+")"),lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(['\\b[rx]"(?:\\\\[\\s\\S]|[^\\\\"])*"[cwd]?','\\bq"(?:\\[[\\s\\S]*?\\]|\\([\\s\\S]*?\\)|<[\\s\\S]*?>|\\{[\\s\\S]*?\\})"','\\bq"((?!\\d)\\w+)$[\\s\\S]*?^\\1"','\\bq"(.)[\\s\\S]*?\\2"',"'(?:\\\\(?:\\W|\\w+)|[^\\\\])'",'(["`])(?:\\\\[\\s\\S]|(?!\\3)[^\\\\])*\\3[cwd]?'].join("|"),"m"),greedy:!0},{pattern:/\bq\{(?:\{[^{}]*\}|[^{}])*\}/,greedy:!0,alias:"token-string"}],number:[/\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i,{pattern:/((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i,lookbehind:!0}],keyword:/\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/,operator:/\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/}),Prism.languages.insertBefore("d","keyword",{property:/\B@\w*/}),Prism.languages.insertBefore("d","function",{register:{pattern:/\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,alias:"variable"}}); |
|||
@ -0,0 +1,24 @@ |
|||
Prism.languages.dart = Prism.languages.extend('clike', { |
|||
'string': [ |
|||
{ |
|||
pattern: /r?("""|''')[\s\S]*?\1/, |
|||
greedy: true |
|||
}, |
|||
{ |
|||
pattern: /r?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, |
|||
greedy: true |
|||
} |
|||
], |
|||
'keyword': [ |
|||
/\b(?:async|sync|yield)\*/, |
|||
/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/ |
|||
], |
|||
'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/ |
|||
}); |
|||
|
|||
Prism.languages.insertBefore('dart','function',{ |
|||
'metadata': { |
|||
pattern: /@\w+/, |
|||
alias: 'symbol' |
|||
} |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.dart=Prism.languages.extend("clike",{string:[{pattern:/r?("""|''')[\s\S]*?\1/,greedy:!0},{pattern:/r?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0}],keyword:[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/],operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),Prism.languages.insertBefore("dart","function",{metadata:{pattern:/@\w+/,alias:"symbol"}}); |
|||
@ -0,0 +1,27 @@ |
|||
Prism.languages.dax = { |
|||
'comment': { |
|||
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/).*)/, |
|||
lookbehind: true |
|||
}, |
|||
'data-field': { |
|||
pattern: /'(?:[^']|'')*'(?!')(?:\[[ \w\xA0-\uFFFF]+\])?|\w+\[[ \w\xA0-\uFFFF]+\]/, |
|||
alias: 'symbol' |
|||
}, |
|||
'measure': { |
|||
pattern: /\[[ \w\xA0-\uFFFF]+\]/, |
|||
alias: 'constant' |
|||
}, |
|||
'string': { |
|||
pattern: /"(?:[^"]|"")*"(?!")/, |
|||
greedy: true |
|||
}, |
|||
'function': /\b(?:ABS|ACOS|ACOSH|ACOT|ACOTH|ADDCOLUMNS|ADDMISSINGITEMS|ALL|ALLCROSSFILTERED|ALLEXCEPT|ALLNOBLANKROW|ALLSELECTED|AND|APPROXIMATEDISTINCTCOUNT|ASIN|ASINH|ATAN|ATANH|AVERAGE|AVERAGEA|AVERAGEX|BETA\.DIST|BETA\.INV|BLANK|CALCULATE|CALCULATETABLE|CALENDAR|CALENDARAUTO|CEILING|CHISQ\.DIST|CHISQ\.DIST\.RT|CHISQ\.INV|CHISQ\.INV\.RT|CLOSINGBALANCEMONTH|CLOSINGBALANCEQUARTER|CLOSINGBALANCEYEAR|COALESCE|COMBIN|COMBINA|COMBINEVALUES|CONCATENATE|CONCATENATEX|CONFIDENCE\.NORM|CONFIDENCE\.T|CONTAINS|CONTAINSROW|CONTAINSSTRING|CONTAINSSTRINGEXACT|CONVERT|COS|COSH|COT|COTH|COUNT|COUNTA|COUNTAX|COUNTBLANK|COUNTROWS|COUNTX|CROSSFILTER|CROSSJOIN|CURRENCY|CURRENTGROUP|CUSTOMDATA|DATATABLE|DATE|DATEADD|DATEDIFF|DATESBETWEEN|DATESINPERIOD|DATESMTD|DATESQTD|DATESYTD|DATEVALUE|DAY|DEGREES|DETAILROWS|DISTINCT|DISTINCTCOUNT|DISTINCTCOUNTNOBLANK|DIVIDE|EARLIER|EARLIEST|EDATE|ENDOFMONTH|ENDOFQUARTER|ENDOFYEAR|EOMONTH|ERROR|EVEN|EXACT|EXCEPT|EXP|EXPON\.DIST|FACT|FALSE|FILTER|FILTERS|FIND|FIRSTDATE|FIRSTNONBLANK|FIRSTNONBLANKVALUE|FIXED|FLOOR|FORMAT|GCD|GENERATE|GENERATEALL|GENERATESERIES|GEOMEAN|GEOMEANX|GROUPBY|HASONEFILTER|HASONEVALUE|HOUR|IF|IF\.EAGER|IFERROR|IGNORE|INT|INTERSECT|ISBLANK|ISCROSSFILTERED|ISEMPTY|ISERROR|ISEVEN|ISFILTERED|ISINSCOPE|ISLOGICAL|ISNONTEXT|ISNUMBER|ISO\.CEILING|ISODD|ISONORAFTER|ISSELECTEDMEASURE|ISSUBTOTAL|ISTEXT|KEEPFILTERS|KEYWORDMATCH|LASTDATE|LASTNONBLANK|LASTNONBLANKVALUE|LCM|LEFT|LEN|LN|LOG|LOG10|LOOKUPVALUE|LOWER|MAX|MAXA|MAXX|MEDIAN|MEDIANX|MID|MIN|MINA|MINUTE|MINX|MOD|MONTH|MROUND|NATURALINNERJOIN|NATURALLEFTOUTERJOIN|NEXTDAY|NEXTMONTH|NEXTQUARTER|NEXTYEAR|NONVISUAL|NORM\.DIST|NORM\.INV|NORM\.S\.DIST|NORM\.S\.INV|NOT|NOW|ODD|OPENINGBALANCEMONTH|OPENINGBALANCEQUARTER|OPENINGBALANCEYEAR|OR|PARALLELPERIOD|PATH|PATHCONTAINS|PATHITEM|PATHITEMREVERSE|PATHLENGTH|PERCENTILE\.EXC|PERCENTILE\.INC|PERCENTILEX\.EXC|PERCENTILEX\.INC|PERMUT|PI|POISSON\.DIST|POWER|PREVIOUSDAY|PREVIOUSMONTH|PREVIOUSQUARTER|PREVIOUSYEAR|PRODUCT|PRODUCTX|QUARTER|QUOTIENT|RADIANS|RAND|RANDBETWEEN|RANK\.EQ|RANKX|RELATED|RELATEDTABLE|REMOVEFILTERS|REPLACE|REPT|RIGHT|ROLLUP|ROLLUPADDISSUBTOTAL|ROLLUPGROUP|ROLLUPISSUBTOTAL|ROUND|ROUNDDOWN|ROUNDUP|ROW|SAMEPERIODLASTYEAR|SAMPLE|SEARCH|SECOND|SELECTCOLUMNS|SELECTEDMEASURE|SELECTEDMEASUREFORMATSTRING|SELECTEDMEASURENAME|SELECTEDVALUE|SIGN|SIN|SINH|SQRT|SQRTPI|STARTOFMONTH|STARTOFQUARTER|STARTOFYEAR|STDEV\.P|STDEV\.S|STDEVX\.P|STDEVX\.S|SUBSTITUTE|SUBSTITUTEWITHINDEX|SUM|SUMMARIZE|SUMMARIZECOLUMNS|SUMX|SWITCH|T\.DIST|T\.DIST\.2T|T\.DIST\.RT|T\.INV|T\.INV\.2T|TAN|TANH|TIME|TIMEVALUE|TODAY|TOPN|TOPNPERLEVEL|TOPNSKIP|TOTALMTD|TOTALQTD|TOTALYTD|TREATAS|TRIM|TRUE|TRUNC|UNICHAR|UNICODE|UNION|UPPER|USERELATIONSHIP|USERNAME|USEROBJECTID|USERPRINCIPALNAME|UTCNOW|UTCTODAY|VALUE|VALUES|VAR\.P|VAR\.S|VARX\.P|VARX\.S|WEEKDAY|WEEKNUM|XIRR|XNPV|YEAR|YEARFRAC)(?=\s*\()/i, |
|||
'keyword': /\b(?:DEFINE|MEASURE|EVALUATE|ORDER\s+BY|RETURN|VAR|START\s+AT|ASC|DESC)\b/i, |
|||
'boolean': { |
|||
pattern: /\b(?:TRUE|FALSE|NULL)\b/i, |
|||
alias: 'constant' |
|||
}, |
|||
'number': /\b\d+\.?\d*|\B\.\d+\b/i, |
|||
'operator': /:=|[-+*\/=^]|&&?|\|\||<(?:=>?|<|>)?|>[>=]?|\b(?:IN|NOT)\b/i, |
|||
'punctuation': /[;\[\](){}`,.]/ |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
Prism.languages.dax={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/).*)/,lookbehind:!0},"data-field":{pattern:/'(?:[^']|'')*'(?!')(?:\[[ \w\xA0-\uFFFF]+\])?|\w+\[[ \w\xA0-\uFFFF]+\]/,alias:"symbol"},measure:{pattern:/\[[ \w\xA0-\uFFFF]+\]/,alias:"constant"},string:{pattern:/"(?:[^"]|"")*"(?!")/,greedy:!0},function:/\b(?:ABS|ACOS|ACOSH|ACOT|ACOTH|ADDCOLUMNS|ADDMISSINGITEMS|ALL|ALLCROSSFILTERED|ALLEXCEPT|ALLNOBLANKROW|ALLSELECTED|AND|APPROXIMATEDISTINCTCOUNT|ASIN|ASINH|ATAN|ATANH|AVERAGE|AVERAGEA|AVERAGEX|BETA\.DIST|BETA\.INV|BLANK|CALCULATE|CALCULATETABLE|CALENDAR|CALENDARAUTO|CEILING|CHISQ\.DIST|CHISQ\.DIST\.RT|CHISQ\.INV|CHISQ\.INV\.RT|CLOSINGBALANCEMONTH|CLOSINGBALANCEQUARTER|CLOSINGBALANCEYEAR|COALESCE|COMBIN|COMBINA|COMBINEVALUES|CONCATENATE|CONCATENATEX|CONFIDENCE\.NORM|CONFIDENCE\.T|CONTAINS|CONTAINSROW|CONTAINSSTRING|CONTAINSSTRINGEXACT|CONVERT|COS|COSH|COT|COTH|COUNT|COUNTA|COUNTAX|COUNTBLANK|COUNTROWS|COUNTX|CROSSFILTER|CROSSJOIN|CURRENCY|CURRENTGROUP|CUSTOMDATA|DATATABLE|DATE|DATEADD|DATEDIFF|DATESBETWEEN|DATESINPERIOD|DATESMTD|DATESQTD|DATESYTD|DATEVALUE|DAY|DEGREES|DETAILROWS|DISTINCT|DISTINCTCOUNT|DISTINCTCOUNTNOBLANK|DIVIDE|EARLIER|EARLIEST|EDATE|ENDOFMONTH|ENDOFQUARTER|ENDOFYEAR|EOMONTH|ERROR|EVEN|EXACT|EXCEPT|EXP|EXPON\.DIST|FACT|FALSE|FILTER|FILTERS|FIND|FIRSTDATE|FIRSTNONBLANK|FIRSTNONBLANKVALUE|FIXED|FLOOR|FORMAT|GCD|GENERATE|GENERATEALL|GENERATESERIES|GEOMEAN|GEOMEANX|GROUPBY|HASONEFILTER|HASONEVALUE|HOUR|IF|IF\.EAGER|IFERROR|IGNORE|INT|INTERSECT|ISBLANK|ISCROSSFILTERED|ISEMPTY|ISERROR|ISEVEN|ISFILTERED|ISINSCOPE|ISLOGICAL|ISNONTEXT|ISNUMBER|ISO\.CEILING|ISODD|ISONORAFTER|ISSELECTEDMEASURE|ISSUBTOTAL|ISTEXT|KEEPFILTERS|KEYWORDMATCH|LASTDATE|LASTNONBLANK|LASTNONBLANKVALUE|LCM|LEFT|LEN|LN|LOG|LOG10|LOOKUPVALUE|LOWER|MAX|MAXA|MAXX|MEDIAN|MEDIANX|MID|MIN|MINA|MINUTE|MINX|MOD|MONTH|MROUND|NATURALINNERJOIN|NATURALLEFTOUTERJOIN|NEXTDAY|NEXTMONTH|NEXTQUARTER|NEXTYEAR|NONVISUAL|NORM\.DIST|NORM\.INV|NORM\.S\.DIST|NORM\.S\.INV|NOT|NOW|ODD|OPENINGBALANCEMONTH|OPENINGBALANCEQUARTER|OPENINGBALANCEYEAR|OR|PARALLELPERIOD|PATH|PATHCONTAINS|PATHITEM|PATHITEMREVERSE|PATHLENGTH|PERCENTILE\.EXC|PERCENTILE\.INC|PERCENTILEX\.EXC|PERCENTILEX\.INC|PERMUT|PI|POISSON\.DIST|POWER|PREVIOUSDAY|PREVIOUSMONTH|PREVIOUSQUARTER|PREVIOUSYEAR|PRODUCT|PRODUCTX|QUARTER|QUOTIENT|RADIANS|RAND|RANDBETWEEN|RANK\.EQ|RANKX|RELATED|RELATEDTABLE|REMOVEFILTERS|REPLACE|REPT|RIGHT|ROLLUP|ROLLUPADDISSUBTOTAL|ROLLUPGROUP|ROLLUPISSUBTOTAL|ROUND|ROUNDDOWN|ROUNDUP|ROW|SAMEPERIODLASTYEAR|SAMPLE|SEARCH|SECOND|SELECTCOLUMNS|SELECTEDMEASURE|SELECTEDMEASUREFORMATSTRING|SELECTEDMEASURENAME|SELECTEDVALUE|SIGN|SIN|SINH|SQRT|SQRTPI|STARTOFMONTH|STARTOFQUARTER|STARTOFYEAR|STDEV\.P|STDEV\.S|STDEVX\.P|STDEVX\.S|SUBSTITUTE|SUBSTITUTEWITHINDEX|SUM|SUMMARIZE|SUMMARIZECOLUMNS|SUMX|SWITCH|T\.DIST|T\.DIST\.2T|T\.DIST\.RT|T\.INV|T\.INV\.2T|TAN|TANH|TIME|TIMEVALUE|TODAY|TOPN|TOPNPERLEVEL|TOPNSKIP|TOTALMTD|TOTALQTD|TOTALYTD|TREATAS|TRIM|TRUE|TRUNC|UNICHAR|UNICODE|UNION|UPPER|USERELATIONSHIP|USERNAME|USEROBJECTID|USERPRINCIPALNAME|UTCNOW|UTCTODAY|VALUE|VALUES|VAR\.P|VAR\.S|VARX\.P|VARX\.S|WEEKDAY|WEEKNUM|XIRR|XNPV|YEAR|YEARFRAC)(?=\s*\()/i,keyword:/\b(?:DEFINE|MEASURE|EVALUATE|ORDER\s+BY|RETURN|VAR|START\s+AT|ASC|DESC)\b/i,boolean:{pattern:/\b(?:TRUE|FALSE|NULL)\b/i,alias:"constant"},number:/\b\d+\.?\d*|\B\.\d+\b/i,operator:/:=|[-+*\/=^]|&&?|\|\||<(?:=>?|<|>)?|>[>=]?|\b(?:IN|NOT)\b/i,punctuation:/[;\[\](){}`,.]/}; |
|||
@ -0,0 +1,54 @@ |
|||
(function (Prism) { |
|||
|
|||
Prism.languages.diff = { |
|||
'coord': [ |
|||
// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
|
|||
/^(?:\*{3}|-{3}|\+{3}).*$/m, |
|||
// Match "@@ ... @@" coord lines in unified diff.
|
|||
/^@@.*@@$/m, |
|||
// Match coord lines in normal diff (starts with a number).
|
|||
/^\d+.*$/m |
|||
] |
|||
|
|||
// deleted, inserted, unchanged, diff
|
|||
}; |
|||
|
|||
/** |
|||
* A map from the name of a block to its line prefix. |
|||
* |
|||
* @type {Object<string, string>} |
|||
*/ |
|||
var PREFIXES = { |
|||
'deleted-sign': '-', |
|||
'deleted-arrow': '<', |
|||
'inserted-sign': '+', |
|||
'inserted-arrow': '>', |
|||
'unchanged': ' ', |
|||
'diff': '!', |
|||
}; |
|||
|
|||
// add a token for each prefix
|
|||
Object.keys(PREFIXES).forEach(function (name) { |
|||
var prefix = PREFIXES[name]; |
|||
|
|||
var alias = []; |
|||
if (!/^\w+$/.test(name)) { // "deleted-sign" -> "deleted"
|
|||
alias.push(/\w+/.exec(name)[0]); |
|||
} |
|||
if (name === "diff") { |
|||
alias.push("bold"); |
|||
} |
|||
|
|||
Prism.languages.diff[name] = { |
|||
// pattern: /^(?:[_].*(?:\r\n?|\n|(?![\s\S])))+/m
|
|||
pattern: RegExp('^(?:[' + prefix + '].*(?:\r\n?|\n|(?![\\s\\S])))+', 'm'), |
|||
alias: alias |
|||
}; |
|||
}); |
|||
|
|||
// make prefixes available to Diff plugin
|
|||
Object.defineProperty(Prism.languages.diff, 'PREFIXES', { |
|||
value: PREFIXES |
|||
}); |
|||
|
|||
}(Prism)); |
|||
@ -0,0 +1 @@ |
|||
!function(d){d.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d+.*$/m]};var r={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(r).forEach(function(e){var n=r[e],a=[];/^\w+$/.test(e)||a.push(/\w+/.exec(e)[0]),"diff"===e&&a.push("bold"),d.languages.diff[e]={pattern:RegExp("^(?:["+n+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:a}}),Object.defineProperty(d.languages.diff,"PREFIXES",{value:r})}(Prism); |
|||
@ -0,0 +1,60 @@ |
|||
// Django/Jinja2 syntax definition for Prism.js <http://prismjs.com> syntax highlighter.
|
|||
// Mostly it works OK but can paint code incorrectly on complex html/template tag combinations.
|
|||
|
|||
(function (Prism) { |
|||
|
|||
Prism.languages.django = { |
|||
'comment': /^{#[\s\S]*?#}$/, |
|||
'tag': { |
|||
pattern: /(^{%[+-]?\s*)\w+/, |
|||
lookbehind: true, |
|||
alias: 'keyword' |
|||
}, |
|||
'delimiter': { |
|||
pattern: /^{[{%][+-]?|[+-]?[}%]}$/, |
|||
alias: 'punctuation' |
|||
}, |
|||
'string': { |
|||
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, |
|||
greedy: true |
|||
}, |
|||
'filter': { |
|||
pattern: /(\|)\w+/, |
|||
lookbehind: true, |
|||
alias: 'function' |
|||
}, |
|||
'test': { |
|||
pattern: /(\bis\s+(?:not\s+)?)(?!not\b)\w+/, |
|||
lookbehind: true, |
|||
alias: 'function' |
|||
}, |
|||
'function': /\b[a-z_]\w+(?=\s*\()/i, |
|||
'keyword': /\b(?:and|as|by|else|for|if|import|in|is|loop|not|or|recursive|with|without)\b/, |
|||
'operator': /[-+*/%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/, |
|||
'number': /\b\d+(?:\.\d+)?\b/, |
|||
'boolean': /[Tt]rue|[Ff]alse|[Nn]one/, |
|||
'variable': /\b\w+?\b/, |
|||
'punctuation': /[{}[\](),.:;]/ |
|||
}; |
|||
|
|||
|
|||
var pattern = /{{[\s\S]*?}}|{%[\s\S]*?%}|{#[\s\S]*?#}/g; |
|||
var markupTemplating = Prism.languages['markup-templating']; |
|||
|
|||
Prism.hooks.add('before-tokenize', function (env) { |
|||
markupTemplating.buildPlaceholders(env, 'django', pattern); |
|||
}); |
|||
Prism.hooks.add('after-tokenize', function (env) { |
|||
markupTemplating.tokenizePlaceholders(env, 'django'); |
|||
}); |
|||
|
|||
// Add an Jinja2 alias
|
|||
Prism.languages.jinja2 = Prism.languages.django; |
|||
Prism.hooks.add('before-tokenize', function (env) { |
|||
markupTemplating.buildPlaceholders(env, 'jinja2', pattern); |
|||
}); |
|||
Prism.hooks.add('after-tokenize', function (env) { |
|||
markupTemplating.tokenizePlaceholders(env, 'jinja2'); |
|||
}); |
|||
|
|||
})(Prism); |
|||
@ -0,0 +1 @@ |
|||
!function(e){e.languages.django={comment:/^{#[\s\S]*?#}$/,tag:{pattern:/(^{%[+-]?\s*)\w+/,lookbehind:!0,alias:"keyword"},delimiter:{pattern:/^{[{%][+-]?|[+-]?[}%]}$/,alias:"punctuation"},string:{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},filter:{pattern:/(\|)\w+/,lookbehind:!0,alias:"function"},test:{pattern:/(\bis\s+(?:not\s+)?)(?!not\b)\w+/,lookbehind:!0,alias:"function"},function:/\b[a-z_]\w+(?=\s*\()/i,keyword:/\b(?:and|as|by|else|for|if|import|in|is|loop|not|or|recursive|with|without)\b/,operator:/[-+*/%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,number:/\b\d+(?:\.\d+)?\b/,boolean:/[Tt]rue|[Ff]alse|[Nn]one/,variable:/\b\w+?\b/,punctuation:/[{}[\](),.:;]/};var n=/{{[\s\S]*?}}|{%[\s\S]*?%}|{#[\s\S]*?#}/g,o=e.languages["markup-templating"];e.hooks.add("before-tokenize",function(e){o.buildPlaceholders(e,"django",n)}),e.hooks.add("after-tokenize",function(e){o.tokenizePlaceholders(e,"django")}),e.languages.jinja2=e.languages.django,e.hooks.add("before-tokenize",function(e){o.buildPlaceholders(e,"jinja2",n)}),e.hooks.add("after-tokenize",function(e){o.tokenizePlaceholders(e,"jinja2")})}(Prism); |
|||
@ -0,0 +1,33 @@ |
|||
Prism.languages['dns-zone-file'] = { |
|||
'comment': /;.*/, |
|||
'string': { |
|||
pattern: /"(?:\\.|[^"\\\r\n])*"/, |
|||
greedy: true |
|||
}, |
|||
'variable': [ |
|||
{ |
|||
pattern: /(^\$ORIGIN[ \t]+)\S+/m, |
|||
lookbehind: true, |
|||
}, |
|||
{ |
|||
pattern: /(^|\s)@(?=\s|$)/, |
|||
lookbehind: true, |
|||
} |
|||
], |
|||
'keyword': /^\$(?:ORIGIN|INCLUDE|TTL)(?=\s|$)/m, |
|||
'class': { |
|||
// https://tools.ietf.org/html/rfc1035#page-13
|
|||
pattern: /(^|\s)(?:IN|CH|CS|HS)(?=\s|$)/, |
|||
lookbehind: true, |
|||
alias: 'keyword' |
|||
}, |
|||
'type': { |
|||
// https://en.wikipedia.org/wiki/List_of_DNS_record_types
|
|||
pattern: /(^|\s)(?:A|A6|AAAA|AFSDB|APL|ATMA|CAA|CDNSKEY|CDS|CERT|CNAME|DHCID|DLV|DNAME|DNSKEY|DS|EID|GID|GPOS|HINFO|HIP|IPSECKEY|ISDN|KEY|KX|LOC|MAILA|MAILB|MB|MD|MF|MG|MINFO|MR|MX|NAPTR|NB|NBSTAT|NIMLOC|NINFO|NS|NSAP|NSAP-PTR|NSEC|NSEC3|NSEC3PARAM|NULL|NXT|OPENPGPKEY|PTR|PX|RKEY|RP|RRSIG|RT|SIG|SINK|SMIMEA|SOA|SPF|SRV|SSHFP|TA|TKEY|TLSA|TSIG|TXT|UID|UINFO|UNSPEC|URI|WKS|X25)(?=\s|$)/, |
|||
lookbehind: true, |
|||
alias: 'keyword' |
|||
}, |
|||
'punctuation': /[()]/ |
|||
}; |
|||
|
|||
Prism.languages['dns-zone'] = Prism.languages['dns-zone-file'] |
|||
@ -0,0 +1 @@ |
|||
Prism.languages["dns-zone-file"]={comment:/;.*/,string:{pattern:/"(?:\\.|[^"\\\r\n])*"/,greedy:!0},variable:[{pattern:/(^\$ORIGIN[ \t]+)\S+/m,lookbehind:!0},{pattern:/(^|\s)@(?=\s|$)/,lookbehind:!0}],keyword:/^\$(?:ORIGIN|INCLUDE|TTL)(?=\s|$)/m,class:{pattern:/(^|\s)(?:IN|CH|CS|HS)(?=\s|$)/,lookbehind:!0,alias:"keyword"},type:{pattern:/(^|\s)(?:A|A6|AAAA|AFSDB|APL|ATMA|CAA|CDNSKEY|CDS|CERT|CNAME|DHCID|DLV|DNAME|DNSKEY|DS|EID|GID|GPOS|HINFO|HIP|IPSECKEY|ISDN|KEY|KX|LOC|MAILA|MAILB|MB|MD|MF|MG|MINFO|MR|MX|NAPTR|NB|NBSTAT|NIMLOC|NINFO|NS|NSAP|NSAP-PTR|NSEC|NSEC3|NSEC3PARAM|NULL|NXT|OPENPGPKEY|PTR|PX|RKEY|RP|RRSIG|RT|SIG|SINK|SMIMEA|SOA|SPF|SRV|SSHFP|TA|TKEY|TLSA|TSIG|TXT|UID|UINFO|UNSPEC|URI|WKS|X25)(?=\s|$)/,lookbehind:!0,alias:"keyword"},punctuation:/[()]/},Prism.languages["dns-zone"]=Prism.languages["dns-zone-file"]; |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue