Socket
Socket
Sign inDemoInstall

highlight.js

Package Overview
Dependencies
Maintainers
5
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highlight.js - npm Package Compare versions

Comparing version 10.0.3 to 10.1.0

scss/lioshi.scss

1136

lib/core.js
// https://github.com/substack/deep-freeze/blob/master/index.js
function deepFreeze (o) {
Object.freeze(o);
/** @param {any} obj */
function deepFreeze(obj) {
Object.freeze(obj);
var objIsFunction = typeof o === 'function';
var objIsFunction = typeof obj === 'function';
Object.getOwnPropertyNames(o).forEach(function (prop) {
if (o.hasOwnProperty(prop)
&& o[prop] !== null
&& (typeof o[prop] === "object" || typeof o[prop] === "function")
Object.getOwnPropertyNames(obj).forEach(function(prop) {
if (Object.hasOwnProperty.call(obj, prop)
&& obj[prop] !== null
&& (typeof obj[prop] === "object" || typeof obj[prop] === "function")
// IE11 fix: https://github.com/highlightjs/highlight.js/issues/2318
// TODO: remove in the future
&& (objIsFunction ? prop !== 'caller' && prop !== 'callee' && prop !== 'arguments' : true)
&& !Object.isFrozen(o[prop])) {
deepFreeze(o[prop]);
&& !Object.isFrozen(obj[prop])) {
deepFreeze(obj[prop]);
}
});
return o;
return obj;
}
class Response {
/**
* @param {CompiledMode} mode
*/
constructor(mode) {
// eslint-disable-next-line no-undefined
if (mode.data === undefined) mode.data = {};
this.data = mode.data;
}
ignoreMatch() {
this.ignore = true;
}
}
/**
* @param {string} value
* @returns {string}
*/
function escapeHTML(value) {
return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
return value
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#x27;');
}
/**
* performs a shallow merge of multiple objects into one
*
* @arguments list of objects with properties to merge
* @returns a single new object
* @template T
* @param {T} original
* @param {Record<string,any>[]} objects
* @returns {T} a single new object
*/
function inherit(parent) { // inherit(parent, override_obj, override_obj, ...)
var key;
function inherit(original, ...objects) {
/** @type Record<string,any> */
var result = {};
var objects = Array.prototype.slice.call(arguments, 1);
for (key in parent)
result[key] = parent[key];
for (const key in original) {
result[key] = original[key];
}
objects.forEach(function(obj) {
for (key in obj)
for (const key in obj) {
result[key] = obj[key];
}
});
return result;
return /** @type {T} */ (result);
}

@@ -49,3 +77,12 @@

/**
* @typedef Event
* @property {'start'|'stop'} event
* @property {number} offset
* @property {Node} node
*/
/**
* @param {Node} node
*/
function tag(node) {

@@ -55,10 +92,13 @@ return node.nodeName.toLowerCase();

/**
* @param {Node} node
*/
function nodeStream(node) {
/** @type Event[] */
var result = [];
(function _nodeStream(node, offset) {
for (var child = node.firstChild; child; child = child.nextSibling) {
if (child.nodeType === 3)
if (child.nodeType === 3) {
offset += child.nodeValue.length;
else if (child.nodeType === 1) {
} else if (child.nodeType === 1) {
result.push({

@@ -87,2 +127,7 @@ event: 'start',

/**
* @param {any} original - the original stream
* @param {any} highlighted - stream of the highlighted source
* @param {string} value - the original source itself
*/
function mergeStreams(original, highlighted, value) {

@@ -119,9 +164,17 @@ var processed = 0;

/**
* @param {Node} node
*/
function open(node) {
function attr_str(a) {
return ' ' + a.nodeName + '="' + escapeHTML(a.value).replace(/"/g, '&quot;') + '"';
/** @param {Attr} attr */
function attr_str(attr) {
return ' ' + attr.nodeName + '="' + escapeHTML(attr.value) + '"';
}
// @ts-ignore
result += '<' + tag(node) + [].map.call(node.attributes, attr_str).join('') + '>';
}
/**
* @param {Node} node
*/
function close(node) {

@@ -131,2 +184,5 @@ result += '</' + tag(node) + '>';

/**
* @param {Event} event
*/
function render(event) {

@@ -173,4 +229,20 @@ (event.event === 'start' ? open : close)(event.node);

/**
* @typedef {object} Renderer
* @property {(text: string) => void} addText
* @property {(node: Node) => void} openNode
* @property {(node: Node) => void} closeNode
* @property {() => string} value
*/
/** @typedef {{kind?: string, sublanguage?: boolean}} Node */
/** @typedef {{walk: (r: Renderer) => void}} Tree */
/** */
const SPAN_CLOSE = '</span>';
/**
* Determines if a node needs to be wrapped in <span>
*
* @param {Node} node */
const emitsWrappingTags = (node) => {

@@ -180,11 +252,20 @@ return !!node.kind;

/** @type {Renderer} */
class HTMLRenderer {
constructor(tree, options) {
/**
* Creates a new HTMLRenderer
*
* @param {Tree} parseTree - the parse tree (must support `walk` API)
* @param {{classPrefix: string}} options
*/
constructor(parseTree, options) {
this.buffer = "";
this.classPrefix = options.classPrefix;
tree.walk(this);
parseTree.walk(this);
}
// renderer API
/**
* Adds texts to the output stream
*
* @param {string} text */
addText(text) {

@@ -194,2 +275,6 @@ this.buffer += escapeHTML(text);

/**
* Adds a node open to the output stream (if needed)
*
* @param {Node} node */
openNode(node) {

@@ -199,7 +284,12 @@ if (!emitsWrappingTags(node)) return;

let className = node.kind;
if (!node.sublanguage)
if (!node.sublanguage) {
className = `${this.classPrefix}${className}`;
}
this.span(className);
}
/**
* Adds a node close to the output stream (if needed)
*
* @param {Node} node */
closeNode(node) {

@@ -211,17 +301,29 @@ if (!emitsWrappingTags(node)) return;

/**
* returns the accumulated buffer
*/
value() {
return this.buffer;
}
// helpers
/**
* Builds a span element
*
* @param {string} className */
span(className) {
this.buffer += `<span class="${className}">`;
}
value() {
return this.buffer;
}
}
/** @typedef {{kind?: string, sublanguage?: boolean, children: Node[]} | string} Node */
/** @typedef {{kind?: string, sublanguage?: boolean, children: Node[]} } DataNode */
/** */
class TokenTree {
constructor() {
/** @type DataNode */
this.rootNode = { children: [] };
this.stack = [ this.rootNode ];
this.stack = [this.rootNode];
}

@@ -233,4 +335,5 @@

get root() { return this.rootNode };
get root() { return this.rootNode; }
/** @param {Node} node */
add(node) {

@@ -240,4 +343,6 @@ this.top.children.push(node);

/** @param {string} kind */
openNode(kind) {
let node = { kind, children: [] };
/** @type Node */
const node = { kind, children: [] };
this.add(node);

@@ -248,4 +353,7 @@ this.stack.push(node);

closeNode() {
if (this.stack.length > 1)
if (this.stack.length > 1) {
return this.stack.pop();
}
// eslint-disable-next-line no-undefined
return undefined;
}

@@ -261,6 +369,17 @@

/**
* @typedef { import("./html_renderer").Renderer } Renderer
* @param {Renderer} builder
*/
walk(builder) {
// this does not
return this.constructor._walk(builder, this.rootNode);
// this works
// return TokenTree._walk(builder, this.rootNode);
}
/**
* @param {Renderer} builder
* @param {Node} node
*/
static _walk(builder, node) {

@@ -277,12 +396,15 @@ if (typeof node === "string") {

/**
* @param {Node} node
*/
static _collapse(node) {
if (!node.children) {
return;
}
if (typeof node === "string") return;
if (!node.children) return;
if (node.children.every(el => typeof el === "string")) {
node.text = node.children.join("");
delete node["children"];
// node.text = node.children.join("");
// delete node.children;
node.children = [node.children.join("")];
} else {
node.children.forEach((child) => {
if (typeof child === "string") return;
TokenTree._collapse(child);

@@ -302,3 +424,3 @@ });

- addText(text)
- addSublanguage(emitter, subLangaugeName)
- addSublanguage(emitter, subLanguageName)
- finalize()

@@ -311,3 +433,10 @@ - openNode(kind)

*/
/**
* @implements {Emitter}
*/
class TokenTreeEmitter extends TokenTree {
/**
* @param {*} options
*/
constructor(options) {

@@ -318,2 +447,6 @@ super();

/**
* @param {string} text
* @param {string} kind
*/
addKeyword(text, kind) {

@@ -327,2 +460,5 @@ if (text === "") { return; }

/**
* @param {string} text
*/
addText(text) {

@@ -334,4 +470,9 @@ if (text === "") { return; }

/**
* @param {Emitter & {root: DataNode}} emitter
* @param {string} name
*/
addSublanguage(emitter, name) {
let node = emitter.root;
/** @type DataNode */
const node = emitter.root;
node.kind = name;

@@ -343,3 +484,3 @@ node.sublanguage = true;

toHTML() {
let renderer = new HTMLRenderer(this, this.options);
const renderer = new HTMLRenderer(this, this.options);
return renderer.value();

@@ -349,17 +490,38 @@ }

finalize() {
return;
return true;
}
}
/**
* @param {string} value
* @returns {RegExp}
* */
function escape(value) {
return new RegExp(value.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'm');
return new RegExp(value.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'm');
}
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
// if it's a regex get it's source,
// otherwise it's a string already so just return it
return (re && re.source) || re;
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* @param {RegExp} re
* @returns {number}
*/
function countMatchGroups(re) {

@@ -369,2 +531,7 @@ return (new RegExp(re.toString() + '|')).exec('').length - 1;

/**
* Does lexeme start with a regular expression match at the beginning
* @param {RegExp} re
* @param {string} lexeme
*/
function startsWith(re, lexeme) {

@@ -380,3 +547,8 @@ var match = re && re.exec(lexeme);

// is currently an exercise for the caller. :-)
function join(regexps, separator) {
/**
* @param {(string | RegExp)[]} regexps
* @param {string} separator
* @returns {string}
*/
function join(regexps, separator = "|") {
// backreferenceRe matches an open parenthesis or backreference. To avoid

@@ -408,3 +580,3 @@ // an incorrect parse, it additionally matches the following:

re = re.substring(match.index + match[0].length);
if (match[0][0] == '\\' && match[1]) {
if (match[0][0] === '\\' && match[1]) {
// Adjust the backreference.

@@ -414,3 +586,3 @@ ret += '\\' + String(Number(match[1]) + offset);

ret += match[0];
if (match[0] == '(') {
if (match[0] === '(') {
numCaptures++;

@@ -433,2 +605,26 @@ }

/**
* @param { Partial<Mode> & {binary?: string | RegExp} } opts
*/
const SHEBANG = (opts = {}) => {
const beginShebang = /^#![ ]*\//;
if (opts.binary) {
opts.begin = concat(
beginShebang,
/.*\b/,
opts.binary,
/\b.*/);
}
return inherit({
className: 'meta',
begin: beginShebang,
end: /$/,
relevance: 0,
/** @type {ModeCallback} */
"on:begin": (m, resp) => {
if (m.index !== 0) resp.ignoreMatch();
}
}, opts);
};
// Common modes

@@ -440,3 +636,4 @@ const BACKSLASH_ESCAPE = {

className: 'string',
begin: '\'', end: '\'',
begin: '\'',
end: '\'',
illegal: '\\n',

@@ -447,3 +644,4 @@ contains: [BACKSLASH_ESCAPE]

className: 'string',
begin: '"', end: '"',
begin: '"',
end: '"',
illegal: '\\n',

@@ -455,10 +653,19 @@ contains: [BACKSLASH_ESCAPE]

};
const COMMENT = function (begin, end, inherits) {
/**
* Creates a comment mode
*
* @param {string | RegExp} begin
* @param {string | RegExp} end
* @param {Mode | {}} [modeOptions]
* @returns {Partial<Mode>}
*/
const COMMENT = function(begin, end, modeOptions = {}) {
var mode = inherit(
{
className: 'comment',
begin: begin, end: end,
begin,
end,
contains: []
},
inherits || {}
modeOptions
);

@@ -468,3 +675,3 @@ mode.contains.push(PHRASAL_WORDS_MODE);

className: 'doctag',
begin: '(?:TODO|FIXME|NOTE|BUG|XXX):',
begin: '(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):',
relevance: 0

@@ -495,3 +702,3 @@ });

begin: NUMBER_RE + '(' +
'%|em|ex|ch|rem' +
'%|em|ex|ch|rem' +
'|vw|vh|vmin|vmax' +

@@ -513,6 +720,7 @@ '|cm|mm|in|pt|pc|px' +

// (which will then blow up when regex's `illegal` sees the newline)
begin: /(?=\/[^\/\n]*\/)/,
begin: /(?=\/[^/\n]*\/)/,
contains: [{
className: 'regexp',
begin: /\//, end: /\/[gimuy]*/,
begin: /\//,
end: /\/[gimuy]*/,
illegal: /\n/,

@@ -522,3 +730,4 @@ contains: [

{
begin: /\[/, end: /\]/,
begin: /\[/,
end: /\]/,
relevance: 0,

@@ -546,2 +755,19 @@ contains: [BACKSLASH_ESCAPE]

/**
* Adds end same as begin mechanics to a mode
*
* Your mode must include at least a single () match group as that first match
* group is what is used for comparison
* @param {Partial<Mode>} mode
*/
const END_SAME_AS_BEGIN = function(mode) {
return Object.assign(mode,
{
/** @type {ModeCallback} */
'on:begin': (m, resp) => { resp.data._beginMatch = m[1]; },
/** @type {ModeCallback} */
'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); }
});
};
var MODES = /*#__PURE__*/Object.freeze({

@@ -555,2 +781,3 @@ __proto__: null,

RE_STARTERS_RE: RE_STARTERS_RE,
SHEBANG: SHEBANG,
BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,

@@ -571,3 +798,4 @@ APOS_STRING_MODE: APOS_STRING_MODE,

UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE,
METHOD_GUARD: METHOD_GUARD
METHOD_GUARD: METHOD_GUARD,
END_SAME_AS_BEGIN: END_SAME_AS_BEGIN
});

@@ -580,4 +808,17 @@

/**
* Compiles a language definition result
*
* Given the raw result of a language definition (Language), compiles this so
* that it is ready for highlighting code.
* @param {Language} language
* @returns {CompiledLanguage}
*/
function compileLanguage(language) {
/**
* Builds a regex with the case sensativility of the current language
*
* @param {RegExp | string} value
* @param {boolean} [global]
*/
function langRe(value, global) {

@@ -606,2 +847,3 @@ return new RegExp(

this.matchIndexes = {};
// @ts-ignore
this.regexes = [];

@@ -612,4 +854,6 @@ this.matchAt = 1;

// @ts-ignore
addRule(re, opts) {
opts.position = this.position++;
// @ts-ignore
this.matchIndexes[this.matchAt] = opts;

@@ -623,16 +867,23 @@ this.regexes.push([opts, re]);

// avoids the need to check length every time exec is called
// @ts-ignore
this.exec = () => null;
}
let terminators = this.regexes.map(el => el[1]);
this.matcherRe = langRe(join(terminators, '|'), true);
const terminators = this.regexes.map(el => el[1]);
this.matcherRe = langRe(join(terminators), true);
this.lastIndex = 0;
}
/** @param {string} s */
exec(s) {
this.matcherRe.lastIndex = this.lastIndex;
let match = this.matcherRe.exec(s);
const match = this.matcherRe.exec(s);
if (!match) { return null; }
let i = match.findIndex((el, i) => i>0 && el!=undefined);
let matchData = this.matchIndexes[i];
// eslint-disable-next-line no-undefined
const i = match.findIndex((el, i) => i > 0 && el !== undefined);
// @ts-ignore
const matchData = this.matchIndexes[i];
// trim off any earlier non-relevant match groups (ie, the other regex
// match groups that make up the multi-matcher)
match.splice(0, i);

@@ -676,3 +927,5 @@ return Object.assign(match, matchData);

constructor() {
// @ts-ignore
this.rules = [];
// @ts-ignore
this.multiRegexes = [];

@@ -685,7 +938,8 @@ this.count = 0;

// @ts-ignore
getMatcher(index) {
if (this.multiRegexes[index]) return this.multiRegexes[index];
let matcher = new MultiRegex();
this.rules.slice(index).forEach(([re, opts])=> matcher.addRule(re,opts));
const matcher = new MultiRegex();
this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));
matcher.compile();

@@ -700,15 +954,18 @@ this.multiRegexes[index] = matcher;

// @ts-ignore
addRule(re, opts) {
this.rules.push([re, opts]);
if (opts.type==="begin") this.count++;
if (opts.type === "begin") this.count++;
}
/** @param {string} s */
exec(s) {
let m = this.getMatcher(this.regexIndex);
const m = this.getMatcher(this.regexIndex);
m.lastIndex = this.lastIndex;
let result = m.exec(s);
const result = m.exec(s);
if (result) {
this.regexIndex += result.position + 1;
if (this.regexIndex === this.count) // wrap-around
if (this.regexIndex === this.count) { // wrap-around
this.regexIndex = 0;
}
}

@@ -721,13 +978,21 @@

/**
* Given a mode, builds a huge ResumableMultiRegex that can be used to walk
* the content and find matches.
*
* @param {CompiledMode} mode
* @returns {ResumableMultiRegex}
*/
function buildModeRegex(mode) {
const mm = new ResumableMultiRegex();
let mm = new ResumableMultiRegex();
mode.contains.forEach(term => mm.addRule(term.begin, { rule: term, type: "begin" }));
mode.contains.forEach(term => mm.addRule(term.begin, {rule: term, type: "begin" }));
if (mode.terminator_end) {
mm.addRule(mode.terminator_end, { type: "end" });
}
if (mode.illegal) {
mm.addRule(mode.illegal, { type: "illegal" });
}
if (mode.terminator_end)
mm.addRule(mode.terminator_end, {type: "end"} );
if (mode.illegal)
mm.addRule(mode.illegal, {type: "illegal"} );
return mm;

@@ -737,7 +1002,16 @@ }

// TODO: We need negative look-behind support to do this properly
function skipIfhasPrecedingOrTrailingDot(match) {
let before = match.input[match.index-1];
let after = match.input[match.index + match[0].length];
/**
* Skip a match if it has a preceding or trailing dot
*
* This is used for `beginKeywords` to prevent matching expressions such as
* `bob.keyword.do()`. The mode compiler automatically wires this up as a
* special _internal_ 'on:begin' callback for modes with `beginKeywords`
* @param {RegExpMatchArray} match
* @param {CallbackResponse} response
*/
function skipIfhasPrecedingOrTrailingDot(match, response) {
const before = match.input[match.index - 1];
const after = match.input[match.index + match[0].length];
if (before === "." || after === ".") {
return {ignoreMatch: true };
response.ignoreMatch();
}

@@ -776,16 +1050,40 @@ }

/**
* Compiles an individual mode
*
* This can raise an error if the mode contains certain detectable known logic
* issues.
* @param {Mode} mode
* @param {CompiledMode | null} [parent]
* @returns {CompiledMode | never}
*/
function compileMode(mode, parent) {
if (mode.compiled)
return;
const cmode = /** @type CompiledMode */ (mode);
if (mode.compiled) return cmode;
mode.compiled = true;
// __onBegin is considered private API, internal use only
mode.__onBegin = null;
// __beforeBegin is considered private API, internal use only
mode.__beforeBegin = null;
mode.keywords = mode.keywords || mode.beginKeywords;
if (mode.keywords)
let kw_pattern = null;
if (typeof mode.keywords === "object") {
kw_pattern = mode.keywords.$pattern;
delete mode.keywords.$pattern;
}
if (mode.keywords) {
mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
}
mode.lexemesRe = langRe(mode.lexemes || /\w+/, true);
// both are not allowed
if (mode.lexemes && kw_pattern) {
throw new Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ");
}
// `mode.lexemes` was the old standard before we added and now recommend
// using `keywords.$pattern` to pass the keyword pattern
cmode.keywordPatternRe = langRe(mode.lexemes || kw_pattern || /\w+/, true);
if (parent) {

@@ -799,28 +1097,23 @@ if (mode.beginKeywords) {

mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?=\\b|\\s)';
mode.__onBegin = skipIfhasPrecedingOrTrailingDot;
mode.__beforeBegin = skipIfhasPrecedingOrTrailingDot;
}
if (!mode.begin)
mode.begin = /\B|\b/;
mode.beginRe = langRe(mode.begin);
if (mode.endSameAsBegin)
mode.end = mode.begin;
if (!mode.end && !mode.endsWithParent)
mode.end = /\B|\b/;
if (mode.end)
mode.endRe = langRe(mode.end);
mode.terminator_end = source(mode.end) || '';
if (mode.endsWithParent && parent.terminator_end)
mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end;
if (!mode.begin) mode.begin = /\B|\b/;
cmode.beginRe = langRe(mode.begin);
if (mode.endSameAsBegin) mode.end = mode.begin;
if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
if (mode.end) cmode.endRe = langRe(mode.end);
cmode.terminator_end = source(mode.end) || '';
if (mode.endsWithParent && parent.terminator_end) {
cmode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end;
}
}
if (mode.illegal)
mode.illegalRe = langRe(mode.illegal);
if (mode.relevance == null)
mode.relevance = 1;
if (!mode.contains) {
mode.contains = [];
}
if (mode.illegal) cmode.illegalRe = langRe(mode.illegal);
// eslint-disable-next-line no-undefined
if (mode.relevance === undefined) mode.relevance = 1;
if (!mode.contains) mode.contains = [];
mode.contains = [].concat(...mode.contains.map(function(c) {
return expand_or_clone_mode(c === 'self' ? mode : c);
}));
mode.contains.forEach(function(c) {compileMode(c, mode);});
mode.contains.forEach(function(c) { compileMode(/** @type Mode */ (c), cmode); });

@@ -831,3 +1124,4 @@ if (mode.starts) {

mode.matcher = buildModeRegex(mode);
cmode.matcher = buildModeRegex(cmode);
return cmode;
}

@@ -837,7 +1131,18 @@

if (language.contains && language.contains.includes('self')) {
throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.")
throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
}
compileMode(language);
return compileMode(/** @type Mode */ (language));
}
/**
* Determines if a mode has a dependency on it's parent or not
*
* If a mode does have a parent dependency then often we need to clone it if
* it's used in multiple places so that each copy points to the correct parent,
* where-as modes without a parent can often safely be re-used at the bottom of
* a mode chain.
*
* @param {Mode | null} mode
* @returns {boolean} - is there a dependency on the parent?
* */
function dependencyOnParent(mode) {

@@ -849,6 +1154,16 @@ if (!mode) return false;

/**
* Expands a mode or clones it if necessary
*
* This is necessary for modes with parental dependenceis (see notes on
* `dependencyOnParent`) and for nodes that have `variants` - which must then be
* exploded into their own individual modes at compile time.
*
* @param {Mode} mode
* @returns {Mode | Mode[]}
* */
function expand_or_clone_mode(mode) {
if (mode.variants && !mode.cached_variants) {
mode.cached_variants = mode.variants.map(function(variant) {
return inherit(mode, {variants: null}, variant);
return inherit(mode, { variants: null }, variant);
});

@@ -860,4 +1175,5 @@ }

// this happens in compileMode, where this function is called from
if (mode.cached_variants)
if (mode.cached_variants) {
return mode.cached_variants;
}

@@ -868,7 +1184,9 @@ // CLONE

// different parents without issue
if (dependencyOnParent(mode))
if (dependencyOnParent(mode)) {
return inherit(mode, { starts: mode.starts ? inherit(mode.starts) : null });
}
if (Object.isFrozen(mode))
if (Object.isFrozen(mode)) {
return inherit(mode);
}

@@ -879,6 +1197,14 @@ // no special dependency issues, just return ourselves

/***********************************************
Keywords
***********************************************/
// keywords
/**
* Given raw keywords from a language definition, compile them.
*
* @param {string | Record<string,string>} rawKeywords
* @param {boolean} case_insensitive
*/
function compileKeywords(rawKeywords, case_insensitive) {
/** @type KeywordDict */
var compiled_keywords = {};

@@ -889,35 +1215,56 @@

} else {
Object.keys(rawKeywords).forEach(function (className) {
Object.keys(rawKeywords).forEach(function(className) {
splitAndCompile(className, rawKeywords[className]);
});
}
return compiled_keywords;
return compiled_keywords;
// ---
// ---
function splitAndCompile(className, str) {
if (case_insensitive) {
str = str.toLowerCase();
/**
* Compiles an individual list of keywords
*
* Ex: "for if when while|5"
*
* @param {string} className
* @param {string} keywordList
*/
function splitAndCompile(className, keywordList) {
if (case_insensitive) {
keywordList = keywordList.toLowerCase();
}
keywordList.split(' ').forEach(function(keyword) {
var pair = keyword.split('|');
compiled_keywords[pair[0]] = [className, scoreForKeyword(pair[0], pair[1])];
});
}
str.split(' ').forEach(function(keyword) {
var pair = keyword.split('|');
compiled_keywords[pair[0]] = [className, scoreForKeyword(pair[0], pair[1])];
});
}
}
/**
* Returns the proper score for a given keyword
*
* Also takes into account comment keywords, which will be scored 0 UNLESS
* another score has been manually assigned.
* @param {string} keyword
* @param {string} [providedScore]
*/
function scoreForKeyword(keyword, providedScore) {
// manual scores always win over common keywords
// so you can force a score of 1 if you really insist
if (providedScore)
return Number(providedScore);
// manual scores always win over common keywords
// so you can force a score of 1 if you really insist
if (providedScore) {
return Number(providedScore);
}
return commonKeyword(keyword) ? 0 : 1;
return commonKeyword(keyword) ? 0 : 1;
}
function commonKeyword(word) {
return COMMON_KEYWORDS.includes(word.toLowerCase());
/**
* Determines if a given keyword is common or not
*
* @param {string} keyword */
function commonKeyword(keyword) {
return COMMON_KEYWORDS.includes(keyword.toLowerCase());
}
var version = "10.0.3";
var version = "10.1.0";

@@ -933,13 +1280,19 @@ /*

const { nodeStream: nodeStream$1, mergeStreams: mergeStreams$1 } = utils;
const NO_MATCH = Symbol("nomatch");
/**
* @param {any} hljs - object that is extended (legacy)
*/
const HLJS = function(hljs) {
// Convenience variables for build-in objects
/** @type {unknown[]} */
var ArrayProto = [];
// Global internal variables used within the highlight.js library.
var languages = {},
aliases = {},
plugins = [];
/** @type {Record<string, Language>} */
var languages = {};
/** @type {Record<string, string>} */
var aliases = {};
/** @type {HLJSPlugin[]} */
var plugins = [];

@@ -949,10 +1302,10 @@ // safe/production mode - swallows more errors, tries to keep running

var SAFE_MODE = true;
// Regular expressions used throughout the highlight.js library.
var fixMarkupRe = /((^(<[^>]+>|\t|)+|(?:\n)))/gm;
var fixMarkupRe = /(^(<[^>]+>|\t|)+|\n)/gm;
var LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
/** @type {Language} */
const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text', contains: [] };
// Global options used when within external APIs. This is modified when
// calling the `hljs.configure` function.
/** @type HLJSOptions */
var options = {

@@ -964,3 +1317,3 @@ noHighlightRe: /^(no-?highlight)$/i,

useBR: false,
languages: undefined,
languages: null,
// beta configuration options, subject to change, welcome to discuss

@@ -973,8 +1326,14 @@ // https://github.com/highlightjs/highlight.js/issues/1086

function shouldNotHighlight(language) {
return options.noHighlightRe.test(language);
/**
* Tests a language name to see if highlighting should be skipped
* @param {string} languageName
*/
function shouldNotHighlight(languageName) {
return options.noHighlightRe.test(languageName);
}
/**
* @param {HighlightedHTMLElement} block - the HTML element to determine language for
*/
function blockLanguage(block) {
var match;
var classes = block.className + ' ';

@@ -985,3 +1344,3 @@

// language-* takes precedence over non-prefixed class names.
match = options.languageDetectRe.exec(classes);
const match = options.languageDetectRe.exec(classes);
if (match) {

@@ -1006,6 +1365,6 @@ var language = getLanguage(match[1]);

* @param {string} code - the code to highlight
* @param {boolean} ignore_illegals - whether to ignore illegal matches, default is to bail
* @param {array<mode>} continuation - array of continuation modes
* @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail
* @param {Mode} [continuation] - current continuation mode, if any
*
* @returns an object that represents the result
* @returns {HighlightResult} Result - an object that represents the result
* @property {string} language - the language name

@@ -1015,6 +1374,7 @@ * @property {number} relevance - the relevance score

* @property {string} code - the original raw code
* @property {mode} top - top of the current mode stack
* @property {Mode} top - top of the current mode stack
* @property {boolean} illegal - indicates whether any illegal matches were found
*/
function highlight(languageName, code, ignore_illegals, continuation) {
function highlight(languageName, code, ignoreIllegals, continuation) {
/** @type {{ code: string, language: string, result?: any }} */
var context = {

@@ -1032,3 +1392,3 @@ code,

context.result :
_highlight(context.language, context.code, ignore_illegals, continuation);
_highlight(context.language, context.code, ignoreIllegals, continuation);

@@ -1042,26 +1402,25 @@ result.code = context.code;

// private highlight that's used internally and does not fire callbacks
function _highlight(languageName, code, ignore_illegals, continuation) {
/**
* private highlight that's used internally and does not fire callbacks
*
* @param {string} languageName - the language to use for highlighting
* @param {string} code - the code to highlight
* @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail
* @param {Mode} [continuation] - current continuation mode, if any
*/
function _highlight(languageName, code, ignoreIllegals, continuation) {
var codeToHighlight = code;
function endOfMode(mode, lexeme) {
if (startsWith(mode.endRe, lexeme)) {
while (mode.endsParent && mode.parent) {
mode = mode.parent;
}
return mode;
}
if (mode.endsWithParent) {
return endOfMode(mode.parent, lexeme);
}
/**
* Return keyword data if a match is a keyword
* @param {CompiledMode} mode - current mode
* @param {RegExpMatchArray} match - regexp match data
* @returns {KeywordData | false}
*/
function keywordData(mode, match) {
var matchText = language.case_insensitive ? match[0].toLowerCase() : match[0];
return Object.prototype.hasOwnProperty.call(mode.keywords, matchText) && mode.keywords[matchText];
}
function keywordMatch(mode, match) {
var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0];
return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str];
}
function processKeywords() {
var keyword_match, last_index, match, buf;
if (!top.keywords) {

@@ -1072,17 +1431,16 @@ emitter.addText(mode_buffer);

last_index = 0;
top.lexemesRe.lastIndex = 0;
match = top.lexemesRe.exec(mode_buffer);
buf = "";
let last_index = 0;
top.keywordPatternRe.lastIndex = 0;
let match = top.keywordPatternRe.exec(mode_buffer);
let buf = "";
while (match) {
buf += mode_buffer.substring(last_index, match.index);
keyword_match = keywordMatch(top, match);
var kind = null;
if (keyword_match) {
const data = keywordData(top, match);
if (data) {
const [kind, keywordRelevance] = data;
emitter.addText(buf);
buf = "";
relevance += keyword_match[1];
kind = keyword_match[0];
relevance += keywordRelevance;
emitter.addKeyword(match[0], kind);

@@ -1092,4 +1450,4 @@ } else {

}
last_index = top.lexemesRe.lastIndex;
match = top.lexemesRe.exec(mode_buffer);
last_index = top.keywordPatternRe.lastIndex;
match = top.keywordPatternRe.exec(mode_buffer);
}

@@ -1102,14 +1460,16 @@ buf += mode_buffer.substr(last_index);

if (mode_buffer === "") return;
/** @type HighlightResult */
var result = null;
var explicit = typeof top.subLanguage === 'string';
if (explicit && !languages[top.subLanguage]) {
emitter.addText(mode_buffer);
return;
if (typeof top.subLanguage === 'string') {
if (!languages[top.subLanguage]) {
emitter.addText(mode_buffer);
return;
}
result = _highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]);
continuations[top.subLanguage] = result.top;
} else {
result = highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : null);
}
var result = explicit ?
_highlight(top.subLanguage, mode_buffer, true, continuations[top.subLanguage]) :
highlightAuto(mode_buffer, top.subLanguage.length ? top.subLanguage : undefined);
// Counting embedded language score towards the host language may be disabled

@@ -1122,5 +1482,2 @@ // with zeroing the containing mode relevance. Use case in point is Markdown that

}
if (explicit) {
continuations[top.subLanguage] = result.top;
}
emitter.addSublanguage(result.emitter, result.language);

@@ -1130,9 +1487,13 @@ }

function processBuffer() {
if (top.subLanguage != null)
if (top.subLanguage != null) {
processSubLanguage();
else
} else {
processKeywords();
}
mode_buffer = '';
}
/**
* @param {Mode} mode - new mode to start
*/
function startNewMode(mode) {

@@ -1142,5 +1503,41 @@ if (mode.className) {

}
top = Object.create(mode, {parent: {value: top}});
top = Object.create(mode, { parent: { value: top } });
return top;
}
/**
* @param {CompiledMode } mode - the mode to potentially end
* @param {RegExpMatchArray} match - the latest match
* @param {string} matchPlusRemainder - match plus remainder of content
* @returns {CompiledMode | void} - the next mode, or if void continue on in current mode
*/
function endOfMode(mode, match, matchPlusRemainder) {
let matched = startsWith(mode.endRe, matchPlusRemainder);
if (matched) {
if (mode["on:end"]) {
const resp = new Response(mode);
mode["on:end"](match, resp);
if (resp.ignore) matched = false;
}
if (matched) {
while (mode.endsParent && mode.parent) {
mode = mode.parent;
}
return mode;
}
}
// even if on:end fires an `ignore` it's still possible
// that we might trigger the end node because of a parent mode
if (mode.endsWithParent) {
return endOfMode(mode.parent, match, matchPlusRemainder);
}
}
/**
* Handle matching but then ignoring a sequence of text
*
* @param {string} lexeme - string containing full match text
*/
function doIgnore(lexeme) {

@@ -1160,2 +1557,8 @@ if (top.matcher.regexIndex === 0) {

/**
* Handle the start of a new potential mode match
*
* @param {EnhancedMatch} match - the current match
* @returns {number} how far to advance the parse cursor
*/
function doBeginMatch(match) {

@@ -1165,10 +1568,13 @@ var lexeme = match[0];

if (new_mode.__onBegin) {
let res = new_mode.__onBegin(match) || {};
if (res.ignoreMatch)
return doIgnore(lexeme);
const resp = new Response(new_mode);
// first internal before callbacks, then the public ones
const beforeCallbacks = [new_mode.__beforeBegin, new_mode["on:begin"]];
for (const cb of beforeCallbacks) {
if (!cb) continue;
cb(match, resp);
if (resp.ignore) return doIgnore(lexeme);
}
if (new_mode && new_mode.endSameAsBegin) {
new_mode.endRe = escape( lexeme );
new_mode.endRe = escape(lexeme);
}

@@ -1188,11 +1594,21 @@

startNewMode(new_mode);
// if (mode["after:begin"]) {
// let resp = new Response(mode);
// mode["after:begin"](match, resp);
// }
return new_mode.returnBegin ? 0 : lexeme.length;
}
/**
* Handle the potential end of mode
*
* @param {RegExpMatchArray} match - the current match
*/
function doEndMatch(match) {
var lexeme = match[0];
var matchPlusRemainder = codeToHighlight.substr(match.index);
var end_mode = endOfMode(top, matchPlusRemainder);
if (!end_mode) { return; }
var end_mode = endOfMode(top, match, matchPlusRemainder);
if (!end_mode) { return NO_MATCH; }
var origin = top;

@@ -1230,3 +1646,3 @@ if (origin.skip) {

var list = [];
for(var current = top; current !== language; current = current.parent) {
for (var current = top; current !== language; current = current.parent) {
if (current.className) {

@@ -1239,10 +1655,16 @@ list.unshift(current.className);

/** @type {{type?: MatchType, index?: number, rule?: Mode}}} */
var lastMatch = {};
function processLexeme(text_before_match, match) {
var err;
/**
* Process an individual match
*
* @param {string} textBeforeMatch - text preceeding the match (since the last match)
* @param {EnhancedMatch} [match] - the match itself
*/
function processLexeme(textBeforeMatch, match) {
var lexeme = match && match[0];
// add non-matched text to the current mode buffer
mode_buffer += text_before_match;
mode_buffer += textBeforeMatch;

@@ -1254,4 +1676,2 @@ if (lexeme == null) {

// we've found a 0 width match and we're stuck, so we need to advance

@@ -1261,10 +1681,11 @@ // this happens when we have badly behaved rules that have optional matchers to the degree that

// Ref: https://github.com/highlightjs/highlight.js/issues/2140
if (lastMatch.type=="begin" && match.type=="end" && lastMatch.index == match.index && lexeme === "") {
if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") {
// spit the "skipped" character that our regex choked on back into the output sequence
mode_buffer += codeToHighlight.slice(match.index, match.index + 1);
if (!SAFE_MODE) {
err = new Error('0 width match regex');
/** @type {AnnotatedError} */
const err = new Error('0 width match regex');
err.languageName = languageName;
err.badRule = lastMatch.rule;
throw(err);
throw err;
}

@@ -1275,13 +1696,15 @@ return 1;

if (match.type==="begin") {
if (match.type === "begin") {
return doBeginMatch(match);
} else if (match.type==="illegal" && !ignore_illegals) {
} else if (match.type === "illegal" && !ignoreIllegals) {
// illegal match, we do not continue processing
err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '<unnamed>') + '"');
/** @type {AnnotatedError} */
const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '<unnamed>') + '"');
err.mode = top;
throw err;
} else if (match.type==="end") {
} else if (match.type === "end") {
var processed = doEndMatch(match);
if (processed != undefined)
if (processed !== NO_MATCH) {
return processed;
}
}

@@ -1328,6 +1751,8 @@

compileLanguage(language);
var top = continuation || language;
var md = compileLanguage(language);
var result = '';
/** @type {CompiledMode} */
var top = continuation || md;
/** @type Record<string,Mode> */
var continuations = {}; // keep continuations for sub-languages
var result;
var emitter = new options.__emitter(options);

@@ -1337,4 +1762,2 @@ processContinuations();

var relevance = 0;
var match;
var processedCount;
var index = 0;

@@ -1350,5 +1773,5 @@ var iterations = 0;

if (continueScanAtSamePosition) {
continueScanAtSamePosition = false;
// only regexes not matched previously will now be
// considered for a potential match
continueScanAtSamePosition = false;
} else {

@@ -1358,8 +1781,8 @@ top.matcher.lastIndex = index;

}
match = top.matcher.exec(codeToHighlight);
const match = top.matcher.exec(codeToHighlight);
// console.log("match", match[0], match.rule && match.rule.begin)
if (!match)
break;
let beforeMatch = codeToHighlight.substring(index, match.index);
processedCount = processLexeme(beforeMatch, match);
if (!match) break;
const beforeMatch = codeToHighlight.substring(index, match.index);
const processedCount = processLexeme(beforeMatch, match);
index = match.index + processedCount;

@@ -1386,3 +1809,3 @@ }

msg: err.message,
context: codeToHighlight.slice(index-100,index+100),
context: codeToHighlight.slice(index - 100, index + 100),
mode: err.mode

@@ -1393,6 +1816,7 @@ },

value: escape$1(codeToHighlight),
emitter: emitter,
emitter: emitter
};
} else if (SAFE_MODE) {
return {
illegal: false,
relevance: 0,

@@ -1411,6 +1835,9 @@ value: escape$1(codeToHighlight),

// returns a valid highlight result, without actually
// doing any actual work, auto highlight starts with
// this and it's possible for small snippets that
// auto-detection may not find a better match
/**
* returns a valid highlight result, without actually doing any actual work,
* auto highlight starts with this and it's possible for small snippets that
* auto-detection may not find a better match
* @param {string} code
* @returns {HighlightResult}
*/
function justTextHighlightResult(code) {

@@ -1428,3 +1855,3 @@ const result = {

/*
/**
Highlighting with language detection. Accepts a string with the code to

@@ -1439,2 +1866,5 @@ highlight. Returns an object with the following properties:

@param {string} code
@param {Array<string>} [languageSubset]
@returns {AutoHighlightResult}
*/

@@ -1444,16 +1874,17 @@ function highlightAuto(code, languageSubset) {

var result = justTextHighlightResult(code);
var second_best = result;
var secondBest = result;
languageSubset.filter(getLanguage).filter(autoDetection).forEach(function(name) {
var current = _highlight(name, code, false);
current.language = name;
if (current.relevance > second_best.relevance) {
second_best = current;
if (current.relevance > secondBest.relevance) {
secondBest = current;
}
if (current.relevance > result.relevance) {
second_best = result;
secondBest = result;
result = current;
}
});
if (second_best.language) {
result.second_best = second_best;
if (secondBest.language) {
// second_best (with underscore) is the expected API
result.second_best = secondBest;
}

@@ -1463,3 +1894,3 @@ return result;

/*
/**
Post-processing of the highlighted markup:

@@ -1470,21 +1901,30 @@

@param {string} html
@returns {string}
*/
function fixMarkup(value) {
function fixMarkup(html) {
if (!(options.tabReplace || options.useBR)) {
return value;
return html;
}
return value.replace(fixMarkupRe, function(match, p1) {
if (options.useBR && match === '\n') {
return '<br>';
} else if (options.tabReplace) {
return p1.replace(/\t/g, options.tabReplace);
}
return '';
return html.replace(fixMarkupRe, match => {
if (match === '\n') {
return options.useBR ? '<br>' : match;
} else if (options.tabReplace) {
return match.replace(/\t/g, options.tabReplace);
}
return match;
});
}
/**
* Builds new class name for block given the language name
*
* @param {string} prevClassName
* @param {string} [currentLang]
* @param {string} [resultLang]
*/
function buildClassName(prevClassName, currentLang, resultLang) {
var language = currentLang ? aliases[currentLang] : resultLang,
result = [prevClassName.trim()];
var language = currentLang ? aliases[currentLang] : resultLang;
var result = [prevClassName.trim()];

@@ -1502,28 +1942,30 @@ if (!prevClassName.match(/\bhljs\b/)) {

/*
Applies highlighting to a DOM node containing code. Accepts a DOM node and
two optional parameters for fixMarkup.
/**
* Applies highlighting to a DOM node containing code. Accepts a DOM node and
* two optional parameters for fixMarkup.
*
* @param {HighlightedHTMLElement} element - the HTML element to highlight
*/
function highlightBlock(block) {
var node, originalStream, result, resultNode, text;
var language = blockLanguage(block);
function highlightBlock(element) {
/** @type HTMLElement */
let node = null;
const language = blockLanguage(element);
if (shouldNotHighlight(language))
return;
if (shouldNotHighlight(language)) return;
fire("before:highlightBlock",
{ block: block, language: language});
{ block: element, language: language });
if (options.useBR) {
node = document.createElement('div');
node.innerHTML = block.innerHTML.replace(/\n/g, '').replace(/<br[ \/]*>/g, '\n');
node.innerHTML = element.innerHTML.replace(/\n/g, '').replace(/<br[ /]*>/g, '\n');
} else {
node = block;
node = element;
}
text = node.textContent;
result = language ? highlight(language, text, true) : highlightAuto(text);
const text = node.textContent;
const result = language ? highlight(language, text, true) : highlightAuto(text);
originalStream = nodeStream$1(node);
const originalStream = nodeStream$1(node);
if (originalStream.length) {
resultNode = document.createElement('div');
const resultNode = document.createElement('div');
resultNode.innerHTML = result.value;

@@ -1534,14 +1976,18 @@ result.value = mergeStreams$1(originalStream, nodeStream$1(resultNode), text);

fire("after:highlightBlock", { block: block, result: result});
fire("after:highlightBlock", { block: element, result: result });
block.innerHTML = result.value;
block.className = buildClassName(block.className, language, result.language);
block.result = {
element.innerHTML = result.value;
element.className = buildClassName(element.className, language, result.language);
element.result = {
language: result.language,
re: result.relevance
// TODO: remove with version 11.0
re: result.relevance,
relavance: result.relevance
};
if (result.second_best) {
block.second_best = {
element.second_best = {
language: result.second_best.language,
re: result.second_best.relevance
// TODO: remove with version 11.0
re: result.second_best.relevance,
relavance: result.second_best.relevance
};

@@ -1551,15 +1997,18 @@ }

/*
Updates highlight.js global options with values passed in the form of an object.
*/
function configure(user_options) {
options = inherit$1(options, user_options);
/**
* Updates highlight.js global options with the passed options
*
* @param {{}} userOptions
*/
function configure(userOptions) {
options = inherit$1(options, userOptions);
}
/*
Applies highlighting to all <pre><code>..</code></pre> blocks on a page.
*/
function initHighlighting() {
if (initHighlighting.called)
return;
/**
* Highlights to all <pre><code> blocks on a page
*
* @type {Function & {called?: boolean}}
*/
const initHighlighting = () => {
if (initHighlighting.called) return;
initHighlighting.called = true;

@@ -1569,18 +2018,22 @@

ArrayProto.forEach.call(blocks, highlightBlock);
}
};
/*
Attaches highlighting to the page load event.
*/
// Higlights all when DOMContentLoaded fires
function initHighlightingOnLoad() {
// @ts-ignore
window.addEventListener('DOMContentLoaded', initHighlighting, false);
}
const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: 'Plain text' };
function registerLanguage(name, language) {
var lang;
try { lang = language(hljs); }
catch (error) {
console.error("Language definition for '{}' could not be registered.".replace("{}", name));
/**
* Register a language grammar module
*
* @param {string} languageName
* @param {LanguageFn} languageDefinition
*/
function registerLanguage(languageName, languageDefinition) {
var lang = null;
try {
lang = languageDefinition(hljs);
} catch (error) {
console.error("Language definition for '{}' could not be registered.".replace("{}", languageName));
// hard or soft error

@@ -1595,12 +2048,14 @@ if (!SAFE_MODE) { throw error; } else { console.error(error); }

// give it a temporary name if it doesn't have one in the meta-data
if (!lang.name)
lang.name = name;
languages[name] = lang;
lang.rawDefinition = language.bind(null,hljs);
if (!lang.name) lang.name = languageName;
languages[languageName] = lang;
lang.rawDefinition = languageDefinition.bind(null, hljs);
if (lang.aliases) {
lang.aliases.forEach(function(alias) {aliases[alias] = name;});
registerAliases(lang.aliases, { languageName });
}
}
/**
* @returns {string[]} List of language internal names
*/
function listLanguages() {

@@ -1610,3 +2065,3 @@ return Object.keys(languages);

/*
/**
intended usage: When one language truly requires another

@@ -1616,2 +2071,5 @@

is not available.
@param {string} name - name of the language to fetch/require
@returns {Language | never}
*/

@@ -1622,6 +2080,10 @@ function requireLanguage(name) {

var err = new Error('The \'{}\' language is required, but not loaded.'.replace('{}',name));
var err = new Error('The \'{}\' language is required, but not loaded.'.replace('{}', name));
throw err;
}
/**
* @param {string} name - name of the language to retrieve
* @returns {Language | undefined}
*/
function getLanguage(name) {

@@ -1632,2 +2094,18 @@ name = (name || '').toLowerCase();

/**
*
* @param {string|string[]} aliasList - single alias or list of aliases
* @param {{languageName: string}} opts
*/
function registerAliases(aliasList, { languageName }) {
if (typeof aliasList === 'string') {
aliasList = [aliasList];
}
aliasList.forEach(alias => { aliases[alias] = languageName; });
}
/**
* Determines if a given language has auto-detection enabled
* @param {string} name - name of the language
*/
function autoDetection(name) {

@@ -1638,9 +2116,17 @@ var lang = getLanguage(name);

function addPlugin(plugin, options) {
/**
* @param {HLJSPlugin} plugin
*/
function addPlugin(plugin) {
plugins.push(plugin);
}
/**
*
* @param {PluginEvent} event
* @param {any} args
*/
function fire(event, args) {
var cb = event;
plugins.forEach(function (plugin) {
plugins.forEach(function(plugin) {
if (plugin[cb]) {

@@ -1654,3 +2140,3 @@ plugin[cb](args);

Object.assign(hljs,{
Object.assign(hljs, {
highlight,

@@ -1666,2 +2152,3 @@ highlightAuto,

getLanguage,
registerAliases,
requireLanguage,

@@ -1678,4 +2165,7 @@ autoDetection,

for (const key in MODES) {
if (typeof MODES[key] === "object")
// @ts-ignore
if (typeof MODES[key] === "object") {
// @ts-ignore
deepFreeze(MODES[key]);
}
}

@@ -1682,0 +2172,0 @@

@@ -7,2 +7,3 @@ /*

/** @type LanguageFn */
function abnf(hljs) {

@@ -9,0 +10,0 @@ var regexes = {

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function accesslog(hljs) {

@@ -10,0 +11,0 @@ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods

@@ -7,2 +7,3 @@ /*

/** @type LanguageFn */
function actionscript(hljs) {

@@ -9,0 +10,0 @@ var IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*';

@@ -20,2 +20,3 @@ /*

/** @type LanguageFn */
function ada(hljs) {

@@ -40,3 +41,3 @@ // Regular expression for Ada numeric literals.

// bad chars, only allowed in literals
var BAD_CHARS = '[]{}%#\'\"';
var BAD_CHARS = `[]{}%#'"`;

@@ -43,0 +44,0 @@ // Ada doesn't have block comments, only line comments

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function angelscript(hljs) {

@@ -10,0 +11,0 @@ var builtInTypeMode = {

@@ -10,2 +10,3 @@ /*

/** @type LanguageFn */
function apache(hljs) {

@@ -12,0 +13,0 @@ var NUMBER_REF = {className: 'number', begin: '[\\$%]\\d+'};

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function applescript(hljs) {

@@ -10,0 +11,0 @@ var STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: ''});

@@ -8,2 +8,4 @@ /*

*/
/** @type LanguageFn */
function arcade(hljs) {

@@ -46,3 +48,3 @@ var IDENT_RE = '[A-Za-z_][0-9A-Za-z_]*';

keywords: KEYWORDS,
contains: [] // defined later
contains: [] // defined later
};

@@ -49,0 +51,0 @@ var TEMPLATE_STRING = {

@@ -9,2 +9,3 @@ /*

/** @type LanguageFn */
function arduino(hljs) {

@@ -11,0 +12,0 @@

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function armasm(hljs) {

@@ -25,4 +26,4 @@ //local labels: %?[FB]?[AT]?\d{1,2}\w+

aliases: ['arm'],
lexemes: '\\.?' + hljs.IDENT_RE,
keywords: {
$pattern: '\\.?' + hljs.IDENT_RE,
meta:

@@ -29,0 +30,0 @@ //GNU preprocs

@@ -10,2 +10,3 @@ /*

/** @type LanguageFn */
function asciidoc(hljs) {

@@ -12,0 +13,0 @@ return {

@@ -7,3 +7,5 @@ /*

*/
function aspectj (hljs) {
/** @type LanguageFn */
function aspectj(hljs) {
var KEYWORDS =

@@ -10,0 +12,0 @@ 'false synchronized int abstract float private char boolean static null if const ' +

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function autohotkey(hljs) {

@@ -10,0 +11,0 @@ var BACKTICK_ESCAPE = {

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function autoit(hljs) {

@@ -10,0 +11,0 @@ var KEYWORDS = 'ByRef Case Const ContinueCase ContinueLoop ' +

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function avrasm(hljs) {

@@ -13,4 +14,4 @@ return {

case_insensitive: true,
lexemes: '\\.?' + hljs.IDENT_RE,
keywords: {
$pattern: '\\.?' + hljs.IDENT_RE,
keyword:

@@ -17,0 +18,0 @@ /* mnemonic */

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function awk(hljs) {

@@ -10,0 +11,0 @@ var VARIABLE = {

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function axapta(hljs) {

@@ -10,0 +11,0 @@ return {

@@ -9,2 +9,3 @@ /*

/** @type LanguageFn */
function bash(hljs) {

@@ -59,7 +60,17 @@ const VAR = {};

};
const SHEBANG = {
className: 'meta',
begin: /^#![^\n]+sh\s*$/,
const SH_LIKE_SHELLS = [
"fish",
"bash",
"zsh",
"sh",
"csh",
"ksh",
"tcsh",
"dash",
"scsh",
];
const KNOWN_SHEBANG = hljs.SHEBANG({
binary: `(${SH_LIKE_SHELLS.join("|")})`,
relevance: 10
};
});
const FUNCTION = {

@@ -76,4 +87,4 @@ className: 'function',

aliases: ['sh', 'zsh'],
lexemes: /\b-?[a-z\._]+\b/,
keywords: {
$pattern: /\b-?[a-z\._]+\b/,
keyword:

@@ -104,3 +115,4 @@ 'if then else elif fi for while in do done case esac function',

contains: [
SHEBANG,
KNOWN_SHEBANG, // to catch known shells and boost relevancy
hljs.SHEBANG(), // to catch unknown shells but still highlight the shebang
FUNCTION,

@@ -107,0 +119,0 @@ ARITHMETIC,

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function basic(hljs) {

@@ -15,4 +16,4 @@ return {

// Support explicitly typed variables that end with $%! or #.
lexemes: '[a-zA-Z][a-zA-Z0-9_\$\%\!\#]*',
keywords: {
$pattern: '[a-zA-Z][a-zA-Z0-9_\$\%\!\#]*',
keyword:

@@ -19,0 +20,0 @@ 'ABS ASC AND ATN AUTO|0 BEEP BLOAD|10 BSAVE|10 CALL CALLS CDBL CHAIN CHDIR CHR$|10 CINT CIRCLE ' +

@@ -7,3 +7,4 @@ /*

function bnf(hljs){
/** @type LanguageFn */
function bnf(hljs) {
return {

@@ -10,0 +11,0 @@ name: 'Backus–Naur Form',

@@ -7,3 +7,4 @@ /*

function brainfuck(hljs){
/** @type LanguageFn */
function brainfuck(hljs) {
var LITERAL = {

@@ -10,0 +11,0 @@ className: 'literal',

@@ -16,2 +16,3 @@ /*

/** @type LanguageFn */
function cLike(hljs) {

@@ -48,3 +49,6 @@ function optional(s) {

},
{ begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\((?:.|\n)*?\)\1"/ }
hljs.END_SAME_AS_BEGIN({
begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
end: /\)([^()\\ ]{0,16})"/,
})
]

@@ -108,4 +112,4 @@ };

built_in: 'std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream ' +
'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' +
'unordered_map unordered_multiset unordered_multimap array shared_ptr abort terminate abs acos ' +
'auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set ' +
'unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos ' +
'asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp ' +

@@ -215,4 +219,4 @@ 'fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper ' +

PREPROCESSOR,
{
begin: '\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>',
{ // containers: ie, `vector <int> rooms (9);`
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<', end: '>',
keywords: CPP_KEYWORDS,

@@ -219,0 +223,0 @@ contains: ['self', CPP_PRIMITIVE_TYPES]

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function c(hljs) {

@@ -10,0 +11,0 @@

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function cal(hljs) {

@@ -10,0 +11,0 @@ var KEYWORDS =

@@ -9,2 +9,3 @@ /*

/** @type LanguageFn */
function capnproto(hljs) {

@@ -11,0 +12,0 @@ return {

@@ -6,2 +6,4 @@ /*

*/
/** @type LanguageFn */
function ceylon(hljs) {

@@ -8,0 +10,0 @@ // 2.3. Identifiers and keywords

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function clean(hljs) {

@@ -10,0 +11,0 @@ return {

@@ -10,2 +10,3 @@ /*

/** @type LanguageFn */
function clojureRepl(hljs) {

@@ -12,0 +13,0 @@ return {

@@ -9,5 +9,9 @@ /*

/** @type LanguageFn */
function clojure(hljs) {
var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
var globals = 'def defonce defprotocol defstruct defmulti defmethod defn- defn defmacro deftype defrecord';
var keywords = {
$pattern: SYMBOL_RE,
'builtin-name':

@@ -45,4 +49,2 @@ // Clojure keywords

var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
var SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';

@@ -91,3 +93,2 @@

keywords: keywords,
lexemes: SYMBOL_RE,
className: 'name', begin: SYMBOL_RE,

@@ -94,0 +95,0 @@ starts: BODY

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function cmake(hljs) {

@@ -10,0 +11,0 @@ return {

@@ -0,1 +1,138 @@

const KEYWORDS = [
"as", // for exports
"in",
"of",
"if",
"for",
"while",
"finally",
"var",
"new",
"function",
"do",
"return",
"void",
"else",
"break",
"catch",
"instanceof",
"with",
"throw",
"case",
"default",
"try",
"switch",
"continue",
"typeof",
"delete",
"let",
"yield",
"const",
"class",
// JS handles these with a special rule
// "get",
// "set",
"debugger",
"async",
"await",
"static",
"import",
"from",
"export",
"extends"
];
const LITERALS = [
"true",
"false",
"null",
"undefined",
"NaN",
"Infinity"
];
const TYPES = [
"Intl",
"DataView",
"Number",
"Math",
"Date",
"String",
"RegExp",
"Object",
"Function",
"Boolean",
"Error",
"Symbol",
"Set",
"Map",
"WeakSet",
"WeakMap",
"Proxy",
"Reflect",
"JSON",
"Promise",
"Float64Array",
"Int16Array",
"Int32Array",
"Int8Array",
"Uint16Array",
"Uint32Array",
"Float32Array",
"Array",
"Uint8Array",
"Uint8ClampedArray",
"ArrayBuffer"
];
const ERROR_TYPES = [
"EvalError",
"InternalError",
"RangeError",
"ReferenceError",
"SyntaxError",
"TypeError",
"URIError"
];
const BUILT_IN_GLOBALS = [
"setInterval",
"setTimeout",
"clearInterval",
"clearTimeout",
"require",
"exports",
"eval",
"isFinite",
"isNaN",
"parseFloat",
"parseInt",
"decodeURI",
"decodeURIComponent",
"encodeURI",
"encodeURIComponent",
"escape",
"unescape"
];
const BUILT_IN_VARIABLES = [
"arguments",
"this",
"super",
"console",
"window",
"document",
"localStorage",
"module",
"global" // Node.js
];
const BUILT_INS = [].concat(
BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,
ERROR_TYPES
);
/*

@@ -10,17 +147,40 @@ Language: CoffeeScript

/** @type LanguageFn */
function coffeescript(hljs) {
var KEYWORDS = {
keyword:
// JS keywords
'in if for while finally new do return else break catch instanceof throw try this ' +
'switch continue typeof delete debugger super yield import export from as default await ' +
// Coffee keywords
'then unless until loop of by when and or is isnt not',
literal:
// JS literals
'true false null undefined ' +
// Coffee literals
'yes no on off',
built_in:
'npm require console print module global window document'
var COFFEE_BUILT_INS = [
'npm',
'print'
];
var COFFEE_LITERALS = [
'yes',
'no',
'on',
'off'
];
var COFFEE_KEYWORDS = [
'then',
'unless',
'until',
'loop',
'by',
'when',
'and',
'or',
'is',
'isnt',
'not'
];
var NOT_VALID_KEYWORDS = [
"var",
"const",
"let",
"function",
"static"
];
var excluding = (list) =>
(kw) => !list.includes(kw);
var KEYWORDS$1 = {
keyword: KEYWORDS.concat(COFFEE_KEYWORDS).filter(excluding(NOT_VALID_KEYWORDS)).join(" "),
literal: LITERALS.concat(COFFEE_LITERALS).join(" "),
built_in: BUILT_INS.concat(COFFEE_BUILT_INS).join(" ")
};

@@ -31,3 +191,3 @@ var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';

begin: /#\{/, end: /}/,
keywords: KEYWORDS
keywords: KEYWORDS$1
};

@@ -103,3 +263,3 @@ var EXPRESSIONS = [

begin: /\(/, end: /\)/,
keywords: KEYWORDS,
keywords: KEYWORDS$1,
contains: ['self'].concat(EXPRESSIONS)

@@ -112,3 +272,3 @@ }]

aliases: ['coffee', 'cson', 'iced'],
keywords: KEYWORDS,
keywords: KEYWORDS$1,
illegal: /\/\*/,

@@ -115,0 +275,0 @@ contains: EXPRESSIONS.concat([

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function coq(hljs) {

@@ -10,0 +11,0 @@ return {

@@ -7,2 +7,4 @@ /*

*/
/** @type LanguageFn */
function cos (hljs) {

@@ -9,0 +11,0 @@

@@ -8,4 +8,4 @@ /*

/** @type LanguageFn */
function cpp(hljs) {
var lang = hljs.getLanguage('c-like').rawDefinition();

@@ -12,0 +12,0 @@ // return auto-detection back on

@@ -9,2 +9,3 @@ /*

/** @type LanguageFn */
function crmsh(hljs) {

@@ -11,0 +12,0 @@ var RESOURCES = 'primitive rsc_template';

@@ -7,2 +7,3 @@ /*

/** @type LanguageFn */
function crystal(hljs) {

@@ -15,2 +16,3 @@ var INT_SUFFIX = '(_*[ui](8|16|32|64|128))?';

var CRYSTAL_KEYWORDS = {
$pattern: CRYSTAL_IDENT_RE,
keyword:

@@ -192,3 +194,2 @@ 'abstract alias annotation as as? asm begin break case class def do else elsif end ensure enum extend for fun if ' +

aliases: ['cr'],
lexemes: CRYSTAL_IDENT_RE,
keywords: CRYSTAL_KEYWORDS,

@@ -195,0 +196,0 @@ contains: CRYSTAL_DEFAULT_CONTAINS

@@ -9,2 +9,3 @@ /*

/** @type LanguageFn */
function csharp(hljs) {

@@ -94,3 +95,6 @@ var KEYWORDS = {

end: ">",
keywords: "in out"
contains: [
{ beginKeywords: "in out"},
TITLE_MODE
]
};

@@ -181,3 +185,3 @@ var TYPE_IDENT_RE = hljs.IDENT_RE + '(<' + hljs.IDENT_RE + '(\\s*,\\s*' + hljs.IDENT_RE + ')*>)?(\\[\\])?';

className: 'function',
begin: '(' + TYPE_IDENT_RE + '\\s+)+' + hljs.IDENT_RE + '\\s*\\(', returnBegin: true,
begin: '(' + TYPE_IDENT_RE + '\\s+)+' + hljs.IDENT_RE + '\\s*(\\<.+\\>)?\\s*\\(', returnBegin: true,
end: /\s*[{;=]/, excludeEnd: true,

@@ -187,4 +191,7 @@ keywords: KEYWORDS,

{
begin: hljs.IDENT_RE + '\\s*\\(', returnBegin: true,
contains: [hljs.TITLE_MODE],
begin: hljs.IDENT_RE + '\\s*(\\<.+\\>)?\\s*\\(', returnBegin: true,
contains: [
hljs.TITLE_MODE,
GENERIC_MODIFIER
],
relevance: 0

@@ -191,0 +198,0 @@ },

@@ -10,2 +10,3 @@ /*

/** @type LanguageFn */
function csp(hljs) {

@@ -15,4 +16,4 @@ return {

case_insensitive: false,
lexemes: '[a-zA-Z][a-zA-Z0-9_-]*',
keywords: {
$pattern: '[a-zA-Z][a-zA-Z0-9_-]*',
keyword: 'base-uri child-src connect-src default-src font-src form-action ' +

@@ -19,0 +20,0 @@ 'frame-ancestors frame-src img-src media-src object-src plugin-types ' +

@@ -7,2 +7,3 @@ /*

/** @type LanguageFn */
function css(hljs) {

@@ -9,0 +10,0 @@ var FUNCTION_LIKE = {

@@ -26,2 +26,3 @@ /*

/** @type LanguageFn */
function d(hljs) {

@@ -34,2 +35,3 @@ /**

var D_KEYWORDS = {
$pattern: hljs.UNDERSCORE_IDENT_RE,
keyword:

@@ -250,3 +252,2 @@ 'abstract alias align asm assert auto body break byte case cast catch class ' +

name: 'D',
lexemes: hljs.UNDERSCORE_IDENT_RE,
keywords: D_KEYWORDS,

@@ -253,0 +254,0 @@ contains: [

@@ -11,3 +11,3 @@ /*

function dart(hljs) {
var SUBST = {
const SUBST = {
className: 'subst',

@@ -19,3 +19,3 @@ variants: [{

var BRACED_SUBST = {
const BRACED_SUBST = {
className: 'subst',

@@ -25,7 +25,7 @@ variants: [{

end: '}'
}, ],
}],
keywords: 'true false null this is new super',
};
var STRING = {
const STRING = {
className: 'string',

@@ -78,13 +78,55 @@ variants: [{

var KEYWORDS = {
const BUILT_IN_TYPES = [
// dart:core
'Comparable',
'DateTime',
'Duration',
'Function',
'Iterable',
'Iterator',
'List',
'Map',
'Match',
'Object',
'Pattern',
'RegExp',
'Set',
'Stopwatch',
'String',
'StringBuffer',
'StringSink',
'Symbol',
'Type',
'Uri',
'bool',
'double',
'int',
'num',
// dart:html
'Element',
'ElementList',
];
const NULLABLE_BUILT_IN_TYPES = BUILT_IN_TYPES.map((e) => `${e}?`);
const KEYWORDS = {
keyword: 'abstract as assert async await break case catch class const continue covariant default deferred do ' +
'dynamic else enum export extends extension external factory false final finally for Function get hide if ' +
'implements import in inferface is library mixin new null on operator part rethrow return set show static ' +
'super switch sync this throw true try typedef var void while with yield',
'implements import in inferface is late library mixin new null on operator part required rethrow return set ' +
'show static super switch sync this throw true try typedef var void while with yield',
built_in:
// dart:core
'Comparable DateTime Duration Function Iterable Iterator List Map Match Null Object Pattern RegExp Set ' +
'Stopwatch String StringBuffer StringSink Symbol Type Uri bool double dynamic int num print ' +
// dart:html
'Element ElementList document querySelector querySelectorAll window'
BUILT_IN_TYPES
.concat(NULLABLE_BUILT_IN_TYPES)
.concat([
// dart:core
'Never',
'Null',
'dynamic',
'print',
// dart:html
'document',
'querySelector',
'querySelectorAll',
'window',
]).join(' '),
$pattern: /[A-Za-z][A-Za-z0-9_]*\??/
};

@@ -137,5 +179,5 @@

]
}
};
}
module.exports = dart;

@@ -6,2 +6,3 @@ /*

/** @type LanguageFn */
function delphi(hljs) {

@@ -8,0 +9,0 @@ var KEYWORDS =

@@ -9,2 +9,3 @@ /*

/** @type LanguageFn */
function diff(hljs) {

@@ -11,0 +12,0 @@ return {

@@ -8,2 +8,3 @@ /*

/** @type LanguageFn */
function dns(hljs) {

@@ -10,0 +11,0 @@ return {

@@ -12,10 +12,11 @@ /*

var ELIXIR_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?';
var ELIXIR_KEYWORDS =
'and false then defined module in return redo retry end for true self when ' +
var ELIXIR_KEYWORDS = {
$pattern: ELIXIR_IDENT_RE,
keyword: 'and false then defined module in return redo retry end for true self when ' +
'next until do begin unless nil break not case cond alias while ensure or ' +
'include use alias fn quote require import with|0';
'include use alias fn quote require import with|0'
};
var SUBST = {
className: 'subst',
begin: '#\\{', end: '}',
lexemes: ELIXIR_IDENT_RE,
keywords: ELIXIR_KEYWORDS

@@ -178,3 +179,2 @@ };

name: 'Elixir',
lexemes: ELIXIR_IDENT_RE,
keywords: ELIXIR_KEYWORDS,

@@ -181,0 +181,0 @@ contains: ELIXIR_DEFAULT_CONTAINS

@@ -26,3 +26,3 @@ /*

className: 'number',
begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
begin: '\\b(\\d+(_\\d+)*#[a-fA-F0-9]+(_[a-fA-F0-9]+)*|\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?([eE][-+]?\\d+)?)',
relevance: 0

@@ -29,0 +29,0 @@ },

@@ -23,3 +23,3 @@ /*

className: 'number',
begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
begin: '\\b(\\d+(_\\d+)*#[a-fA-F0-9]+(_[a-fA-F0-9]+)*|\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?([eE][-+]?\\d+)?)',
relevance: 0

@@ -140,7 +140,8 @@ };

returnBegin: true,
lexemes: '-' + hljs.IDENT_RE,
keywords:
'-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
keywords: {
$pattern: '-' + hljs.IDENT_RE,
keyword: '-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
'-import -include -include_lib -compile -define -else -endif -file -behaviour ' +
'-behavior -spec',
'-behavior -spec'
},
contains: [PARAMS]

@@ -147,0 +148,0 @@ },

@@ -13,5 +13,5 @@ /*

case_insensitive: true,
lexemes: /[a-zA-Z][\w\.]*/,
// built-in functions imported from https://web.archive.org/web/20160513042710/https://support.office.com/en-us/article/Excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188
keywords: {
$pattern: /[a-zA-Z][\w\.]*/,
built_in: 'ABS ACCRINT ACCRINTM ACOS ACOSH ACOT ACOTH AGGREGATE ADDRESS AMORDEGRC AMORLINC AND ARABIC AREAS ASC ASIN ASINH ATAN ATAN2 ATANH AVEDEV AVERAGE AVERAGEA AVERAGEIF AVERAGEIFS BAHTTEXT BASE BESSELI BESSELJ BESSELK BESSELY BETADIST BETA.DIST BETAINV BETA.INV BIN2DEC BIN2HEX BIN2OCT BINOMDIST BINOM.DIST BINOM.DIST.RANGE BINOM.INV BITAND BITLSHIFT BITOR BITRSHIFT BITXOR CALL CEILING CEILING.MATH CEILING.PRECISE CELL CHAR CHIDIST CHIINV CHITEST CHISQ.DIST CHISQ.DIST.RT CHISQ.INV CHISQ.INV.RT CHISQ.TEST CHOOSE CLEAN CODE COLUMN COLUMNS COMBIN COMBINA COMPLEX CONCAT CONCATENATE CONFIDENCE CONFIDENCE.NORM CONFIDENCE.T CONVERT CORREL COS COSH COT COTH COUNT COUNTA COUNTBLANK COUNTIF COUNTIFS COUPDAYBS COUPDAYS COUPDAYSNC COUPNCD COUPNUM COUPPCD COVAR COVARIANCE.P COVARIANCE.S CRITBINOM CSC CSCH CUBEKPIMEMBER CUBEMEMBER CUBEMEMBERPROPERTY CUBERANKEDMEMBER CUBESET CUBESETCOUNT CUBEVALUE CUMIPMT CUMPRINC DATE DATEDIF DATEVALUE DAVERAGE DAY DAYS DAYS360 DB DBCS DCOUNT DCOUNTA DDB DEC2BIN DEC2HEX DEC2OCT DECIMAL DEGREES DELTA DEVSQ DGET DISC DMAX DMIN DOLLAR DOLLARDE DOLLARFR DPRODUCT DSTDEV DSTDEVP DSUM DURATION DVAR DVARP EDATE EFFECT ENCODEURL EOMONTH ERF ERF.PRECISE ERFC ERFC.PRECISE ERROR.TYPE EUROCONVERT EVEN EXACT EXP EXPON.DIST EXPONDIST FACT FACTDOUBLE FALSE|0 F.DIST FDIST F.DIST.RT FILTERXML FIND FINDB F.INV F.INV.RT FINV FISHER FISHERINV FIXED FLOOR FLOOR.MATH FLOOR.PRECISE FORECAST FORECAST.ETS FORECAST.ETS.CONFINT FORECAST.ETS.SEASONALITY FORECAST.ETS.STAT FORECAST.LINEAR FORMULATEXT FREQUENCY F.TEST FTEST FV FVSCHEDULE GAMMA GAMMA.DIST GAMMADIST GAMMA.INV GAMMAINV GAMMALN GAMMALN.PRECISE GAUSS GCD GEOMEAN GESTEP GETPIVOTDATA GROWTH HARMEAN HEX2BIN HEX2DEC HEX2OCT HLOOKUP HOUR HYPERLINK HYPGEOM.DIST HYPGEOMDIST IF IFERROR IFNA IFS IMABS IMAGINARY IMARGUMENT IMCONJUGATE IMCOS IMCOSH IMCOT IMCSC IMCSCH IMDIV IMEXP IMLN IMLOG10 IMLOG2 IMPOWER IMPRODUCT IMREAL IMSEC IMSECH IMSIN IMSINH IMSQRT IMSUB IMSUM IMTAN INDEX INDIRECT INFO INT INTERCEPT INTRATE IPMT IRR ISBLANK ISERR ISERROR ISEVEN ISFORMULA ISLOGICAL ISNA ISNONTEXT ISNUMBER ISODD ISREF ISTEXT ISO.CEILING ISOWEEKNUM ISPMT JIS KURT LARGE LCM LEFT LEFTB LEN LENB LINEST LN LOG LOG10 LOGEST LOGINV LOGNORM.DIST LOGNORMDIST LOGNORM.INV LOOKUP LOWER MATCH MAX MAXA MAXIFS MDETERM MDURATION MEDIAN MID MIDBs MIN MINIFS MINA MINUTE MINVERSE MIRR MMULT MOD MODE MODE.MULT MODE.SNGL MONTH MROUND MULTINOMIAL MUNIT N NA NEGBINOM.DIST NEGBINOMDIST NETWORKDAYS NETWORKDAYS.INTL NOMINAL NORM.DIST NORMDIST NORMINV NORM.INV NORM.S.DIST NORMSDIST NORM.S.INV NORMSINV NOT NOW NPER NPV NUMBERVALUE OCT2BIN OCT2DEC OCT2HEX ODD ODDFPRICE ODDFYIELD ODDLPRICE ODDLYIELD OFFSET OR PDURATION PEARSON PERCENTILE.EXC PERCENTILE.INC PERCENTILE PERCENTRANK.EXC PERCENTRANK.INC PERCENTRANK PERMUT PERMUTATIONA PHI PHONETIC PI PMT POISSON.DIST POISSON POWER PPMT PRICE PRICEDISC PRICEMAT PROB PRODUCT PROPER PV QUARTILE QUARTILE.EXC QUARTILE.INC QUOTIENT RADIANS RAND RANDBETWEEN RANK.AVG RANK.EQ RANK RATE RECEIVED REGISTER.ID REPLACE REPLACEB REPT RIGHT RIGHTB ROMAN ROUND ROUNDDOWN ROUNDUP ROW ROWS RRI RSQ RTD SEARCH SEARCHB SEC SECH SECOND SERIESSUM SHEET SHEETS SIGN SIN SINH SKEW SKEW.P SLN SLOPE SMALL SQL.REQUEST SQRT SQRTPI STANDARDIZE STDEV STDEV.P STDEV.S STDEVA STDEVP STDEVPA STEYX SUBSTITUTE SUBTOTAL SUM SUMIF SUMIFS SUMPRODUCT SUMSQ SUMX2MY2 SUMX2PY2 SUMXMY2 SWITCH SYD T TAN TANH TBILLEQ TBILLPRICE TBILLYIELD T.DIST T.DIST.2T T.DIST.RT TDIST TEXT TEXTJOIN TIME TIMEVALUE T.INV T.INV.2T TINV TODAY TRANSPOSE TREND TRIM TRIMMEAN TRUE|0 TRUNC T.TEST TTEST TYPE UNICHAR UNICODE UPPER VALUE VAR VAR.P VAR.S VARA VARP VARPA VDB VLOOKUP WEBSERVICE WEEKDAY WEEKNUM WEIBULL WEIBULL.DIST WORKDAY WORKDAY.INTL XIRR XNPV XOR YEAR YEARFRAC YIELD YIELDDISC YIELDMAT Z.TEST ZTEST'

@@ -18,0 +18,0 @@ },

@@ -12,3 +12,3 @@ /*

var KEYWORDS = {
'keyword':
keyword:
'abort acronym acronyms alias all and assign binary card diag display ' +

@@ -19,4 +19,4 @@ 'else eq file files for free ge gt if integer le loop lt maximizing ' +

'smin solve sos1 sos2 sum system table then until using while xor yes',
'literal': 'eps inf na',
'built-in':
literal: 'eps inf na',
built_in:
'abs arccos arcsin arctan arctan2 Beta betaReg binomial ceil centropy ' +

@@ -23,0 +23,0 @@ 'cos cosh cvPower div div0 eDist entropy errorf execSeed exp fact ' +

@@ -11,5 +11,7 @@ /*

var GCODE_CLOSE_RE = '\\%';
var GCODE_KEYWORDS =
'IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT ' +
'EQ LT GT NE GE LE OR XOR';
var GCODE_KEYWORDS = {
$pattern: GCODE_IDENT_RE,
keyword: 'IF DO WHILE ENDWHILE CALL ENDIF SUB ENDSUB GOTO REPEAT ENDREPEAT ' +
'EQ LT GT NE GE LE OR XOR'
};
var GCODE_START = {

@@ -65,3 +67,2 @@ className: 'meta',

case_insensitive: true,
lexemes: GCODE_IDENT_RE,
keywords: GCODE_KEYWORDS,

@@ -68,0 +69,0 @@ contains: [

@@ -0,1 +1,34 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {RegExp | string } re
* @returns {string}
*/
function lookahead(re) {
return concat('(?=', re, ')');
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*

@@ -8,7 +41,63 @@ Language: Groovy

function variants(variants, obj = {}) {
obj.variants = variants;
return obj;
}
function groovy(hljs) {
const IDENT_RE = '[A-Za-z0-9_$]+';
const COMMENT = variants([
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT(
'/\\*\\*',
'\\*/',
{
relevance : 0,
contains : [
{
// eat up @'s in emails to prevent them to be recognized as doctags
begin: /\w+@/, relevance: 0
}, {
className : 'doctag',
begin : '@[A-Za-z]+'
}
]
}
)
]);
const REGEXP = {
className: 'regexp',
begin: /~?\/[^\/\n]+\//,
contains: [
hljs.BACKSLASH_ESCAPE
]
};
const NUMBER = variants([
hljs.BINARY_NUMBER_MODE,
hljs.C_NUMBER_MODE,
]);
const STRING = variants([
{
begin: /"""/,
end: /"""/
}, {
begin: /'''/,
end: /'''/
}, {
begin: "\\$/",
end: "/\\$",
relevance: 10
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
],
{ className: "string" }
);
return {
name: 'Groovy',
keywords: {
literal : 'true false null',
built_in: 'this super',
literal: 'true false null',
keyword:

@@ -19,56 +108,13 @@ 'byte short char int long boolean float double void ' +

// common keywords with Java
'super this abstract static volatile transient public private protected synchronized final ' +
'abstract static volatile transient public private protected synchronized final ' +
'class interface enum if else for while switch case break default continue ' +
'throw throws try catch finally implements extends new import package return instanceof'
},
contains: [
hljs.COMMENT(
'/\\*\\*',
'\\*/',
{
relevance : 0,
contains : [
{
// eat up @'s in emails to prevent them to be recognized as doctags
begin: /\w+@/, relevance: 0
},
{
className : 'doctag',
begin : '@[A-Za-z]+'
}
]
}
),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.SHEBANG(),
COMMENT,
STRING,
REGEXP,
NUMBER,
{
className: 'string',
begin: '"""', end: '"""'
},
{
className: 'string',
begin: "'''", end: "'''"
},
{
className: 'string',
begin: "\\$/", end: "/\\$",
relevance: 10
},
hljs.APOS_STRING_MODE,
{
className: 'regexp',
begin: /~?\/[^\/\n]+\//,
contains: [
hljs.BACKSLASH_ESCAPE
]
},
hljs.QUOTE_STRING_MODE,
{
className: 'meta',
begin: "^#!/usr/bin/env", end: '$',
illegal: '\n'
},
hljs.BINARY_NUMBER_MODE,
{
className: 'class',

@@ -82,3 +128,2 @@ beginKeywords: 'class interface trait enum', end: '{',

},
hljs.C_NUMBER_MODE,
{

@@ -88,13 +133,24 @@ className: 'meta', begin: '@[A-Za-z]+'

{
// highlight map keys and named parameters as strings
className: 'string', begin: /[^\?]{0}[A-Za-z0-9_$]+ *:/
// highlight map keys and named parameters as attrs
className: 'attr', begin: IDENT_RE + '[ \t]*:'
},
{
// catch middle element of the ternary operator
// to avoid highlight it as a label, named parameter, or map key
begin: /\?/, end: /\:/
// catch middle element of the ternary operator
// to avoid highlight it as a label, named parameter, or map key
begin: /\?/,
end: /:/,
contains: [
COMMENT,
STRING,
REGEXP,
NUMBER,
'self'
]
},
{
// highlight labeled statements
className: 'symbol', begin: '^\\s*[A-Za-z0-9_$]+:',
className: 'symbol',
begin: '^[ \t]*' + lookahead(IDENT_RE + ':'),
excludeBegin: true,
end: IDENT_RE + ':',
relevance: 0

@@ -104,5 +160,5 @@ }

illegal: /#|<\//
}
};
}
module.exports = groovy;

@@ -0,1 +1,26 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*

@@ -11,33 +36,176 @@ Language: Handlebars

function handlebars(hljs) {
var BUILT_INS = {'builtin-name': 'each in with if else unless bindattr action collection debugger log outlet template unbound view yield lookup'};
const BUILT_INS = {
'builtin-name': [
'action',
'bindattr',
'collection',
'component',
'concat',
'debugger',
'each',
'each-in',
'get',
'hash',
'if',
'in',
'input',
'link-to',
'loc',
'log',
'lookup',
'mut',
'outlet',
'partial',
'query-params',
'render',
'template',
'textarea',
'unbound',
'unless',
'view',
'with',
'yield'
].join(" ")
};
var IDENTIFIER_PLAIN_OR_QUOTED = {
begin: /".*?"|'.*?'|\[.*?\]|\w+/
const LITERALS = {
literal: [
'true',
'false',
'undefined',
'null'
].join(" ")
};
var EXPRESSION_OR_HELPER_CALL = hljs.inherit(IDENTIFIER_PLAIN_OR_QUOTED, {
keywords: BUILT_INS,
// as defined in https://handlebarsjs.com/guide/expressions.html#literal-segments
// this regex matches literal segments like ' abc ' or [ abc ] as well as helpers and paths
// like a/b, ./abc/cde, and abc.bcd
const DOUBLE_QUOTED_ID_REGEX=/".*?"/;
const SINGLE_QUOTED_ID_REGEX=/'.*?'/;
const BRACKET_QUOTED_ID_REGEX=/\[.*?\]/;
const PLAIN_ID_REGEX=/[^\s!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/;
const PATH_DELIMITER_REGEX=/\.|\//;
const IDENTIFIER_REGEX = concat(
'(',
SINGLE_QUOTED_ID_REGEX, '|',
DOUBLE_QUOTED_ID_REGEX, '|',
BRACKET_QUOTED_ID_REGEX, '|',
PLAIN_ID_REGEX, '|',
PATH_DELIMITER_REGEX,
')+'
);
// identifier followed by a equal-sign (without the equal sign)
const HASH_PARAM_REGEX = concat(
'(',
BRACKET_QUOTED_ID_REGEX, '|',
PLAIN_ID_REGEX,
')(?==)'
);
const HELPER_NAME_OR_PATH_EXPRESSION = {
begin: IDENTIFIER_REGEX,
lexemes: /[\w.\/]+/
};
const HELPER_PARAMETER = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
keywords: LITERALS
});
const SUB_EXPRESSION = {
begin: /\(/,
end: /\)/
// the "contains" is added below when all necessary sub-modes are defined
};
const HASH = {
// fka "attribute-assignment", parameters of the form 'key=value'
className: 'attr',
begin: HASH_PARAM_REGEX,
relevance: 0,
starts: {
// helper params
endsWithParent: true,
relevance: 0,
contains: [hljs.inherit(IDENTIFIER_PLAIN_OR_QUOTED, {relevance: 0})]
begin: /=/,
end: /=/,
starts: {
contains: [
hljs.NUMBER_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
HELPER_PARAMETER,
SUB_EXPRESSION
]
}
}
};
const BLOCK_PARAMS = {
// parameters of the form '{{#with x as | y |}}...{{/with}}'
begin: /as\s+\|/,
keywords: { keyword: 'as' },
end: /\|/,
contains: [
{
// define sub-mode in order to prevent highlighting of block-parameter named "as"
begin: /\w+/
}
]
};
const HELPER_PARAMETERS = {
contains: [
hljs.NUMBER_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
BLOCK_PARAMS,
HASH,
HELPER_PARAMETER,
SUB_EXPRESSION
],
returnEnd: true
// the property "end" is defined through inheritance when the mode is used. If depends
// on the surrounding mode, but "endsWithParent" does not work here (i.e. it includes the
// end-token of the surrounding mode)
};
const SUB_EXPRESSION_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
className: 'name',
keywords: BUILT_INS,
starts: hljs.inherit(HELPER_PARAMETERS, {
end: /\)/,
})
});
var BLOCK_MUSTACHE_CONTENTS = hljs.inherit(EXPRESSION_OR_HELPER_CALL, {
SUB_EXPRESSION.contains = [
SUB_EXPRESSION_CONTENTS
];
const OPENING_BLOCK_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
keywords: BUILT_INS,
className: 'name',
starts: hljs.inherit(HELPER_PARAMETERS, {
end: /}}/,
})
});
const CLOSING_BLOCK_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
keywords: BUILT_INS,
className: 'name'
});
var BASIC_MUSTACHE_CONTENTS = hljs.inherit(EXPRESSION_OR_HELPER_CALL, {
// relevance 0 for backward compatibility concerning auto-detection
relevance: 0
const BASIC_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
className: 'name',
keywords: BUILT_INS,
starts: hljs.inherit(HELPER_PARAMETERS, {
end: /}}/,
})
});
var ESCAPE_MUSTACHE_WITH_PRECEEDING_BACKSLASH = {begin: /\\\{\{/, skip: true};
var PREVENT_ESCAPE_WITH_ANOTHER_PRECEEDING_BACKSLASH = {begin: /\\\\(?=\{\{)/, skip: true};
const ESCAPE_MUSTACHE_WITH_PRECEEDING_BACKSLASH = {begin: /\\\{\{/, skip: true};
const PREVENT_ESCAPE_WITH_ANOTHER_PRECEEDING_BACKSLASH = {begin: /\\\\(?=\{\{)/, skip: true};
return {
name: 'Handlebars',
aliases: ['hbs', 'html.hbs', 'html.handlebars'],
aliases: ['hbs', 'html.hbs', 'html.handlebars', 'htmlbars'],
case_insensitive: true,

@@ -53,4 +221,5 @@ subLanguage: 'xml',

className: 'template-tag',
begin: /\{\{\{\{(?!\/)/, end: /\}\}\}\}/,
contains: [BLOCK_MUSTACHE_CONTENTS],
begin: /\{\{\{\{(?!\/)/,
end: /\}\}\}\}/,
contains: [OPENING_BLOCK_MUSTACHE_CONTENTS],
starts: {end: /\{\{\{\{\//, returnEnd: true, subLanguage: 'xml'}

@@ -61,4 +230,5 @@ },

className: 'template-tag',
begin: /\{\{\{\{\//, end: /\}\}\}\}/,
contains: [BLOCK_MUSTACHE_CONTENTS]
begin: /\{\{\{\{\//,
end: /\}\}\}\}/,
contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS]
},

@@ -68,10 +238,24 @@ {

className: 'template-tag',
begin: /\{\{[#\/]/, end: /\}\}/,
contains: [BLOCK_MUSTACHE_CONTENTS],
begin: /\{\{#/,
end: /\}\}/,
contains: [OPENING_BLOCK_MUSTACHE_CONTENTS],
},
{
className: 'template-tag',
begin: /\{\{(?=else\}\})/,
end: /\}\}/,
keywords: 'else'
},
{
// closing block statement
className: 'template-tag',
begin: /\{\{\//,
end: /\}\}/,
contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS],
},
{
// template variable or helper-call that is NOT html-escaped
className: 'template-variable',
begin: /\{\{\{/, end: /\}\}\}/,
keywords: BUILT_INS,
begin: /\{\{\{/,
end: /\}\}\}/,
contains: [BASIC_MUSTACHE_CONTENTS]

@@ -82,4 +266,4 @@ },

className: 'template-variable',
begin: /\{\{/, end: /\}\}/,
keywords: BUILT_INS,
begin: /\{\{/,
end: /\}\}/,
contains: [BASIC_MUSTACHE_CONTENTS]

@@ -86,0 +270,0 @@ }

@@ -12,4 +12,6 @@ /*

case_insensitive: true,
lexemes: /[\w\._]+/,
keywords: 'goto gosub return break repeat loop continue wait await dim sdim foreach dimtype dup dupptr end stop newmod delmod mref run exgoto on mcall assert logmes newlab resume yield onexit onerror onkey onclick oncmd exist delete mkdir chdir dirlist bload bsave bcopy memfile if else poke wpoke lpoke getstr chdpm memexpand memcpy memset notesel noteadd notedel noteload notesave randomize noteunsel noteget split strrep setease button chgdisp exec dialog mmload mmplay mmstop mci pset pget syscolor mes print title pos circle cls font sysfont objsize picload color palcolor palette redraw width gsel gcopy gzoom gmode bmpsave hsvcolor getkey listbox chkbox combox input mesbox buffer screen bgscr mouse objsel groll line clrobj boxf objprm objmode stick grect grotate gsquare gradf objimage objskip objenable celload celdiv celput newcom querycom delcom cnvstow comres axobj winobj sendmsg comevent comevarg sarrayconv callfunc cnvwtos comevdisp libptr system hspstat hspver stat cnt err strsize looplev sublev iparam wparam lparam refstr refdval int rnd strlen length length2 length3 length4 vartype gettime peek wpeek lpeek varptr varuse noteinfo instr abs limit getease str strmid strf getpath strtrim sin cos tan atan sqrt double absf expf logf limitf powf geteasef mousex mousey mousew hwnd hinstance hdc ginfo objinfo dirinfo sysinfo thismod __hspver__ __hsp30__ __date__ __time__ __line__ __file__ _debug __hspdef__ and or xor not screen_normal screen_palette screen_hide screen_fixedsize screen_tool screen_frame gmode_gdi gmode_mem gmode_rgb0 gmode_alpha gmode_rgb0alpha gmode_add gmode_sub gmode_pixela ginfo_mx ginfo_my ginfo_act ginfo_sel ginfo_wx1 ginfo_wy1 ginfo_wx2 ginfo_wy2 ginfo_vx ginfo_vy ginfo_sizex ginfo_sizey ginfo_winx ginfo_winy ginfo_mesx ginfo_mesy ginfo_r ginfo_g ginfo_b ginfo_paluse ginfo_dispx ginfo_dispy ginfo_cx ginfo_cy ginfo_intid ginfo_newid ginfo_sx ginfo_sy objinfo_mode objinfo_bmscr objinfo_hwnd notemax notesize dir_cur dir_exe dir_win dir_sys dir_cmdline dir_desktop dir_mydoc dir_tv font_normal font_bold font_italic font_underline font_strikeout font_antialias objmode_normal objmode_guifont objmode_usefont gsquare_grad msgothic msmincho do until while wend for next _break _continue switch case default swbreak swend ddim ldim alloc m_pi rad2deg deg2rad ease_linear ease_quad_in ease_quad_out ease_quad_inout ease_cubic_in ease_cubic_out ease_cubic_inout ease_quartic_in ease_quartic_out ease_quartic_inout ease_bounce_in ease_bounce_out ease_bounce_inout ease_shake_in ease_shake_out ease_shake_inout ease_loop',
keywords: {
$pattern: /[\w._]+/,
keyword: 'goto gosub return break repeat loop continue wait await dim sdim foreach dimtype dup dupptr end stop newmod delmod mref run exgoto on mcall assert logmes newlab resume yield onexit onerror onkey onclick oncmd exist delete mkdir chdir dirlist bload bsave bcopy memfile if else poke wpoke lpoke getstr chdpm memexpand memcpy memset notesel noteadd notedel noteload notesave randomize noteunsel noteget split strrep setease button chgdisp exec dialog mmload mmplay mmstop mci pset pget syscolor mes print title pos circle cls font sysfont objsize picload color palcolor palette redraw width gsel gcopy gzoom gmode bmpsave hsvcolor getkey listbox chkbox combox input mesbox buffer screen bgscr mouse objsel groll line clrobj boxf objprm objmode stick grect grotate gsquare gradf objimage objskip objenable celload celdiv celput newcom querycom delcom cnvstow comres axobj winobj sendmsg comevent comevarg sarrayconv callfunc cnvwtos comevdisp libptr system hspstat hspver stat cnt err strsize looplev sublev iparam wparam lparam refstr refdval int rnd strlen length length2 length3 length4 vartype gettime peek wpeek lpeek varptr varuse noteinfo instr abs limit getease str strmid strf getpath strtrim sin cos tan atan sqrt double absf expf logf limitf powf geteasef mousex mousey mousew hwnd hinstance hdc ginfo objinfo dirinfo sysinfo thismod __hspver__ __hsp30__ __date__ __time__ __line__ __file__ _debug __hspdef__ and or xor not screen_normal screen_palette screen_hide screen_fixedsize screen_tool screen_frame gmode_gdi gmode_mem gmode_rgb0 gmode_alpha gmode_rgb0alpha gmode_add gmode_sub gmode_pixela ginfo_mx ginfo_my ginfo_act ginfo_sel ginfo_wx1 ginfo_wy1 ginfo_wx2 ginfo_wy2 ginfo_vx ginfo_vy ginfo_sizex ginfo_sizey ginfo_winx ginfo_winy ginfo_mesx ginfo_mesy ginfo_r ginfo_g ginfo_b ginfo_paluse ginfo_dispx ginfo_dispy ginfo_cx ginfo_cy ginfo_intid ginfo_newid ginfo_sx ginfo_sy objinfo_mode objinfo_bmscr objinfo_hwnd notemax notesize dir_cur dir_exe dir_win dir_sys dir_cmdline dir_desktop dir_mydoc dir_tv font_normal font_bold font_italic font_underline font_strikeout font_antialias objmode_normal objmode_guifont objmode_usefont gsquare_grad msgothic msmincho do until while wend for next _break _continue switch case default swbreak swend ddim ldim alloc m_pi rad2deg deg2rad ease_linear ease_quad_in ease_quad_out ease_quad_inout ease_cubic_in ease_cubic_out ease_cubic_inout ease_quartic_in ease_quartic_out ease_quartic_inout ease_bounce_in ease_bounce_out ease_bounce_inout ease_shake_in ease_shake_out ease_shake_inout ease_loop'
},
contains: [

@@ -16,0 +18,0 @@ hljs.C_LINE_COMMENT_MODE,

@@ -0,44 +1,151 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*
Language: HTMLBars
Requires: xml.js, handlebars.js
Author: Michael Johnston <lastobelus@gmail.com>
Description: Matcher for HTMLBars
Website: https://github.com/tildeio/htmlbars
Language: Handlebars
Requires: xml.js
Author: Robin Ward <robin.ward@gmail.com>
Description: Matcher for Handlebars as well as EmberJS additions.
Website: https://handlebarsjs.com
Category: template
*/
function htmlbars(hljs) {
// This work isn't complete yet but this is done so that this technically
// breaking change becomes a part of the 10.0 release and won't force
// us to prematurely release 11.0 just to break this.
var SHOULD_INHERIT_FROM_HANDLEBARS = hljs.requireLanguage('handlebars');
// https://github.com/highlightjs/highlight.js/issues/2181
function handlebars(hljs) {
const BUILT_INS = {
'builtin-name': [
'action',
'bindattr',
'collection',
'component',
'concat',
'debugger',
'each',
'each-in',
'get',
'hash',
'if',
'in',
'input',
'link-to',
'loc',
'log',
'lookup',
'mut',
'outlet',
'partial',
'query-params',
'render',
'template',
'textarea',
'unbound',
'unless',
'view',
'with',
'yield'
].join(" ")
};
var BUILT_INS = 'action collection component concat debugger each each-in else get hash if input link-to loc log mut outlet partial query-params render textarea unbound unless with yield view';
const LITERALS = {
literal: [
'true',
'false',
'undefined',
'null'
].join(" ")
};
var ATTR_ASSIGNMENT = {
illegal: /\}\}/,
begin: /[a-zA-Z0-9_]+=/,
returnBegin: true,
// as defined in https://handlebarsjs.com/guide/expressions.html#literal-segments
// this regex matches literal segments like ' abc ' or [ abc ] as well as helpers and paths
// like a/b, ./abc/cde, and abc.bcd
const DOUBLE_QUOTED_ID_REGEX=/".*?"/;
const SINGLE_QUOTED_ID_REGEX=/'.*?'/;
const BRACKET_QUOTED_ID_REGEX=/\[.*?\]/;
const PLAIN_ID_REGEX=/[^\s!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/;
const PATH_DELIMITER_REGEX=/\.|\//;
const IDENTIFIER_REGEX = concat(
'(',
SINGLE_QUOTED_ID_REGEX, '|',
DOUBLE_QUOTED_ID_REGEX, '|',
BRACKET_QUOTED_ID_REGEX, '|',
PLAIN_ID_REGEX, '|',
PATH_DELIMITER_REGEX,
')+'
);
// identifier followed by a equal-sign (without the equal sign)
const HASH_PARAM_REGEX = concat(
'(',
BRACKET_QUOTED_ID_REGEX, '|',
PLAIN_ID_REGEX,
')(?==)'
);
const HELPER_NAME_OR_PATH_EXPRESSION = {
begin: IDENTIFIER_REGEX,
lexemes: /[\w.\/]+/
};
const HELPER_PARAMETER = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
keywords: LITERALS
});
const SUB_EXPRESSION = {
begin: /\(/,
end: /\)/
// the "contains" is added below when all necessary sub-modes are defined
};
const HASH = {
// fka "attribute-assignment", parameters of the form 'key=value'
className: 'attr',
begin: HASH_PARAM_REGEX,
relevance: 0,
contains: [
{
className: 'attr', begin: /[a-zA-Z0-9_]+/
starts: {
begin: /=/,
end: /=/,
starts: {
contains: [
hljs.NUMBER_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
HELPER_PARAMETER,
SUB_EXPRESSION
]
}
]
}
};
var SUB_EXPR = {
illegal: /\}\}/,
begin: /\)/, end: /\)/,
const BLOCK_PARAMS = {
// parameters of the form '{{#with x as | y |}}...{{/with}}'
begin: /as\s+\|/,
keywords: { keyword: 'as' },
end: /\|/,
contains: [
{
begin: /[a-zA-Z\.\-]+/,
keywords: {built_in: BUILT_INS},
starts: {
endsWithParent: true, relevance: 0,
contains: [
hljs.QUOTE_STRING_MODE,
]
}
// define sub-mode in order to prevent highlighting of block-parameter named "as"
begin: /\w+/
}

@@ -48,37 +155,112 @@ ]

var TAG_INNARDS = {
endsWithParent: true, relevance: 0,
keywords: {keyword: 'as', built_in: BUILT_INS},
const HELPER_PARAMETERS = {
contains: [
hljs.NUMBER_MODE,
hljs.QUOTE_STRING_MODE,
ATTR_ASSIGNMENT,
hljs.NUMBER_MODE
]
hljs.APOS_STRING_MODE,
BLOCK_PARAMS,
HASH,
HELPER_PARAMETER,
SUB_EXPRESSION
],
returnEnd: true
// the property "end" is defined through inheritance when the mode is used. If depends
// on the surrounding mode, but "endsWithParent" does not work here (i.e. it includes the
// end-token of the surrounding mode)
};
const SUB_EXPRESSION_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
className: 'name',
keywords: BUILT_INS,
starts: hljs.inherit(HELPER_PARAMETERS, {
end: /\)/,
})
});
SUB_EXPRESSION.contains = [
SUB_EXPRESSION_CONTENTS
];
const OPENING_BLOCK_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
keywords: BUILT_INS,
className: 'name',
starts: hljs.inherit(HELPER_PARAMETERS, {
end: /}}/,
})
});
const CLOSING_BLOCK_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
keywords: BUILT_INS,
className: 'name'
});
const BASIC_MUSTACHE_CONTENTS = hljs.inherit(HELPER_NAME_OR_PATH_EXPRESSION, {
className: 'name',
keywords: BUILT_INS,
starts: hljs.inherit(HELPER_PARAMETERS, {
end: /}}/,
})
});
const ESCAPE_MUSTACHE_WITH_PRECEEDING_BACKSLASH = {begin: /\\\{\{/, skip: true};
const PREVENT_ESCAPE_WITH_ANOTHER_PRECEEDING_BACKSLASH = {begin: /\\\\(?=\{\{)/, skip: true};
return {
name: 'HTMLBars',
name: 'Handlebars',
aliases: ['hbs', 'html.hbs', 'html.handlebars', 'htmlbars'],
case_insensitive: true,
subLanguage: 'xml',
contains: [
hljs.COMMENT('{{!(--)?', '(--)?}}'),
ESCAPE_MUSTACHE_WITH_PRECEEDING_BACKSLASH,
PREVENT_ESCAPE_WITH_ANOTHER_PRECEEDING_BACKSLASH,
hljs.COMMENT(/\{\{!--/, /--\}\}/),
hljs.COMMENT(/\{\{!/, /\}\}/),
{
// open raw block "{{{{raw}}}} content not evaluated {{{{/raw}}}}"
className: 'template-tag',
begin: /\{\{[#\/]/, end: /\}\}/,
contains: [
{
className: 'name',
begin: /[a-zA-Z\.\-]+/,
keywords: {'builtin-name': BUILT_INS},
starts: TAG_INNARDS
}
]
begin: /\{\{\{\{(?!\/)/,
end: /\}\}\}\}/,
contains: [OPENING_BLOCK_MUSTACHE_CONTENTS],
starts: {end: /\{\{\{\{\//, returnEnd: true, subLanguage: 'xml'}
},
{
// close raw block
className: 'template-tag',
begin: /\{\{\{\{\//,
end: /\}\}\}\}/,
contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS]
},
{
// open block statement
className: 'template-tag',
begin: /\{\{#/,
end: /\}\}/,
contains: [OPENING_BLOCK_MUSTACHE_CONTENTS],
},
{
className: 'template-tag',
begin: /\{\{(?=else\}\})/,
end: /\}\}/,
keywords: 'else'
},
{
// closing block statement
className: 'template-tag',
begin: /\{\{\//,
end: /\}\}/,
contains: [CLOSING_BLOCK_MUSTACHE_CONTENTS],
},
{
// template variable or helper-call that is NOT html-escaped
className: 'template-variable',
begin: /\{\{[a-zA-Z][a-zA-Z\-]+/, end: /\}\}/,
keywords: {keyword: 'as', built_in: BUILT_INS},
contains: [
hljs.QUOTE_STRING_MODE
]
begin: /\{\{\{/,
end: /\}\}\}/,
contains: [BASIC_MUSTACHE_CONTENTS]
},
{
// template variable or helper-call that is html-escaped
className: 'template-variable',
begin: /\{\{/,
end: /\}\}/,
contains: [BASIC_MUSTACHE_CONTENTS]
}

@@ -89,2 +271,30 @@ ]

/*
Language: HTMLBars (legacy)
Requires: xml.js
Description: Matcher for Handlebars as well as EmberJS additions.
Website: https://github.com/tildeio/htmlbars
Category: template
*/
function htmlbars(hljs) {
const definition = handlebars(hljs);
definition.name = "HTMLbars";
// HACK: This lets handlebars do the auto-detection if it's been loaded (by
// default the build script will load in alphabetical order) and if not (perhaps
// an install is only using `htmlbars`, not `handlebars`) then this will still
// allow HTMLBars to participate in the auto-detection
// worse case someone will have HTMLbars and handlebars competing for the same
// content and will need to change their setup to only require handlebars, but
// I don't consider this a breaking change
if (hljs.getLanguage("handlebars")) {
definition.disableAutodetect = true;
}
return definition
}
module.exports = htmlbars;

@@ -10,3 +10,6 @@ /*

function hy(hljs) {
var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
var keywords = {
$pattern: SYMBOL_RE,
'builtin-name':

@@ -45,11 +48,4 @@ // keywords

var SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
var SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
var SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';
var SHEBANG = {
className: 'meta',
begin: '^#!', end: '$'
};
var SYMBOL = {

@@ -96,3 +92,2 @@ begin: SYMBOL_RE,

keywords: keywords,
lexemes: SYMBOL_RE,
className: 'name', begin: SYMBOL_RE,

@@ -111,3 +106,3 @@ starts: BODY

illegal: /\S/,
contains: [SHEBANG, LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER, LITERAL]
contains: [hljs.SHEBANG(), LIST, STRING, HINT, HINT_COL, COMMENT, KEY, COLLECTION, NUMBER, LITERAL]
}

@@ -114,0 +109,0 @@ }

@@ -0,1 +1,46 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {RegExp | string } re
* @returns {string}
*/
function lookahead(re) {
return concat('(?=', re, ')');
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] } args
* @returns {string}
*/
function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*

@@ -57,2 +102,13 @@ Language: TOML, also INI

var BARE_KEY = /[A-Za-z0-9_-]+/;
var QUOTED_KEY_DOUBLE_QUOTE = /"(\\"|[^"])*"/;
var QUOTED_KEY_SINGLE_QUOTE = /'[^']*'/;
var ANY_KEY = either(
BARE_KEY, QUOTED_KEY_DOUBLE_QUOTE, QUOTED_KEY_SINGLE_QUOTE
);
var DOTTED_KEY = concat(
ANY_KEY, '(\\s*\\.\\s*', ANY_KEY, ')*',
lookahead(/\s*=\s*[^#\s]/)
);
return {

@@ -70,3 +126,3 @@ name: 'TOML, also INI',

{
begin: /^[a-z0-9\[\]_\.-]+(?=\s*=\s*)/,
begin: DOTTED_KEY,
className: 'attr',

@@ -73,0 +129,0 @@ starts: {

@@ -0,1 +1,46 @@

/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {RegExp | string } re
* @returns {string}
*/
function optional(re) {
return concat('(', re, ')?');
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] } args
* @returns {string}
*/
function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*

@@ -11,4 +56,3 @@ Language: Java

var GENERIC_IDENT_RE = JAVA_IDENT_RE + '(<' + JAVA_IDENT_RE + '(\\s*,\\s*' + JAVA_IDENT_RE + ')*>)?';
var KEYWORDS =
'false synchronized int abstract float private char boolean var static null if const ' +
var KEYWORDS = 'false synchronized int abstract float private char boolean var static null if const ' +
'for true while long strictfp finally protected import native final void ' +

@@ -22,3 +66,3 @@ 'enum else break transient catch instanceof byte super volatile case assert short ' +

begin: '@' + JAVA_IDENT_RE,
contains:[
contains: [
{

@@ -31,20 +75,41 @@ begin: /\(/,

};
// https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html
var JAVA_NUMBER_RE = '\\b' +
'(' +
'0[bB]([01]+[01_]+[01]+|[01]+)' + // 0b...
'|' +
'0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)' + // 0x...
'|' +
'(' +
'([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?' +
'|' +
'\\.([\\d]+[\\d_]+[\\d]+|[\\d]+)' +
')' +
'([eE][-+]?\\d+)?' + // octal, decimal, float
')' +
'[lLfF]?';
/**
* A given sequence, possibly with underscores
* @type {(s: string | RegExp) => string} */
var SEQUENCE_ALLOWING_UNDERSCORES = (seq) => concat('[', seq, ']+([', seq, '_]*[', seq, ']+)?');
var JAVA_NUMBER_MODE = {
className: 'number',
begin: JAVA_NUMBER_RE,
variants: [
{ begin: `\\b(0[bB]${SEQUENCE_ALLOWING_UNDERSCORES('01')})[lL]?` }, // binary
{ begin: `\\b(0${SEQUENCE_ALLOWING_UNDERSCORES('0-7')})[dDfFlL]?` }, // octal
{
begin: concat(
/\b0[xX]/,
either(
concat(SEQUENCE_ALLOWING_UNDERSCORES('a-fA-F0-9'), /\./, SEQUENCE_ALLOWING_UNDERSCORES('a-fA-F0-9')),
concat(SEQUENCE_ALLOWING_UNDERSCORES('a-fA-F0-9'), /\.?/),
concat(/\./, SEQUENCE_ALLOWING_UNDERSCORES('a-fA-F0-9')),
),
/([pP][+-]?(\d+))?/,
/[fFdDlL]?/ // decimal & fp mixed for simplicity
)
},
// scientific notation
{ begin: concat(
/\b/,
either(
concat(/\d*\./, SEQUENCE_ALLOWING_UNDERSCORES("\\d")), // .3, 3.3, 3.3_3
SEQUENCE_ALLOWING_UNDERSCORES("\\d") // 3, 3_3
),
/[eE][+-]?[\d]+[dDfF]?/)
},
// decimal & fp mixed for simplicity
{ begin: concat(
/\b/,
SEQUENCE_ALLOWING_UNDERSCORES(/\d/),
optional(/\.?/),
optional(SEQUENCE_ALLOWING_UNDERSCORES(/\d/)),
/[dDfFlL]?/)
}
],
relevance: 0

@@ -63,4 +128,4 @@ };

{
relevance : 0,
contains : [
relevance: 0,
contains: [
{

@@ -71,4 +136,4 @@ // eat up @'s in emails to prevent them to be recognized as doctags

{
className : 'doctag',
begin : '@[A-Za-z]+'
className: 'doctag',
begin: '@[A-Za-z]+'
}

@@ -88,3 +153,3 @@ ]

contains: [
{beginKeywords: 'extends implements'},
{ beginKeywords: 'extends implements' },
hljs.UNDERSCORE_TITLE_MODE

@@ -91,0 +156,0 @@ ]

@@ -0,1 +1,172 @@

const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
const KEYWORDS = [
"as", // for exports
"in",
"of",
"if",
"for",
"while",
"finally",
"var",
"new",
"function",
"do",
"return",
"void",
"else",
"break",
"catch",
"instanceof",
"with",
"throw",
"case",
"default",
"try",
"switch",
"continue",
"typeof",
"delete",
"let",
"yield",
"const",
"class",
// JS handles these with a special rule
// "get",
// "set",
"debugger",
"async",
"await",
"static",
"import",
"from",
"export",
"extends"
];
const LITERALS = [
"true",
"false",
"null",
"undefined",
"NaN",
"Infinity"
];
const TYPES = [
"Intl",
"DataView",
"Number",
"Math",
"Date",
"String",
"RegExp",
"Object",
"Function",
"Boolean",
"Error",
"Symbol",
"Set",
"Map",
"WeakSet",
"WeakMap",
"Proxy",
"Reflect",
"JSON",
"Promise",
"Float64Array",
"Int16Array",
"Int32Array",
"Int8Array",
"Uint16Array",
"Uint32Array",
"Float32Array",
"Array",
"Uint8Array",
"Uint8ClampedArray",
"ArrayBuffer"
];
const ERROR_TYPES = [
"EvalError",
"InternalError",
"RangeError",
"ReferenceError",
"SyntaxError",
"TypeError",
"URIError"
];
const BUILT_IN_GLOBALS = [
"setInterval",
"setTimeout",
"clearInterval",
"clearTimeout",
"require",
"exports",
"eval",
"isFinite",
"isNaN",
"parseFloat",
"parseInt",
"decodeURI",
"decodeURIComponent",
"encodeURI",
"encodeURIComponent",
"escape",
"unescape"
];
const BUILT_IN_VARIABLES = [
"arguments",
"this",
"super",
"console",
"window",
"document",
"localStorage",
"module",
"global" // Node.js
];
const BUILT_INS = [].concat(
BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,
ERROR_TYPES
);
/**
* @param {string} value
* @returns {RegExp}
* */
/**
* @param {RegExp | string } re
* @returns {string}
*/
function source(re) {
if (!re) return null;
if (typeof re === "string") return re;
return re.source;
}
/**
* @param {RegExp | string } re
* @returns {string}
*/
function lookahead(re) {
return concat('(?=', re, ')');
}
/**
* @param {...(RegExp | string) } args
* @returns {string}
*/
function concat(...args) {
const joined = args.map((x) => source(x)).join("");
return joined;
}
/*

@@ -9,2 +180,3 @@ Language: JavaScript

function javascript(hljs) {
var IDENT_RE$1 = IDENT_RE;
var FRAGMENT = {

@@ -18,22 +190,7 @@ begin: '<>',

};
var IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
var KEYWORDS = {
keyword:
'in of if for while finally var new function do return void else break catch ' +
'instanceof with throw case default try this switch continue typeof delete ' +
'let yield const export super debugger as async await static ' +
// ECMAScript 6 modules import
'import from as'
,
literal:
'true false null undefined NaN Infinity',
built_in:
'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' +
'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' +
'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' +
'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
'module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect ' +
'Promise'
var KEYWORDS$1 = {
$pattern: IDENT_RE,
keyword: KEYWORDS.join(" "),
literal: LITERALS.join(" "),
built_in: BUILT_INS.join(" ")
};

@@ -52,3 +209,3 @@ var NUMBER = {

begin: '\\$\\{', end: '\\}',
keywords: KEYWORDS,
keywords: KEYWORDS$1,
contains: [] // defined later

@@ -96,2 +253,6 @@ };

var PARAMS_CONTAINS = SUBST.contains.concat([
// eat recursive parens in sub expressions
{ begin: /\(/, end: /\)/,
contains: ["self"].concat(SUBST.contains, [hljs.C_BLOCK_COMMENT_MODE, hljs.C_LINE_COMMENT_MODE])
},
hljs.C_BLOCK_COMMENT_MODE,

@@ -111,4 +272,8 @@ hljs.C_LINE_COMMENT_MODE

aliases: ['js', 'jsx', 'mjs', 'cjs'],
keywords: KEYWORDS,
keywords: KEYWORDS$1,
contains: [
hljs.SHEBANG({
binary: "node",
relevance: 5
}),
{

@@ -119,6 +284,2 @@ className: 'meta',

},
{
className: 'meta',
begin: /^#!/, end: /$/
},
hljs.APOS_STRING_MODE,

@@ -148,3 +309,3 @@ hljs.QUOTE_STRING_MODE,

className: 'variable',
begin: IDENT_RE + '(?=\\s*(-)|$)',
begin: IDENT_RE$1 + '(?=\\s*(-)|$)',
endsParent: true,

@@ -167,9 +328,25 @@ relevance: 0

{ // object attr container
begin: /[{,\n]\s*/, relevance: 0,
begin: concat(/[{,\n]\s*/,
// we need to look ahead to make sure that we actually have an
// attribute coming up so we don't steal a comma from a potential
// "value" container
//
// NOTE: this might not work how you think. We don't actually always
// enter this mode and stay. Instead it might merely match `,
// <comments up next>` and then immediately end after the , because it
// fails to find any actual attrs. But this still does the job because
// it prevents the value contain rule from grabbing this instead and
// prevening this rule from firing when we actually DO have keys.
lookahead(concat(
// we also need to allow for multiple possible comments inbetween
// the first key:value pairing
/(((\/\/.*)|(\/\*(.|\n)*\*\/))\s*)*/,
IDENT_RE$1 + '\\s*:'))),
relevance: 0,
contains: [
{
begin: IDENT_RE + '\\s*:', returnBegin: true,
className: 'attr',
begin: IDENT_RE$1 + lookahead('\\s*:'),
relevance: 0,
contains: [{className: 'attr', begin: IDENT_RE, relevance: 0}]
}
},
]

@@ -186,3 +363,11 @@ },

className: 'function',
begin: '(\\(.*?\\)|' + IDENT_RE + ')\\s*=>', returnBegin: true,
// we have to count the parens to make sure we actually have the
// correct bounding ( ) before the =>. There could be any number of
// sub-expressions inside also surrounded by parens.
begin: '(\\([^(]*' +
'(\\([^(]*' +
'(\\([^(]*' +
'\\))?' +
'\\))?' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>', returnBegin: true,
end: '\\s*=>',

@@ -194,6 +379,8 @@ contains: [

{
begin: IDENT_RE
begin: hljs.UNDERSCORE_IDENT_RE
},
{
className: null,
begin: /\(\s*\)/,
skip: true
},

@@ -203,3 +390,3 @@ {

excludeBegin: true, excludeEnd: true,
keywords: KEYWORDS,
keywords: KEYWORDS$1,
contains: PARAMS_CONTAINS

@@ -240,3 +427,3 @@ }

contains: [
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}),
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE$1}),
PARAMS

@@ -264,7 +451,7 @@ ],

{
begin:'(get|set)\\s+(?=' + IDENT_RE+ '\\()',
begin: '(get|set)\\s+(?=' + IDENT_RE$1 + '\\()',
end: /{/,
keywords: "get set",
contains: [
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE}),
hljs.inherit(hljs.TITLE_MODE, {begin: IDENT_RE$1}),
{ begin: /\(\)/ }, // eat to avoid empty params

@@ -271,0 +458,0 @@ PARAMS

@@ -38,4 +38,4 @@ /*

aliases: ['wildfly-cli'],
lexemes: '[a-z\-]+',
keywords: {
$pattern: '[a-z\-]+',
keyword: 'alias batch cd clear command connect connection-factory connection-info data-source deploy ' +

@@ -42,0 +42,0 @@ 'deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls ' +

@@ -15,3 +15,7 @@ /*

// ref: http://julia.readthedocs.org/en/latest/manual/variables/#allowed-variable-names
var VARIABLE_NAME_RE = '[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*';
var KEYWORDS = {
$pattern: VARIABLE_NAME_RE,
// # keyword generator, multi-word keywords handled manually below

@@ -85,8 +89,5 @@ // foreach(println, ["in", "isa", "where"])

// ref: http://julia.readthedocs.org/en/latest/manual/variables/#allowed-variable-names
var VARIABLE_NAME_RE = '[A-Za-z_\\u00A1-\\uFFFF][A-Za-z_0-9\\u00A1-\\uFFFF]*';
// placeholder for recursive self-reference
var DEFAULT = {
lexemes: VARIABLE_NAME_RE, keywords: KEYWORDS, illegal: /<\//
keywords: KEYWORDS, illegal: /<\//
};

@@ -93,0 +94,0 @@

@@ -13,2 +13,3 @@ /*

var LASSO_KEYWORDS = {
$pattern: LASSO_IDENT_RE + '|&[lg]t;',
literal:

@@ -120,3 +121,2 @@ 'true false none minimal full all void and or not ' +

case_insensitive: true,
lexemes: LASSO_IDENT_RE + '|&[lg]t;',
keywords: LASSO_KEYWORDS,

@@ -142,3 +142,2 @@ contains: [

end: '\\[/no_square_brackets\\]', // not implemented in the language
lexemes: LASSO_IDENT_RE + '|&[lg]t;',
keywords: LASSO_KEYWORDS,

@@ -145,0 +144,0 @@ contains: [

@@ -12,6 +12,2 @@ /*

var LISP_SIMPLE_NUMBER_RE = '(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|\\-)?\\d+)?';
var SHEBANG = {
className: 'meta',
begin: '^#!', end: '$'
};
var LITERAL = {

@@ -101,3 +97,3 @@ className: 'literal',

NUMBER,
SHEBANG,
hljs.SHEBANG(),
LITERAL,

@@ -104,0 +100,0 @@ STRING,

@@ -0,1 +1,138 @@

const KEYWORDS = [
"as", // for exports
"in",
"of",
"if",
"for",
"while",
"finally",
"var",
"new",
"function",
"do",
"return",
"void",
"else",
"break",
"catch",
"instanceof",
"with",
"throw",
"case",
"default",
"try",
"switch",
"continue",
"typeof",
"delete",
"let",
"yield",
"const",
"class",
// JS handles these with a special rule
// "get",
// "set",
"debugger",
"async",
"await",
"static",
"import",
"from",
"export",
"extends"
];
const LITERALS = [
"true",
"false",
"null",
"undefined",
"NaN",
"Infinity"
];
const TYPES = [
"Intl",
"DataView",
"Number",
"Math",
"Date",
"String",
"RegExp",
"Object",
"Function",
"Boolean",
"Error",
"Symbol",
"Set",
"Map",
"WeakSet",
"WeakMap",
"Proxy",
"Reflect",
"JSON",
"Promise",
"Float64Array",
"Int16Array",
"Int32Array",
"Int8Array",
"Uint16Array",
"Uint32Array",
"Float32Array",
"Array",
"Uint8Array",
"Uint8ClampedArray",
"ArrayBuffer"
];
const ERROR_TYPES = [
"EvalError",
"InternalError",
"RangeError",
"ReferenceError",
"SyntaxError",
"TypeError",
"URIError"
];
const BUILT_IN_GLOBALS = [
"setInterval",
"setTimeout",
"clearInterval",
"clearTimeout",
"require",
"exports",
"eval",
"isFinite",
"isNaN",
"parseFloat",
"parseInt",
"decodeURI",
"decodeURIComponent",
"encodeURI",
"encodeURIComponent",
"escape",
"unescape"
];
const BUILT_IN_VARIABLES = [
"arguments",
"this",
"super",
"console",
"window",
"document",
"localStorage",
"module",
"global" // Node.js
];
const BUILT_INS = [].concat(
BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,
ERROR_TYPES
);
/*

@@ -12,18 +149,50 @@ Language: LiveScript

function livescript(hljs) {
var KEYWORDS = {
keyword:
// JS keywords
'in if for while finally new do return else break catch instanceof throw try this ' +
'switch continue typeof delete debugger case default function var with ' +
// LiveScript keywords
'then unless until loop of by when and or is isnt not it that otherwise from to til fallthrough super ' +
'case default function var void const let enum export import native list map ' +
'__hasProp __extends __slice __bind __indexOf',
literal:
// JS literals
'true false null undefined ' +
// LiveScript literals
'yes no on off it that void',
built_in:
'npm require console print module global window document'
var LIVESCRIPT_BUILT_INS = [
'npm',
'print'
];
var LIVESCRIPT_LITERALS = [
'yes',
'no',
'on',
'off',
'it',
'that',
'void'
];
var LIVESCRIPT_KEYWORDS = [
'then',
'unless',
'until',
'loop',
'of',
'by',
'when',
'and',
'or',
'is',
'isnt',
'not',
'it',
'that',
'otherwise',
'from',
'to',
'til',
'fallthrough',
'case',
'enum',
'native',
'list',
'map',
'__hasProp',
'__extends',
'__slice',
'__bind',
'__indexOf'
];
var KEYWORDS$1 = {
keyword: KEYWORDS.concat(LIVESCRIPT_KEYWORDS).join(" "),
literal: LITERALS.concat(LIVESCRIPT_LITERALS).join(" "),
built_in: BUILT_INS.concat(LIVESCRIPT_BUILT_INS).join(" ")
};

@@ -35,3 +204,3 @@ var JS_IDENT_RE = '[A-Za-z$_](?:\-[0-9A-Za-z$_]|[0-9A-Za-z$_])*';

begin: /#\{/, end: /}/,
keywords: KEYWORDS
keywords: KEYWORDS$1
};

@@ -41,3 +210,3 @@ var SUBST_SIMPLE = {

begin: /#[A-Za-z$_]/, end: /(?:\-[0-9A-Za-z$_]|[0-9A-Za-z$_])*/,
keywords: KEYWORDS
keywords: KEYWORDS$1
};

@@ -110,3 +279,3 @@ var EXPRESSIONS = [

begin: /\(/, end: /\)/,
keywords: KEYWORDS,
keywords: KEYWORDS$1,
contains: ['self'].concat(EXPRESSIONS)

@@ -124,3 +293,3 @@ }

aliases: ['ls'],
keywords: KEYWORDS,
keywords: KEYWORDS$1,
illegal: /\/\*/,

@@ -127,0 +296,0 @@ contains: EXPRESSIONS.concat([

@@ -13,3 +13,2 @@ /*

name: 'LLVM IR',
//lexemes: '[.%]?' + hljs.IDENT_RE,
keywords:

@@ -16,0 +15,0 @@ 'begin end true false declare define global ' +

@@ -29,4 +29,4 @@ /*

name: 'Lua',
lexemes: hljs.UNDERSCORE_IDENT_RE,
keywords: {
$pattern: hljs.UNDERSCORE_IDENT_RE,
literal: "true false nil",

@@ -33,0 +33,0 @@ keyword: "and break do else elseif end for goto if in local not or repeat return then until while",

@@ -55,4 +55,6 @@ /*

begin: /^\.PHONY:/, end: /$/,
keywords: {'meta-keyword': '.PHONY'},
lexemes: /[\.\w]+/
keywords: {
$pattern: /[\.\w]+/,
'meta-keyword': '.PHONY'
}
};

@@ -68,6 +70,7 @@ /* Targets */

aliases: ['mk', 'mak'],
keywords:
'define endef undefine ifdef ifndef ifeq ifneq else endif ' +
'include -include sinclude override export unexport private vpath',
lexemes: /[\w-]+/,
keywords: {
$pattern: /[\w-]+/,
keyword: 'define endef undefine ifdef ifndef ifeq ifneq else endif ' +
'include -include sinclude override export unexport private vpath'
},
contains: [

@@ -74,0 +77,0 @@ hljs.HASH_COMMENT_MODE,

@@ -369,4 +369,4 @@ /*

name: 'Maxima',
lexemes: '[A-Za-z_%][0-9A-Za-z_%]*',
keywords: {
$pattern: '[A-Za-z_%][0-9A-Za-z_%]*',
keyword: KEYWORDS,

@@ -373,0 +373,0 @@ literal: LITERALS,

@@ -15,4 +15,4 @@ /*

aliases: ['mips'],
lexemes: '\\.?' + hljs.IDENT_RE,
keywords: {
$pattern: '\\.?' + hljs.IDENT_RE,
meta:

@@ -19,0 +19,0 @@ //GNU preprocs

@@ -20,4 +20,4 @@ /*

endsWithParent: true,
lexemes: '[a-z/_]+',
keywords: {
$pattern: '[a-z/_]+',
literal:

@@ -24,0 +24,0 @@ 'on off yes no true false none blocked debug info notice warn error crit ' +

@@ -14,3 +14,5 @@ /*

};
var IDENTIFIER_RE = /[a-zA-Z@][a-zA-Z0-9_]*/;
var OBJC_KEYWORDS = {
$pattern: IDENTIFIER_RE,
keyword:

@@ -44,4 +46,6 @@ 'int float while char export sizeof typedef const struct for union ' +

};
var LEXEMES = /[a-zA-Z@][a-zA-Z0-9_]*/;
var CLASS_KEYWORDS = '@interface @class @protocol @implementation';
var CLASS_KEYWORDS = {
$pattern: IDENTIFIER_RE,
keyword: '@interface @class @protocol @implementation'
};
return {

@@ -51,3 +55,2 @@ name: 'Objective-C',

keywords: OBJC_KEYWORDS,
lexemes: LEXEMES,
illegal: '</',

@@ -95,4 +98,4 @@ contains: [

className: 'class',
begin: '(' + CLASS_KEYWORDS.split(' ').join('|') + ')\\b', end: '({|$)', excludeEnd: true,
keywords: CLASS_KEYWORDS, lexemes: LEXEMES,
begin: '(' + CLASS_KEYWORDS.keyword.split(' ').join('|') + ')\\b', end: '({|$)', excludeEnd: true,
keywords: CLASS_KEYWORDS,
contains: [

@@ -99,0 +102,0 @@ hljs.UNDERSCORE_TITLE_MODE

@@ -16,2 +16,3 @@ /*

keywords: {
$pattern: '[a-z_]\\w*!?',
keyword:

@@ -34,3 +35,2 @@ 'and as assert asr begin class constraint do done downto else end ' +

illegal: /\/\/|>>/,
lexemes: '[a-z_]\\w*!?',
contains: [

@@ -37,0 +37,0 @@ {

@@ -9,3 +9,5 @@ /*

function oxygene(hljs) {
var OXYGENE_KEYWORDS = 'abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue '+
var OXYGENE_KEYWORDS = {
$pattern: /\.?\w+/,
keyword: 'abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue '+
'create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false '+

@@ -17,4 +19,5 @@ 'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited '+

'type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal '+
'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained';
var CURLY_COMMENT = hljs.COMMENT(
'register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained'
};
var CURLY_COMMENT = hljs.COMMENT(
'{',

@@ -59,3 +62,2 @@ '}',

case_insensitive: true,
lexemes: /\.?\w+/,
keywords: OXYGENE_KEYWORDS,

@@ -62,0 +64,0 @@ illegal: '("|\\$[G-Zg-z]|\\/\\*|</|=>|->)',

@@ -9,3 +9,5 @@ /*

function perl(hljs) {
var PERL_KEYWORDS = 'getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ' +
var PERL_KEYWORDS = {
$pattern: /[\w.]+/,
keyword: 'getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ' +
'ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime ' +

@@ -28,3 +30,4 @@ 'readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qq ' +

'ioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe ' +
'atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when';
'atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when'
};
var SUBST = {

@@ -162,3 +165,2 @@ className: 'subst',

aliases: ['pl', 'pm'],
lexemes: /[\w\.]+/,
keywords: PERL_KEYWORDS,

@@ -165,0 +167,0 @@ contains: PERL_DEFAULT_CONTAINS

@@ -22,4 +22,4 @@ /*

aliases: ['pf.conf'],
lexemes: /[a-z0-9_<>-]+/,
keywords: {
$pattern: /[a-z0-9_<>-]+/,
built_in: /* block match pass are "actions" in pf.conf(5), the rest are

@@ -26,0 +26,0 @@ * lexically similar top-level commands.

@@ -464,5 +464,5 @@ /*

},
{
hljs.END_SAME_AS_BEGIN({
begin: DOLLAR_STRING,
endSameAsBegin: true,
end: DOLLAR_STRING,
contains: [

@@ -476,3 +476,3 @@ {

]
},
}),
// identifiers in quotes

@@ -479,0 +479,0 @@ {

@@ -87,4 +87,3 @@ /*

endsWithParent: true,
keywords: '__halt_compiler',
lexemes: hljs.UNDERSCORE_IDENT_RE
keywords: '__halt_compiler'
}

@@ -91,0 +90,0 @@ ),

@@ -9,3 +9,3 @@ /*

function powershell(hljs){
function powershell(hljs) {

@@ -40,2 +40,3 @@ var TYPES =

var KEYWORDS = {
$pattern: /-?[A-z\.\-]+\b/,
keyword: 'if else foreach return do while until elseif begin for trap data dynamicparam ' +

@@ -232,3 +233,2 @@ 'end break throw param continue finally in switch exit filter try process catch ' +

aliases: ["ps", "ps1"],
lexemes: /-?[A-z\.\-]+\b/,
case_insensitive: true,

@@ -235,0 +235,0 @@ keywords: KEYWORDS,

@@ -22,2 +22,3 @@ /*

hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{

@@ -24,0 +25,0 @@ className: 'class',

@@ -10,2 +10,3 @@ /*

var Q_KEYWORDS = {
$pattern: /(`?)[A-Za-z0-9_]+\b/,
keyword:

@@ -24,3 +25,2 @@ 'do while select delete by update from',

keywords: Q_KEYWORDS,
lexemes: /(`?)[A-Za-z0-9_]+\b/,
contains: [

@@ -27,0 +27,0 @@ hljs.C_LINE_COMMENT_MODE,

@@ -18,4 +18,4 @@ /*

begin: IDENT_RE,
lexemes: IDENT_RE,
keywords: {
$pattern: IDENT_RE,
keyword:

@@ -22,0 +22,0 @@ 'function if in break next repeat else for return switch while try tryCatch ' +

@@ -59,4 +59,4 @@ /*

case_insensitive: true,
lexemes: /:?[\w-]+/,
keywords: {
$pattern: /:?[\w-]+/,
literal: LITERALS,

@@ -63,0 +63,0 @@ keyword: STATEMENTS + ' :' + STATEMENTS.split(' ').join(' :') + ' :' + GLOBAL_COMMANDS.split(' ').join(' :'),

@@ -75,6 +75,6 @@ /*

{ begin: /<<[-~]?'?/ },
{ begin: /\w+/,
endSameAsBegin: true,
hljs.END_SAME_AS_BEGIN({
begin: /(\w+)/, end: /(\w+)/,
contains: [hljs.BACKSLASH_ESCAPE, SUBST],
}
})
]

@@ -81,0 +81,0 @@ }

@@ -40,2 +40,3 @@ /*

keywords: {
$pattern: hljs.IDENT_RE + '!?',
keyword:

@@ -48,3 +49,2 @@ KEYWORDS,

},
lexemes: hljs.IDENT_RE + '!?',
illegal: '</',

@@ -51,0 +51,0 @@ contains: [

@@ -16,3 +16,4 @@ /*

var SCHEME_COMPLEX_NUMBER_RE = SCHEME_SIMPLE_NUMBER_RE + '[+\\-]' + SCHEME_SIMPLE_NUMBER_RE + 'i';
var BUILTINS = {
var KEYWORDS = {
$pattern: SCHEME_IDENT_RE,
'builtin-name':

@@ -54,8 +55,2 @@ 'case-lambda call/cc class define-class exit-handler field import ' +

var SHEBANG = {
className: 'meta',
begin: '^#!',
end: '$'
};
var LITERAL = {

@@ -121,4 +116,3 @@ className: 'literal',

begin: SCHEME_IDENT_RE,
lexemes: SCHEME_IDENT_RE,
keywords: BUILTINS
keywords: KEYWORDS
};

@@ -150,3 +144,3 @@

illegal: /\S/,
contains: [SHEBANG, NUMBER, STRING, QUOTED_IDENT, QUOTED_LIST, LIST].concat(COMMENT_MODES)
contains: [hljs.SHEBANG(), NUMBER, STRING, QUOTED_IDENT, QUOTED_LIST, LIST].concat(COMMENT_MODES)
};

@@ -153,0 +147,0 @@ }

@@ -24,4 +24,4 @@ /*

aliases: ['sci'],
lexemes: /%?\w+/,
keywords: {
$pattern: /%?\w+/,
keyword: 'abort break case clear catch continue do elseif else endfunction end for function '+

@@ -28,0 +28,0 @@ 'global if pause return resume select try then while',

@@ -14,2 +14,3 @@ /*

keywords: {
$pattern: '[a-z_]\\w*!?',
keyword:

@@ -28,3 +29,2 @@ /* according to Definition of Standard ML 97 */

illegal: /\/\/|>>/,
lexemes: '[a-z_]\\w*!?',
contains: [

@@ -31,0 +31,0 @@ {

@@ -23,4 +23,4 @@ /*

end: /;/, endsWithParent: true,
lexemes: /[\w\.]+/,
keywords: {
$pattern: /[\w\.]+/,
keyword:

@@ -27,0 +27,0 @@ 'as abort abs absolute acc acce accep accept access accessed accessible account acos action activate add ' +

@@ -157,7 +157,7 @@ /*

keywords: {
'title': BLOCKS.join(' '),
'keyword': STATEMENTS.concat(VAR_TYPES).concat(SPECIAL_FUNCTIONS).join(' '),
'built_in': FUNCTIONS.join(' ')
$pattern: hljs.IDENT_RE,
title: BLOCKS.join(' '),
keyword: STATEMENTS.concat(VAR_TYPES).concat(SPECIAL_FUNCTIONS).join(' '),
built_in: FUNCTIONS.join(' ')
},
lexemes: hljs.IDENT_RE,
contains: [

@@ -164,0 +164,0 @@ hljs.C_LINE_COMMENT_MODE,

@@ -11,2 +11,3 @@ /*

var STEP21_KEYWORDS = {
$pattern: STEP21_IDENT_RE,
keyword: 'HEADER ENDSEC DATA'

@@ -29,3 +30,2 @@ };

case_insensitive: true, // STEP 21 is case insensitive in theory, in practice all non-comments are capitalized.
lexemes: STEP21_IDENT_RE,
keywords: STEP21_KEYWORDS,

@@ -32,0 +32,0 @@ contains: [

@@ -132,3 +132,3 @@ /*

'@nonobjc|@NSApplicationMain|@UIApplicationMain|@dynamicMemberLookup|' +
'@propertyWrapper)'
'@propertyWrapper)\\b'

@@ -135,0 +135,0 @@ },

@@ -0,1 +1,139 @@

const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
const KEYWORDS = [
"as", // for exports
"in",
"of",
"if",
"for",
"while",
"finally",
"var",
"new",
"function",
"do",
"return",
"void",
"else",
"break",
"catch",
"instanceof",
"with",
"throw",
"case",
"default",
"try",
"switch",
"continue",
"typeof",
"delete",
"let",
"yield",
"const",
"class",
// JS handles these with a special rule
// "get",
// "set",
"debugger",
"async",
"await",
"static",
"import",
"from",
"export",
"extends"
];
const LITERALS = [
"true",
"false",
"null",
"undefined",
"NaN",
"Infinity"
];
const TYPES = [
"Intl",
"DataView",
"Number",
"Math",
"Date",
"String",
"RegExp",
"Object",
"Function",
"Boolean",
"Error",
"Symbol",
"Set",
"Map",
"WeakSet",
"WeakMap",
"Proxy",
"Reflect",
"JSON",
"Promise",
"Float64Array",
"Int16Array",
"Int32Array",
"Int8Array",
"Uint16Array",
"Uint32Array",
"Float32Array",
"Array",
"Uint8Array",
"Uint8ClampedArray",
"ArrayBuffer"
];
const ERROR_TYPES = [
"EvalError",
"InternalError",
"RangeError",
"ReferenceError",
"SyntaxError",
"TypeError",
"URIError"
];
const BUILT_IN_GLOBALS = [
"setInterval",
"setTimeout",
"clearInterval",
"clearTimeout",
"require",
"exports",
"eval",
"isFinite",
"isNaN",
"parseFloat",
"parseInt",
"decodeURI",
"decodeURIComponent",
"encodeURI",
"encodeURIComponent",
"escape",
"unescape"
];
const BUILT_IN_VARIABLES = [
"arguments",
"this",
"super",
"console",
"window",
"document",
"localStorage",
"module",
"global" // Node.js
];
const BUILT_INS = [].concat(
BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,
ERROR_TYPES
);
/*

@@ -11,53 +149,36 @@ Language: TypeScript

function typescript(hljs) {
var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
var KEYWORDS = {
keyword:
'in if for while finally var new function do return void else break catch ' +
'instanceof with throw case default try this switch continue typeof delete ' +
'let yield const class public private protected get set super ' +
'static implements enum export import declare type namespace abstract ' +
'as from extends async await',
literal:
'true false null undefined NaN Infinity',
built_in:
'eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent ' +
'encodeURI encodeURIComponent escape unescape Object Function Boolean Error ' +
'EvalError InternalError RangeError ReferenceError StopIteration SyntaxError ' +
'TypeError URIError Number Math Date String RegExp Array Float32Array ' +
'Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array ' +
'Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require ' +
'module console window document any number boolean string void Promise'
var IDENT_RE$1 = IDENT_RE;
var TYPES = [
"any",
"void",
"number",
"boolean",
"string",
"object",
"never",
"enum"
];
var TS_SPECIFIC_KEYWORDS = [
"type",
"namespace",
"typedef",
"interface",
"public",
"private",
"protected",
"implements",
"declare",
"abstract",
"readonly"
];
var KEYWORDS$1 = {
$pattern: IDENT_RE,
keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS).join(" "),
literal: LITERALS.join(" "),
built_in: BUILT_INS.concat(TYPES).join(" ")
};
var DECORATOR = {
className: 'meta',
begin: '@' + JS_IDENT_RE,
begin: '@' + IDENT_RE$1,
};
var ARGS =
{
begin: '\\(',
end: /\)/,
keywords: KEYWORDS,
contains: [
'self',
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
hljs.NUMBER_MODE
]
};
var PARAMS = {
className: 'params',
begin: /\(/, end: /\)/,
excludeBegin: true,
excludeEnd: true,
keywords: KEYWORDS,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
DECORATOR,
ARGS
]
};
var NUMBER = {

@@ -75,4 +196,4 @@ className: 'number',

begin: '\\$\\{', end: '\\}',
keywords: KEYWORDS,
contains: [] // defined later
keywords: KEYWORDS$1,
contains: [] // defined later
};

@@ -118,10 +239,34 @@ var HTML_TEMPLATE = {

];
var ARGUMENTS =
{
begin: '\\(',
end: /\)/,
keywords: KEYWORDS$1,
contains: [
'self',
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
hljs.NUMBER_MODE
]
};
var PARAMS = {
className: 'params',
begin: /\(/, end: /\)/,
excludeBegin: true,
excludeEnd: true,
keywords: KEYWORDS$1,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
DECORATOR,
ARGUMENTS
]
};
return {
name: 'TypeScript',
aliases: ['ts'],
keywords: KEYWORDS,
keywords: KEYWORDS$1,
contains: [
hljs.SHEBANG(),
{

@@ -148,3 +293,11 @@ className: 'meta',

className: 'function',
begin: '(\\(.*?\\)|' + hljs.IDENT_RE + ')\\s*=>', returnBegin: true,
// we have to count the parens to make sure we actually have the
// correct bounding ( ) before the =>. There could be any number of
// sub-expressions inside also surrounded by parens.
begin: '(\\([^(]*' +
'(\\([^(]*' +
'(\\([^(]*' +
'\\))?' +
'\\))?' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>', returnBegin: true,
end: '\\s*=>',

@@ -156,6 +309,8 @@ contains: [

{
begin: hljs.IDENT_RE
begin: hljs.UNDERSCORE_IDENT_RE
},
{
className: null,
begin: /\(\s*\)/,
skip: true
},

@@ -165,8 +320,4 @@ {

excludeBegin: true, excludeEnd: true,
keywords: KEYWORDS,
contains: [
'self',
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
keywords: KEYWORDS$1,
contains: ARGUMENTS.contains
}

@@ -183,6 +334,6 @@ ]

beginKeywords: 'function', end: /[\{;]/, excludeEnd: true,
keywords: KEYWORDS,
keywords: KEYWORDS$1,
contains: [
'self',
hljs.inherit(hljs.TITLE_MODE, { begin: JS_IDENT_RE }),
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
PARAMS

@@ -219,3 +370,3 @@ ],

DECORATOR,
ARGS
ARGUMENTS
]

@@ -222,0 +373,0 @@ };

@@ -11,2 +11,3 @@ /*

var SV_KEYWORDS = {
$pattern: /[\w\$]+/,
keyword:

@@ -74,3 +75,3 @@ 'accept_on alias always always_comb always_ff always_latch and assert assign ' +

case_insensitive: false,
keywords: SV_KEYWORDS, lexemes: /[\w\$]+/,
keywords: SV_KEYWORDS,
contains: [

@@ -77,0 +78,0 @@ hljs.C_BLOCK_COMMENT_MODE,

@@ -12,4 +12,4 @@ /*

name: 'Vim Script',
lexemes: /[!#@\w]+/,
keywords: {
$pattern: /[!#@\w]+/,
keyword:

@@ -16,0 +16,0 @@ // express version except: ! & * < = > !! # @ @@

@@ -13,4 +13,4 @@ /*

case_insensitive: true,
lexemes: '[.%]?' + hljs.IDENT_RE,
keywords: {
$pattern: '[.%]?' + hljs.IDENT_RE,
keyword:

@@ -17,0 +17,0 @@ 'lock rep repe repz repne repnz xaquire xrelease bnd nobnd ' +

@@ -14,2 +14,3 @@ /*

var XL_KEYWORDS = {
$pattern: /[a-zA-Z][a-zA-Z0-9_?]*/,
keyword:

@@ -67,3 +68,2 @@ 'if then else do while until for loop import with is as where when by data constant ' +

aliases: ['tao'],
lexemes: /[a-zA-Z][a-zA-Z0-9_?]*/,
keywords: XL_KEYWORDS,

@@ -70,0 +70,0 @@ contains: [

@@ -163,5 +163,5 @@ /*

case_insensitive: false,
lexemes: /[a-zA-Z\$][a-zA-Z0-9_:\-]*/,
illegal: /(proc)|(abstract)|(extends)|(until)|(#)/,
keywords: {
$pattern: /[a-zA-Z\$][a-zA-Z0-9_:\-]*/,
keyword: KEYWORDS,

@@ -168,0 +168,0 @@ type: TYPE,

@@ -13,2 +13,5 @@ /*

// YAML spec allows non-reserved URI characters in tags.
var URI_CHARACTERS = '[\\w#;/?:@&=+$,.~*\\\'()[\\]]+';
// Define keys as starting with a word character

@@ -22,4 +25,4 @@ // ...containing word chars, spaces, colons, forward-slashes, hyphens and periods

{ begin: '\\w[\\w :\\/.-]*:(?=[ \t]|$)' },
{ begin: '"\\w[\\w :\\/.-]*":(?=[ \t]|$)' }, //double quoted keys
{ begin: '\'\\w[\\w :\\/.-]*\':(?=[ \t]|$)' } //single quoted keys
{ begin: '"\\w[\\w :\\/.-]*":(?=[ \t]|$)' }, // double quoted keys
{ begin: '\'\\w[\\w :\\/.-]*\':(?=[ \t]|$)' } // single quoted keys
]

@@ -31,4 +34,4 @@ };

variants: [
{ begin: '\{\{', end: '\}\}' }, // jinja templates Ansible
{ begin: '%\{', end: '\}' } // Ruby i18n
{ begin: '{{', end: '}}' }, // jinja templates Ansible
{ begin: '%{', end: '}' } // Ruby i18n
]

@@ -40,5 +43,5 @@ };

variants: [
{begin: /'/, end: /'/},
{begin: /"/, end: /"/},
{begin: /\S+/}
{ begin: /'/, end: /'/ },
{ begin: /"/, end: /"/ },
{ begin: /\S+/ }
],

@@ -51,2 +54,12 @@ contains: [

// Strings inside of value containers (objects) can't contain braces,
// brackets, or commas
var CONTAINER_STRING = hljs.inherit(STRING, {
variants: [
{ begin: /'/, end: /'/ },
{ begin: /"/, end: /"/ },
{ begin: /[^\s,{}[\]]+/ }
]
});
var DATE_RE = '[0-9]{4}(-[0-9][0-9]){0,2}';

@@ -58,5 +71,104 @@ var TIME_RE = '([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?';

className: 'number',
begin: '\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\b',
begin: '\\b' + DATE_RE + TIME_RE + FRACTION_RE + ZONE_RE + '\\b'
};
var VALUE_CONTAINER = {
end: ',',
endsWithParent: true,
excludeEnd: true,
contains: [],
keywords: LITERALS,
relevance: 0
};
var OBJECT = {
begin: '{',
end: '}',
contains: [VALUE_CONTAINER],
illegal: '\\n',
relevance: 0
};
var ARRAY = {
begin: '\\[',
end: '\\]',
contains: [VALUE_CONTAINER],
illegal: '\\n',
relevance: 0
};
var MODES = [
KEY,
{
className: 'meta',
begin: '^---\s*$',
relevance: 10
},
{ // multi line string
// Blocks start with a | or > followed by a newline
//
// Indentation of subsequent lines must be the same to
// be considered part of the block
className: 'string',
begin: '[\\|>]([0-9]?[+-])?[ ]*\\n( *)[\\S ]+\\n(\\2[\\S ]+\\n?)*'
},
{ // Ruby/Rails erb
begin: '<%[%=-]?',
end: '[%-]?%>',
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true,
relevance: 0
},
{ // named tags
className: 'type',
begin: '!\\w+!' + URI_CHARACTERS
},
// https://yaml.org/spec/1.2/spec.html#id2784064
{ // verbatim tags
className: 'type',
begin: '!<' + URI_CHARACTERS + ">"
},
{ // primary tags
className: 'type',
begin: '!' + URI_CHARACTERS
},
{ // secondary tags
className: 'type',
begin: '!!' + URI_CHARACTERS
},
{ // fragment id &ref
className: 'meta',
begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$'
},
{ // fragment reference *ref
className: 'meta',
begin: '\\*' + hljs.UNDERSCORE_IDENT_RE + '$'
},
{ // array listing
className: 'bullet',
// TODO: remove |$ hack when we have proper look-ahead support
begin: '\\-(?=[ ]|$)',
relevance: 0
},
hljs.HASH_COMMENT_MODE,
{
beginKeywords: LITERALS,
keywords: { literal: LITERALS }
},
TIMESTAMP,
// numbers are any valid C-style number that
// sit isolated from other words
{
className: 'number',
begin: hljs.C_NUMBER_RE + '\\b'
},
OBJECT,
ARRAY,
STRING
];
var VALUE_MODES = [...MODES];
VALUE_MODES.pop();
VALUE_MODES.push(CONTAINER_STRING);
VALUE_CONTAINER.contains = VALUE_MODES;
return {

@@ -66,60 +178,3 @@ name: 'YAML',

aliases: ['yml', 'YAML'],
contains: [
KEY,
{
className: 'meta',
begin: '^---\s*$',
relevance: 10
},
{ // multi line string
// Blocks start with a | or > followed by a newline
//
// Indentation of subsequent lines must be the same to
// be considered part of the block
className: 'string',
begin: '[\\|>]([0-9]?[+-])?[ ]*\\n( *)[\\S ]+\\n(\\2[\\S ]+\\n?)*',
},
{ // Ruby/Rails erb
begin: '<%[%=-]?', end: '[%-]?%>',
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true,
relevance: 0
},
{ // local tags
className: 'type',
begin: '!' + hljs.UNDERSCORE_IDENT_RE,
},
{ // data type
className: 'type',
begin: '!!' + hljs.UNDERSCORE_IDENT_RE,
},
{ // fragment id &ref
className: 'meta',
begin: '&' + hljs.UNDERSCORE_IDENT_RE + '$',
},
{ // fragment reference *ref
className: 'meta',
begin: '\\*' + hljs.UNDERSCORE_IDENT_RE + '$'
},
{ // array listing
className: 'bullet',
// TODO: remove |$ hack when we have proper look-ahead support
begin: '\\-(?=[ ]|$)',
relevance: 0
},
hljs.HASH_COMMENT_MODE,
{
beginKeywords: LITERALS,
keywords: {literal: LITERALS}
},
TIMESTAMP,
// numbers are any valid C-style number that
// sit isolated from other words
{
className: 'number',
begin: hljs.C_NUMBER_RE + '\\b'
},
STRING
]
contains: MODES
};

@@ -126,0 +181,0 @@ }

@@ -9,3 +9,3 @@ {

"homepage": "https://highlightjs.org/",
"version": "10.0.3",
"version": "10.1.0",
"author": {

@@ -1119,2 +1119,10 @@ "name": "Ivan Sagalaev",

"email": "a.grison@gmail.com"
},
{
"name": "Jim Mason",
"email": "jmason@ibinx.com"
},
{
"name": "lioshi",
"email": "lioshi@lioshi.com"
}

@@ -1131,5 +1139,13 @@ ],

"main": "./lib/index.js",
"types": "./types/index.d.ts",
"scripts": {
"mocha": "mocha",
"lint": "eslint -c .eslintrc.js src/*.js src/lib/*.js",
"build_and_test": "npm run build && npm run test",
"build": "node ./tools/build.js -t node",
"build-cdn": "node ./tools/build.js -t cdn",
"build-browser": "node ./tools/build.js -t browser :common",
"test": "mocha --globals document test",
"test-markup": "mocha --globals document test/markup",
"test-detect": "mocha --globals document test/detect",
"test-browser": "mocha --globals document test/browser"

@@ -1141,15 +1157,23 @@ },

"devDependencies": {
"clean-css": "^4.2.1",
"@typescript-eslint/eslint-plugin": "^3.2.0",
"@typescript-eslint/parser": "^3.2.0",
"clean-css": "^4.2.3",
"cli-table": "^0.3.1",
"colors": "^1.1.2",
"commander": "^5.0.0",
"commander": "^5.1.0",
"del": "^5.1.0",
"dependency-resolver": "^2.0.1",
"glob": "^7.1.4",
"eslint": "^7.2.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"glob": "^7.1.6",
"glob-promise": "^3.4.0",
"handlebars": "^4.5.3",
"js-beautify": "^1.10.2",
"handlebars": "^4.7.6",
"js-beautify": "^1.11.0",
"jsdom": "^16.2.2",
"lodash": "^4.17.15",
"mocha": "^7.1.2",
"mocha": "^8.0.1",
"rollup": "^2.0.0",

@@ -1160,5 +1184,6 @@ "rollup-plugin-commonjs": "^10.1.0",

"terser": "^4.3.9",
"tiny-worker": "^2.3.0"
"tiny-worker": "^2.3.0",
"typescript": "^4.0.0-dev.20200512"
},
"dependencies": {}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc