Socket
Socket
Sign inDemoInstall

highlight.js

Package Overview
Dependencies
0
Maintainers
6
Versions
100
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 11.0.0-alpha1 to 11.0.0-beta0

16

es/languages/accesslog.js

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

@@ -30,3 +30,3 @@ /**

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -373,3 +373,9 @@

},
// allow for multiple declarations, e.g.:
// extern void f(int), g(char);
{
relevance: 0,
match: /,/
},
{
className: 'params',

@@ -376,0 +382,0 @@ begin: /\(/,

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

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -290,3 +290,9 @@

},
// allow for multiple declarations, e.g.:
// extern void f(int), g(char);
{
relevance: 0,
match: /,/
},
{
className: 'params',

@@ -293,0 +299,0 @@ begin: /\(/,

13

es/languages/coffeescript.js

@@ -122,17 +122,4 @@ const KEYWORDS = [

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,

@@ -139,0 +126,0 @@ ERROR_TYPES

@@ -30,3 +30,3 @@ /**

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -373,3 +373,9 @@

},
// allow for multiple declarations, e.g.:
// extern void f(int), g(char);
{
relevance: 0,
match: /,/
},
{
className: 'params',

@@ -376,0 +382,0 @@ begin: /\(/,

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -26,3 +37,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

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

@@ -79,3 +79,3 @@ /*

const DTS_REFERENCE = {
const REFERENCE = {
className: 'variable',

@@ -85,8 +85,8 @@ begin: /&[a-z\d_]*\b/

const DTS_KEYWORD = {
className: 'meta-keyword',
const KEYWORD = {
className: 'meta',
begin: '/[a-z][a-z\\d-]*/'
};
const DTS_LABEL = {
const LABEL = {
className: 'symbol',

@@ -96,4 +96,5 @@ begin: '^\\s*[a-zA-Z_][a-zA-Z\\d_]*:'

const DTS_CELL_PROPERTY = {
const CELL_PROPERTY = {
className: 'params',
relevance: 0,
begin: '<',

@@ -103,42 +104,55 @@ end: '>',

NUMBERS,
DTS_REFERENCE
REFERENCE
]
};
const DTS_NODE = {
className: 'class',
begin: /[a-zA-Z_][a-zA-Z\d_@]*\s\{/,
end: /[{;=]/,
returnBegin: true,
excludeEnd: true
const NODE = {
className: 'title.class',
begin: /[a-zA-Z_][a-zA-Z\d_@-]*(?=\s\{)/
};
const DTS_ROOT_NODE = {
className: 'class',
begin: '/\\s*\\{',
end: /\};/,
relevance: 10,
contains: [
DTS_REFERENCE,
DTS_KEYWORD,
DTS_LABEL,
DTS_NODE,
DTS_CELL_PROPERTY,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
NUMBERS,
STRINGS
]
const ROOT_NODE = {
className: 'title.class',
begin: /^\/(?=\s*\{)/,
relevance: 10
};
// TODO: `attribute` might be the right scope here, unsure
// I'm not sure if all these key names have semantic meaning or not
const ATTR_NO_VALUE = {
match: /[a-z][a-z-,]+(?=;)/,
relevance: 0,
scope: "attr"
};
const ATTR = {
relevance: 0,
match: [
/[a-z][a-z-,]+/,
/\s*/,
/=/
],
scope: {
1: "attr",
3: "operator"
}
};
const PUNC = {
scope: "punctuation",
relevance: 0,
// `};` combined is just to avoid tons of useless punctuation nodes
match: /\};|[;{}]/
};
return {
name: 'Device Tree',
keywords: "",
contains: [
DTS_ROOT_NODE,
DTS_REFERENCE,
DTS_KEYWORD,
DTS_LABEL,
DTS_NODE,
DTS_CELL_PROPERTY,
ROOT_NODE,
REFERENCE,
KEYWORD,
LABEL,
NODE,
ATTR,
ATTR_NO_VALUE,
CELL_PROPERTY,
hljs.C_LINE_COMMENT_MODE,

@@ -149,2 +163,3 @@ hljs.C_BLOCK_COMMENT_MODE,

PREPROCESSOR,
PUNC,
{

@@ -151,0 +166,0 @@ begin: hljs.IDENT_RE + '::',

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

function anyNumberOfTimes(re) {
return concat('(', re, ')*');
return concat('(?:', re, ')*');
}

@@ -25,0 +25,0 @@

@@ -23,13 +23,11 @@ /*

'^\\s*(!=#|=#|-#|/).*$',
false,
{
relevance: 0
}
null,
{ relevance: 0 }
),
{
begin: '^\\s*(-|=|!=)(?!#)',
starts: {
end: '\\n',
subLanguage: 'ruby'
}
end: /$/,
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true
},

@@ -109,6 +107,6 @@ {

begin: /#\{/,
starts: {
end: /\}/,
subLanguage: 'ruby'
}
end: /\}/,
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true
}

@@ -115,0 +113,0 @@ ]

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

function anyNumberOfTimes(re) {
return concat('(', re, ')*');
return concat('(?:', re, ')*');
}

@@ -31,3 +31,3 @@

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -44,2 +44,13 @@

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -53,3 +64,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -56,0 +70,0 @@ }

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -43,3 +54,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -46,0 +60,0 @@ }

@@ -137,3 +137,2 @@ const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';

BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,

@@ -235,3 +234,4 @@ ERROR_TYPES

literal: LITERALS,
built_in: BUILT_INS
built_in: BUILT_INS,
"variable.language": BUILT_IN_VARIABLES
};

@@ -317,9 +317,15 @@

{
className: 'doctag',
begin: '@[A-Za-z]+',
begin: '(?=@[A-Za-z]+)',
relevance: 0,
contains: [
{
className: 'doctag',
begin: '@[A-Za-z]+'
},
{
className: 'type',
begin: '\\{',
end: '\\}',
excludeEnd: true,
excludeBegin: true,
relevance: 0

@@ -392,2 +398,153 @@ },

// ES6 classes
const CLASS_OR_EXTENDS = {
variants: [
{
match: [
/class/,
/\s+/,
IDENT_RE$1
],
scope: {
1: "keyword",
3: "title.class"
}
},
{
match: [
/extends/,
/\s+/,
concat(IDENT_RE$1, "(", concat(/\./, IDENT_RE$1), ")*")
],
scope: {
1: "keyword",
3: "title.class.inherited"
}
}
]
};
const CLASS_REFERENCE = {
relevance: 0,
match: /\b[A-Z][a-z]+([A-Z][a-z]+)*/,
className: "title.class",
keywords: {
_: [
// se we still get relevance credit for JS library classes
...TYPES,
...ERROR_TYPES
]
}
};
const USE_STRICT = {
label: "use_strict",
className: 'meta',
relevance: 10,
begin: /^\s*['"]use (strict|asm)['"]/
};
const FUNCTION_DEFINITION = {
variants: [
{
match: [
/function/,
/\s+/,
IDENT_RE$1,
/(?=\s*\()/
]
},
// anonymous function
{
match: [
/function/,
/\s*(?=\()/
]
}
],
className: {
1: "keyword",
3: "title.function"
},
label: "func.def",
contains: [ PARAMS ],
illegal: /%/
};
const UPPER_CASE_CONSTANT = {
relevance: 0,
match: /\b[A-Z][A-Z_]+\b/,
className: "variable.constant"
};
function noneOf(list) {
return concat("(?!", list.join("|"), ")");
}
const FUNCTION_CALL = {
match: concat(
/\b/,
noneOf([
...BUILT_IN_GLOBALS,
"super"
]),
IDENT_RE$1, lookahead(/\(/)),
className: "title.function",
relevance: 0
};
const PROPERTY_ACCESS = {
begin: concat(/\./, lookahead(
concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)
)),
end: IDENT_RE$1,
excludeBegin: true,
keywords: "prototype",
className: "property",
relevance: 0
};
const GETTER_OR_SETTER = {
match: [
/get|set/,
/\s+/,
IDENT_RE$1,
/(?=\()/
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
{ // eat to avoid empty params
begin: /\(\)/
},
PARAMS
]
};
const FUNC_LEAD_IN_RE = '(\\(' +
'[^()]*(\\(' +
'[^()]*(\\(' +
'[^()]*' +
'\\)[^()]*)*' +
'\\)[^()]*)*' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>';
const FUNCTION_VARIABLE = {
match: [
/const|var|let/, /\s+/,
IDENT_RE$1, /\s*/,
/=\s*/,
lookahead(FUNC_LEAD_IN_RE)
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
PARAMS
]
};
return {

@@ -406,8 +563,3 @@ name: 'Javascript',

}),
{
label: "use_strict",
className: 'meta',
relevance: 10,
begin: /^\s*['"]use (strict|asm)['"]/
},
USE_STRICT,
hljs.APOS_STRING_MODE,

@@ -420,31 +572,13 @@ hljs.QUOTE_STRING_MODE,

NUMBER,
{ // object attr container
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
/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,
IDENT_RE$1 + '\\s*:'))),
relevance: 0,
contains: [
{
className: 'attr',
begin: IDENT_RE$1 + lookahead('\\s*:'),
relevance: 0
}
]
CLASS_REFERENCE,
{
className: 'attr',
begin: IDENT_RE$1 + lookahead(':'),
relevance: 0
},
FUNCTION_VARIABLE,
{ // "value" container
begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
keywords: 'return throw case',
relevance: 0,
contains: [

@@ -458,9 +592,3 @@ COMMENT,

// sub-expressions inside also surrounded by parens.
begin: '(\\(' +
'[^()]*(\\(' +
'[^()]*(\\(' +
'[^()]*' +
'\\)[^()]*)*' +
'\\)[^()]*)*' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>',
begin: FUNC_LEAD_IN_RE,
returnBegin: true,

@@ -494,9 +622,8 @@ end: '\\s*=>',

{ // could be a comma delimited list of params to a function call
begin: /,/, relevance: 0
begin: /,/,
relevance: 0
},
{
className: '',
begin: /\s/,
end: /\s*/,
skip: true
match: /\s+/,
relevance: 0
},

@@ -525,18 +652,5 @@ { // JSX

],
relevance: 0
},
FUNCTION_DEFINITION,
{
className: 'function',
beginKeywords: 'function',
end: /[{;]/,
excludeEnd: true,
keywords: KEYWORDS$1,
contains: [
'self',
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
PARAMS
],
illegal: /%/
},
{
// prevent this from getting swallowed up by function

@@ -547,7 +661,6 @@ // since they appear "function like"

{
className: 'function',
// we have to count the parens to make sure we actually have the correct
// bounding ( ). There could be any number of sub-expressions inside
// also surrounded by parens.
begin: hljs.UNDERSCORE_IDENT_RE +
begin: '\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +
'\\(' + // first parens

@@ -561,5 +674,6 @@ '[^()]*(\\(' +

returnBegin:true,
label: "func.def",
contains: [
PARAMS,
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: "title.function" })
]

@@ -569,13 +683,6 @@ },

{
begin: /\.\.\./,
match: /\.\.\./,
relevance: 0
},
{
begin: concat(/\./, lookahead(IDENT_RE$1)),
end: IDENT_RE$1,
excludeBegin: true,
keywords: "prototype",
className: "property",
relevance: 0
},
PROPERTY_ACCESS,
// hack: prevents detection of keywords in some circumstances

@@ -585,41 +692,16 @@ // .keyword()

{
variants: [
{ begin: '\\.' + IDENT_RE$1 },
{ begin: '\\$' + IDENT_RE$1 }
],
match: '\\$' + IDENT_RE$1,
relevance: 0
},
{ // ES6 class
className: 'class',
beginKeywords: 'class',
end: /[{;=]/,
excludeEnd: true,
illegal: /[:"[\]]/,
contains: [
{ beginKeywords: 'extends' },
hljs.UNDERSCORE_TITLE_MODE
]
},
{
begin: /\b(?=constructor)/,
end: /[{;]/,
excludeEnd: true,
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
'self',
PARAMS
]
match: [ /\bconstructor(?=\s*\()/ ],
className: { 1: "title.function" },
contains: [ PARAMS ]
},
FUNCTION_CALL,
UPPER_CASE_CONSTANT,
CLASS_OR_EXTENDS,
GETTER_OR_SETTER,
{
begin: '(get|set)\\s+(?=' + IDENT_RE$1 + '\\()',
end: /\{/,
keywords: "get set",
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
{ begin: /\(\)/ }, // eat to avoid empty params
PARAMS
]
},
{
begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
match: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
}

@@ -626,0 +708,0 @@ ]

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -26,3 +37,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

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

@@ -122,17 +122,4 @@ const KEYWORDS = [

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,

@@ -139,0 +126,0 @@ ERROR_TYPES

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -449,3 +463,3 @@ }

// allow matching common delimiters
{ begin: PAIRED_DOUBLE_RE("s|tr|y", either(...REGEX_DELIMS)) },
{ begin: PAIRED_DOUBLE_RE("s|tr|y", either(...REGEX_DELIMS, { capture: true })) },
// and then paired delmis

@@ -470,3 +484,3 @@ { begin: PAIRED_DOUBLE_RE("s|tr|y", "\\(", "\\)") },

// allow matching common delimiters
{ begin: PAIRED_RE("m|qr", either(...REGEX_DELIMS), /\1/)},
{ begin: PAIRED_RE("m|qr", either(...REGEX_DELIMS, { capture: true }), /\1/)},
// allow common paired delmins

@@ -473,0 +487,0 @@ { begin: PAIRED_RE("m|qr", /\(/, /\)/)},

@@ -0,1 +1,60 @@

/**
* @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;
}
function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**
* 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 opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*

@@ -10,2 +69,405 @@ Language: Processing

function processing(hljs) {
const BUILT_INS = [
"displayHeight",
"displayWidth",
"mouseY",
"mouseX",
"mousePressed",
"pmouseX",
"pmouseY",
"key",
"keyCode",
"pixels",
"focused",
"frameCount",
"frameRate",
"height",
"width",
"size",
"createGraphics",
"beginDraw",
"createShape",
"loadShape",
"PShape",
"arc",
"ellipse",
"line",
"point",
"quad",
"rect",
"triangle",
"bezier",
"bezierDetail",
"bezierPoint",
"bezierTangent",
"curve",
"curveDetail",
"curvePoint",
"curveTangent",
"curveTightness",
"shape",
"shapeMode",
"beginContour",
"beginShape",
"bezierVertex",
"curveVertex",
"endContour",
"endShape",
"quadraticVertex",
"vertex",
"ellipseMode",
"noSmooth",
"rectMode",
"smooth",
"strokeCap",
"strokeJoin",
"strokeWeight",
"mouseClicked",
"mouseDragged",
"mouseMoved",
"mousePressed",
"mouseReleased",
"mouseWheel",
"keyPressed",
"keyPressedkeyReleased",
"keyTyped",
"print",
"println",
"save",
"saveFrame",
"day",
"hour",
"millis",
"minute",
"month",
"second",
"year",
"background",
"clear",
"colorMode",
"fill",
"noFill",
"noStroke",
"stroke",
"alpha",
"blue",
"brightness",
"color",
"green",
"hue",
"lerpColor",
"red",
"saturation",
"modelX",
"modelY",
"modelZ",
"screenX",
"screenY",
"screenZ",
"ambient",
"emissive",
"shininess",
"specular",
"add",
"createImage",
"beginCamera",
"camera",
"endCamera",
"frustum",
"ortho",
"perspective",
"printCamera",
"printProjection",
"cursor",
"frameRate",
"noCursor",
"exit",
"loop",
"noLoop",
"popStyle",
"pushStyle",
"redraw",
"binary",
"boolean",
"byte",
"char",
"float",
"hex",
"int",
"str",
"unbinary",
"unhex",
"join",
"match",
"matchAll",
"nf",
"nfc",
"nfp",
"nfs",
"split",
"splitTokens",
"trim",
"append",
"arrayCopy",
"concat",
"expand",
"reverse",
"shorten",
"sort",
"splice",
"subset",
"box",
"sphere",
"sphereDetail",
"createInput",
"createReader",
"loadBytes",
"loadJSONArray",
"loadJSONObject",
"loadStrings",
"loadTable",
"loadXML",
"open",
"parseXML",
"saveTable",
"selectFolder",
"selectInput",
"beginRaw",
"beginRecord",
"createOutput",
"createWriter",
"endRaw",
"endRecord",
"PrintWritersaveBytes",
"saveJSONArray",
"saveJSONObject",
"saveStream",
"saveStrings",
"saveXML",
"selectOutput",
"popMatrix",
"printMatrix",
"pushMatrix",
"resetMatrix",
"rotate",
"rotateX",
"rotateY",
"rotateZ",
"scale",
"shearX",
"shearY",
"translate",
"ambientLight",
"directionalLight",
"lightFalloff",
"lights",
"lightSpecular",
"noLights",
"normal",
"pointLight",
"spotLight",
"image",
"imageMode",
"loadImage",
"noTint",
"requestImage",
"tint",
"texture",
"textureMode",
"textureWrap",
"blend",
"copy",
"filter",
"get",
"loadPixels",
"set",
"updatePixels",
"blendMode",
"loadShader",
"PShaderresetShader",
"shader",
"createFont",
"loadFont",
"text",
"textFont",
"textAlign",
"textLeading",
"textMode",
"textSize",
"textWidth",
"textAscent",
"textDescent",
"abs",
"ceil",
"constrain",
"dist",
"exp",
"floor",
"lerp",
"log",
"mag",
"map",
"max",
"min",
"norm",
"pow",
"round",
"sq",
"sqrt",
"acos",
"asin",
"atan",
"atan2",
"cos",
"degrees",
"radians",
"sin",
"tan",
"noise",
"noiseDetail",
"noiseSeed",
"random",
"randomGaussian",
"randomSeed"
];
const IDENT = hljs.IDENT_RE;
const FUNC_NAME = {
variants: [
{
match: concat(either(...BUILT_INS), lookahead(/\s*\(/)),
className: "built_in"
},
{
relevance: 0,
match: concat(
/\b(?!for|if|while)/,
IDENT, lookahead(/\s*\(/)),
className: "title.function"
}
]
};
const NEW_CLASS = {
match: [
/new\s+/,
IDENT
],
className: {
1: "keyword",
2: "class.title"
}
};
const PROPERTY = {
relevance: 0,
match: [
/\./,
IDENT
],
className: {
2: "property"
}
};
const CLASS = {
variants: [
{
match: [
/class/,
/\s+/,
IDENT,
/\s+/,
/extends/,
/\s+/,
IDENT
]
},
{
match: [
/class/,
/\s+/,
IDENT
]
}
],
className: {
1: "keyword",
3: "title.class",
5: "keyword",
7: "title.class.inherited"
}
};
const TYPES = [
"boolean",
"byte",
"char",
"color",
"double",
"float",
"int",
"long",
"short",
];
const CLASSES = [
"BufferedReader",
"PVector",
"PFont",
"PImage",
"PGraphics",
"HashMap",
"String",
"Array",
"FloatDict",
"ArrayList",
"FloatList",
"IntDict",
"IntList",
"JSONArray",
"JSONObject",
"Object",
"StringDict",
"StringList",
"Table",
"TableRow",
"XML"
];
const JAVA_KEYWORDS = [
"abstract",
"assert",
"break",
"case",
"catch",
"const",
"continue",
"default",
"else",
"enum",
"final",
"finally",
"for",
"if",
"import",
"instanceof",
"long",
"native",
"new",
"package",
"private",
"private",
"protected",
"protected",
"public",
"public",
"return",
"static",
"strictfp",
"switch",
"synchronized",
"throw",
"throws",
"transient",
"try",
"void",
"volatile",
"while"
];
return {

@@ -15,38 +477,19 @@ name: 'Processing',

keywords: {
keyword: 'BufferedReader PVector PFont PImage PGraphics HashMap boolean byte char color ' +
'double float int long String Array FloatDict FloatList IntDict IntList JSONArray JSONObject ' +
'Object StringDict StringList Table TableRow XML ' +
// Java keywords
'false synchronized int abstract float private char boolean static null if const ' +
'for true while long throw strictfp finally protected import native final return void ' +
'enum else break transient new catch instanceof byte super volatile case assert short ' +
'package default double public try this switch continue throws protected public private',
literal: 'P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI',
keyword: [
...JAVA_KEYWORDS
],
literal: 'P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI null true false',
title: 'setup draw',
built_in: 'displayHeight displayWidth mouseY mouseX mousePressed pmouseX pmouseY key ' +
'keyCode pixels focused frameCount frameRate height width ' +
'size createGraphics beginDraw createShape loadShape PShape arc ellipse line point ' +
'quad rect triangle bezier bezierDetail bezierPoint bezierTangent curve curveDetail curvePoint ' +
'curveTangent curveTightness shape shapeMode beginContour beginShape bezierVertex curveVertex ' +
'endContour endShape quadraticVertex vertex ellipseMode noSmooth rectMode smooth strokeCap ' +
'strokeJoin strokeWeight mouseClicked mouseDragged mouseMoved mousePressed mouseReleased ' +
'mouseWheel keyPressed keyPressedkeyReleased keyTyped print println save saveFrame day hour ' +
'millis minute month second year background clear colorMode fill noFill noStroke stroke alpha ' +
'blue brightness color green hue lerpColor red saturation modelX modelY modelZ screenX screenY ' +
'screenZ ambient emissive shininess specular add createImage beginCamera camera endCamera frustum ' +
'ortho perspective printCamera printProjection cursor frameRate noCursor exit loop noLoop popStyle ' +
'pushStyle redraw binary boolean byte char float hex int str unbinary unhex join match matchAll nf ' +
'nfc nfp nfs split splitTokens trim append arrayCopy concat expand reverse shorten sort splice subset ' +
'box sphere sphereDetail createInput createReader loadBytes loadJSONArray loadJSONObject loadStrings ' +
'loadTable loadXML open parseXML saveTable selectFolder selectInput beginRaw beginRecord createOutput ' +
'createWriter endRaw endRecord PrintWritersaveBytes saveJSONArray saveJSONObject saveStream saveStrings ' +
'saveXML selectOutput popMatrix printMatrix pushMatrix resetMatrix rotate rotateX rotateY rotateZ scale ' +
'shearX shearY translate ambientLight directionalLight lightFalloff lights lightSpecular noLights normal ' +
'pointLight spotLight image imageMode loadImage noTint requestImage tint texture textureMode textureWrap ' +
'blend copy filter get loadPixels set updatePixels blendMode loadShader PShaderresetShader shader createFont ' +
'loadFont text textFont textAlign textLeading textMode textSize textWidth textAscent textDescent abs ceil ' +
'constrain dist exp floor lerp log mag map max min norm pow round sq sqrt acos asin atan atan2 cos degrees ' +
'radians sin tan noise noiseDetail noiseSeed random randomGaussian randomSeed'
variable: "super this",
built_in: [
...BUILT_INS,
...CLASSES
],
type: TYPES
},
contains: [
CLASS,
NEW_CLASS,
FUNC_NAME,
PROPERTY,
hljs.C_LINE_COMMENT_MODE,

@@ -53,0 +496,0 @@ hljs.C_BLOCK_COMMENT_MODE,

@@ -230,3 +230,3 @@ /**

{
begin: /r(#*)"(.|\n)*?"\1(?!#)/
begin: /b?r(#*)"(.|\n)*?"\1(?!#)/
},

@@ -233,0 +233,0 @@ {

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -26,3 +37,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

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

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

@@ -471,2 +471,31 @@ /*

const BLOCK_COMMENT = hljs.COMMENT(
/\/\*/,
/\*\//,
{
relevance: 0,
contains: [
{
className: 'doctag',
match: /@(return|param)/
}
]
}
);
const INCLUDE = {
className: 'meta',
begin: /^#include\b/,
end: /$/,
relevance: 0, // relevance comes from keywords
keywords: "include",
contains: [
{
match: /[a-z][a-z-.]+/,
className: "string"
},
hljs.C_LINE_COMMENT_MODE
]
};
return {

@@ -483,26 +512,5 @@ name: 'Stan',

hljs.C_LINE_COMMENT_MODE,
hljs.COMMENT(
/#/,
/$/,
{
relevance: 0,
keywords: {
'meta-keyword': 'include'
}
}
),
hljs.COMMENT(
/\/\*/,
/\*\//,
{
relevance: 0,
// highlight doc strings mentioned in Stan reference
contains: [
{
className: 'doctag',
begin: /@(return|param)/
}
]
}
),
INCLUDE,
hljs.HASH_COMMENT_MODE,
BLOCK_COMMENT,
{

@@ -521,4 +529,3 @@ // hack: in range constraints, lower must follow "<"

className: 'keyword',
begin: /\btarget\s*\+=/,
relevance: 10
begin: /\btarget\s*\+=/
},

@@ -525,0 +532,0 @@ {

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -43,3 +54,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -77,2 +91,3 @@ }

// avoid conflicts with other rules
'actor',
'associatedtype',

@@ -396,6 +411,9 @@ 'async',

const DOT_KEYWORD = {
className: 'keyword',
begin: concat(/\./, lookahead(either(...dotKeywords, ...optionalDotKeywords))),
end: either(...dotKeywords, ...optionalDotKeywords),
excludeBegin: true
match: [
/\./,
either(...dotKeywords, ...optionalDotKeywords)
],
className: {
2: "keyword"
}
};

@@ -680,20 +698,2 @@ const KEYWORD_GUARD = {

// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID362
// Matches both the keyword func and the function title.
// Grouping these lets us differentiate between the operator function <
// and the start of the generic parameter clause (also <).
const FUNC_PLUS_TITLE = {
beginKeywords: 'func',
contains: [
{
className: 'title',
match: either(QUOTED_IDENTIFIER.match, identifier, operator),
// Required to make sure the opening < of the generic parameter clause
// isn't parsed as a second title.
endsParent: true,
relevance: 0
},
WHITESPACE
]
};
const GENERIC_PARAMETERS = {

@@ -743,7 +743,14 @@ begin: /</,

};
// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID362
const FUNCTION = {
className: 'function',
match: lookahead(/\bfunc\b/),
match: [
/func/,
/\s+/,
either(QUOTED_IDENTIFIER.match, identifier, operator)
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
FUNC_PLUS_TITLE,
GENERIC_PARAMETERS,

@@ -762,7 +769,8 @@ FUNCTION_PARAMETERS,

const INIT_SUBSCRIPT = {
className: 'function',
match: /\b(subscript|init[?!]?)\s*(?=[<(])/,
keywords: {
keyword: "subscript init init? init!",
$pattern: /\w+[?!]?/
match: [
/\b(?:subscript|init[?!]?)/,
/\s*(?=[<(])/,
],
className: {
1: "keyword"
},

@@ -778,12 +786,11 @@ contains: [

const OPERATOR_DECLARATION = {
beginKeywords: 'operator',
end: hljs.MATCH_NOTHING_RE,
contains: [
{
className: 'title',
match: operator,
endsParent: true,
relevance: 0
}
]
match: [
/operator/,
/\s+/,
operator
],
className: {
1: "keyword",
3: "title"
}
};

@@ -793,22 +800,17 @@

const PRECEDENCEGROUP = {
beginKeywords: 'precedencegroup',
end: hljs.MATCH_NOTHING_RE,
contains: [
{
className: 'title',
match: typeIdentifier,
relevance: 0
},
{
begin: /{/,
end: /}/,
relevance: 0,
endsParent: true,
keywords: [
...precedencegroupKeywords,
...literals
],
contains: [ TYPE ]
}
]
begin: [
/precedencegroup/,
/\s+/,
typeIdentifier
],
className: {
1: "keyword",
3: "title"
},
contains: [ TYPE ],
keywords: [
...precedencegroupKeywords,
...literals
],
end: /}/
};

@@ -850,4 +852,3 @@

{
className: 'class',
beginKeywords: 'struct protocol class extension enum',
beginKeywords: 'struct protocol class extension enum actor',
end: '\\{',

@@ -858,2 +859,3 @@ excludeEnd: true,

hljs.inherit(hljs.TITLE_MODE, {
className: "title.class",
begin: /[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/

@@ -860,0 +862,0 @@ }),

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

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -25,0 +25,0 @@

@@ -137,3 +137,2 @@ const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';

BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,

@@ -235,3 +234,4 @@ ERROR_TYPES

literal: LITERALS,
built_in: BUILT_INS
built_in: BUILT_INS,
"variable.language": BUILT_IN_VARIABLES
};

@@ -317,9 +317,15 @@

{
className: 'doctag',
begin: '@[A-Za-z]+',
begin: '(?=@[A-Za-z]+)',
relevance: 0,
contains: [
{
className: 'doctag',
begin: '@[A-Za-z]+'
},
{
className: 'type',
begin: '\\{',
end: '\\}',
excludeEnd: true,
excludeBegin: true,
relevance: 0

@@ -392,2 +398,153 @@ },

// ES6 classes
const CLASS_OR_EXTENDS = {
variants: [
{
match: [
/class/,
/\s+/,
IDENT_RE$1
],
scope: {
1: "keyword",
3: "title.class"
}
},
{
match: [
/extends/,
/\s+/,
concat(IDENT_RE$1, "(", concat(/\./, IDENT_RE$1), ")*")
],
scope: {
1: "keyword",
3: "title.class.inherited"
}
}
]
};
const CLASS_REFERENCE = {
relevance: 0,
match: /\b[A-Z][a-z]+([A-Z][a-z]+)*/,
className: "title.class",
keywords: {
_: [
// se we still get relevance credit for JS library classes
...TYPES,
...ERROR_TYPES
]
}
};
const USE_STRICT = {
label: "use_strict",
className: 'meta',
relevance: 10,
begin: /^\s*['"]use (strict|asm)['"]/
};
const FUNCTION_DEFINITION = {
variants: [
{
match: [
/function/,
/\s+/,
IDENT_RE$1,
/(?=\s*\()/
]
},
// anonymous function
{
match: [
/function/,
/\s*(?=\()/
]
}
],
className: {
1: "keyword",
3: "title.function"
},
label: "func.def",
contains: [ PARAMS ],
illegal: /%/
};
const UPPER_CASE_CONSTANT = {
relevance: 0,
match: /\b[A-Z][A-Z_]+\b/,
className: "variable.constant"
};
function noneOf(list) {
return concat("(?!", list.join("|"), ")");
}
const FUNCTION_CALL = {
match: concat(
/\b/,
noneOf([
...BUILT_IN_GLOBALS,
"super"
]),
IDENT_RE$1, lookahead(/\(/)),
className: "title.function",
relevance: 0
};
const PROPERTY_ACCESS = {
begin: concat(/\./, lookahead(
concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)
)),
end: IDENT_RE$1,
excludeBegin: true,
keywords: "prototype",
className: "property",
relevance: 0
};
const GETTER_OR_SETTER = {
match: [
/get|set/,
/\s+/,
IDENT_RE$1,
/(?=\()/
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
{ // eat to avoid empty params
begin: /\(\)/
},
PARAMS
]
};
const FUNC_LEAD_IN_RE = '(\\(' +
'[^()]*(\\(' +
'[^()]*(\\(' +
'[^()]*' +
'\\)[^()]*)*' +
'\\)[^()]*)*' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>';
const FUNCTION_VARIABLE = {
match: [
/const|var|let/, /\s+/,
IDENT_RE$1, /\s*/,
/=\s*/,
lookahead(FUNC_LEAD_IN_RE)
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
PARAMS
]
};
return {

@@ -406,8 +563,3 @@ name: 'Javascript',

}),
{
label: "use_strict",
className: 'meta',
relevance: 10,
begin: /^\s*['"]use (strict|asm)['"]/
},
USE_STRICT,
hljs.APOS_STRING_MODE,

@@ -420,31 +572,13 @@ hljs.QUOTE_STRING_MODE,

NUMBER,
{ // object attr container
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
/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,
IDENT_RE$1 + '\\s*:'))),
relevance: 0,
contains: [
{
className: 'attr',
begin: IDENT_RE$1 + lookahead('\\s*:'),
relevance: 0
}
]
CLASS_REFERENCE,
{
className: 'attr',
begin: IDENT_RE$1 + lookahead(':'),
relevance: 0
},
FUNCTION_VARIABLE,
{ // "value" container
begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
keywords: 'return throw case',
relevance: 0,
contains: [

@@ -458,9 +592,3 @@ COMMENT,

// sub-expressions inside also surrounded by parens.
begin: '(\\(' +
'[^()]*(\\(' +
'[^()]*(\\(' +
'[^()]*' +
'\\)[^()]*)*' +
'\\)[^()]*)*' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>',
begin: FUNC_LEAD_IN_RE,
returnBegin: true,

@@ -494,9 +622,8 @@ end: '\\s*=>',

{ // could be a comma delimited list of params to a function call
begin: /,/, relevance: 0
begin: /,/,
relevance: 0
},
{
className: '',
begin: /\s/,
end: /\s*/,
skip: true
match: /\s+/,
relevance: 0
},

@@ -525,18 +652,5 @@ { // JSX

],
relevance: 0
},
FUNCTION_DEFINITION,
{
className: 'function',
beginKeywords: 'function',
end: /[{;]/,
excludeEnd: true,
keywords: KEYWORDS$1,
contains: [
'self',
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
PARAMS
],
illegal: /%/
},
{
// prevent this from getting swallowed up by function

@@ -547,7 +661,6 @@ // since they appear "function like"

{
className: 'function',
// we have to count the parens to make sure we actually have the correct
// bounding ( ). There could be any number of sub-expressions inside
// also surrounded by parens.
begin: hljs.UNDERSCORE_IDENT_RE +
begin: '\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +
'\\(' + // first parens

@@ -561,5 +674,6 @@ '[^()]*(\\(' +

returnBegin:true,
label: "func.def",
contains: [
PARAMS,
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: "title.function" })
]

@@ -569,13 +683,6 @@ },

{
begin: /\.\.\./,
match: /\.\.\./,
relevance: 0
},
{
begin: concat(/\./, lookahead(IDENT_RE$1)),
end: IDENT_RE$1,
excludeBegin: true,
keywords: "prototype",
className: "property",
relevance: 0
},
PROPERTY_ACCESS,
// hack: prevents detection of keywords in some circumstances

@@ -585,41 +692,16 @@ // .keyword()

{
variants: [
{ begin: '\\.' + IDENT_RE$1 },
{ begin: '\\$' + IDENT_RE$1 }
],
match: '\\$' + IDENT_RE$1,
relevance: 0
},
{ // ES6 class
className: 'class',
beginKeywords: 'class',
end: /[{;=]/,
excludeEnd: true,
illegal: /[:"[\]]/,
contains: [
{ beginKeywords: 'extends' },
hljs.UNDERSCORE_TITLE_MODE
]
},
{
begin: /\b(?=constructor)/,
end: /[{;]/,
excludeEnd: true,
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
'self',
PARAMS
]
match: [ /\bconstructor(?=\s*\()/ ],
className: { 1: "title.function" },
contains: [ PARAMS ]
},
FUNCTION_CALL,
UPPER_CASE_CONSTANT,
CLASS_OR_EXTENDS,
GETTER_OR_SETTER,
{
begin: '(get|set)\\s+(?=' + IDENT_RE$1 + '\\()',
end: /\{/,
keywords: "get set",
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
{ begin: /\(\)/ }, // eat to avoid empty params
PARAMS
]
},
{
begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
match: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
}

@@ -681,3 +763,4 @@ ]

literal: LITERALS,
built_in: BUILT_INS.concat(TYPES)
built_in: BUILT_INS.concat(TYPES),
"variable.language": BUILT_IN_VARIABLES
};

@@ -713,3 +796,3 @@ const DECORATOR = {

const functionDeclaration = tsLanguage.contains.find(m => m.className === "function");
const functionDeclaration = tsLanguage.contains.find(m => m.label === "func.def");
functionDeclaration.relevance = 0; // () => {} is more typical in TypeScript

@@ -716,0 +799,0 @@

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

@@ -30,3 +30,3 @@ /**

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -43,2 +43,13 @@

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -52,3 +63,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -199,4 +213,3 @@ }

'<style' as a single word, followed by a whitespace or an
ending braket. The '$' is needed for the lexeme to be recognized
by hljs.subMode() that tests lexemes outside the stream.
ending bracket.
*/

@@ -203,0 +216,0 @@ begin: /<style(?=\s|>)/,

@@ -33,3 +33,3 @@ /**

function anyNumberOfTimes(re) {
return concat('(', re, ')*');
return concat('(?:', re, ')*');
}

@@ -42,3 +42,3 @@

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -55,2 +55,13 @@

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -64,3 +75,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

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

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

@@ -30,3 +30,3 @@ /**

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -373,3 +373,9 @@

},
// allow for multiple declarations, e.g.:
// extern void f(int), g(char);
{
relevance: 0,
match: /,/
},
{
className: 'params',

@@ -376,0 +382,0 @@ begin: /\(/,

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

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -290,3 +290,9 @@

},
// allow for multiple declarations, e.g.:
// extern void f(int), g(char);
{
relevance: 0,
match: /,/
},
{
className: 'params',

@@ -293,0 +299,0 @@ begin: /\(/,

@@ -122,17 +122,4 @@ const KEYWORDS = [

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,

@@ -139,0 +126,0 @@ ERROR_TYPES

@@ -30,3 +30,3 @@ /**

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -373,3 +373,9 @@

},
// allow for multiple declarations, e.g.:
// extern void f(int), g(char);
{
relevance: 0,
match: /,/
},
{
className: 'params',

@@ -376,0 +382,0 @@ begin: /\(/,

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -26,3 +37,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

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

@@ -79,3 +79,3 @@ /*

const DTS_REFERENCE = {
const REFERENCE = {
className: 'variable',

@@ -85,8 +85,8 @@ begin: /&[a-z\d_]*\b/

const DTS_KEYWORD = {
className: 'meta-keyword',
const KEYWORD = {
className: 'meta',
begin: '/[a-z][a-z\\d-]*/'
};
const DTS_LABEL = {
const LABEL = {
className: 'symbol',

@@ -96,4 +96,5 @@ begin: '^\\s*[a-zA-Z_][a-zA-Z\\d_]*:'

const DTS_CELL_PROPERTY = {
const CELL_PROPERTY = {
className: 'params',
relevance: 0,
begin: '<',

@@ -103,42 +104,55 @@ end: '>',

NUMBERS,
DTS_REFERENCE
REFERENCE
]
};
const DTS_NODE = {
className: 'class',
begin: /[a-zA-Z_][a-zA-Z\d_@]*\s\{/,
end: /[{;=]/,
returnBegin: true,
excludeEnd: true
const NODE = {
className: 'title.class',
begin: /[a-zA-Z_][a-zA-Z\d_@-]*(?=\s\{)/
};
const DTS_ROOT_NODE = {
className: 'class',
begin: '/\\s*\\{',
end: /\};/,
relevance: 10,
contains: [
DTS_REFERENCE,
DTS_KEYWORD,
DTS_LABEL,
DTS_NODE,
DTS_CELL_PROPERTY,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
NUMBERS,
STRINGS
]
const ROOT_NODE = {
className: 'title.class',
begin: /^\/(?=\s*\{)/,
relevance: 10
};
// TODO: `attribute` might be the right scope here, unsure
// I'm not sure if all these key names have semantic meaning or not
const ATTR_NO_VALUE = {
match: /[a-z][a-z-,]+(?=;)/,
relevance: 0,
scope: "attr"
};
const ATTR = {
relevance: 0,
match: [
/[a-z][a-z-,]+/,
/\s*/,
/=/
],
scope: {
1: "attr",
3: "operator"
}
};
const PUNC = {
scope: "punctuation",
relevance: 0,
// `};` combined is just to avoid tons of useless punctuation nodes
match: /\};|[;{}]/
};
return {
name: 'Device Tree',
keywords: "",
contains: [
DTS_ROOT_NODE,
DTS_REFERENCE,
DTS_KEYWORD,
DTS_LABEL,
DTS_NODE,
DTS_CELL_PROPERTY,
ROOT_NODE,
REFERENCE,
KEYWORD,
LABEL,
NODE,
ATTR,
ATTR_NO_VALUE,
CELL_PROPERTY,
hljs.C_LINE_COMMENT_MODE,

@@ -149,2 +163,3 @@ hljs.C_BLOCK_COMMENT_MODE,

PREPROCESSOR,
PUNC,
{

@@ -151,0 +166,0 @@ begin: hljs.IDENT_RE + '::',

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

function anyNumberOfTimes(re) {
return concat('(', re, ')*');
return concat('(?:', re, ')*');
}

@@ -25,0 +25,0 @@

@@ -23,13 +23,11 @@ /*

'^\\s*(!=#|=#|-#|/).*$',
false,
{
relevance: 0
}
null,
{ relevance: 0 }
),
{
begin: '^\\s*(-|=|!=)(?!#)',
starts: {
end: '\\n',
subLanguage: 'ruby'
}
end: /$/,
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true
},

@@ -109,6 +107,6 @@ {

begin: /#\{/,
starts: {
end: /\}/,
subLanguage: 'ruby'
}
end: /\}/,
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true
}

@@ -115,0 +113,0 @@ ]

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

function anyNumberOfTimes(re) {
return concat('(', re, ')*');
return concat('(?:', re, ')*');
}

@@ -31,3 +31,3 @@

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -44,2 +44,13 @@

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -53,3 +64,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -56,0 +70,0 @@ }

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -43,3 +54,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -46,0 +60,0 @@ }

@@ -137,3 +137,2 @@ const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';

BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,

@@ -235,3 +234,4 @@ ERROR_TYPES

literal: LITERALS,
built_in: BUILT_INS
built_in: BUILT_INS,
"variable.language": BUILT_IN_VARIABLES
};

@@ -317,9 +317,15 @@

{
className: 'doctag',
begin: '@[A-Za-z]+',
begin: '(?=@[A-Za-z]+)',
relevance: 0,
contains: [
{
className: 'doctag',
begin: '@[A-Za-z]+'
},
{
className: 'type',
begin: '\\{',
end: '\\}',
excludeEnd: true,
excludeBegin: true,
relevance: 0

@@ -392,2 +398,153 @@ },

// ES6 classes
const CLASS_OR_EXTENDS = {
variants: [
{
match: [
/class/,
/\s+/,
IDENT_RE$1
],
scope: {
1: "keyword",
3: "title.class"
}
},
{
match: [
/extends/,
/\s+/,
concat(IDENT_RE$1, "(", concat(/\./, IDENT_RE$1), ")*")
],
scope: {
1: "keyword",
3: "title.class.inherited"
}
}
]
};
const CLASS_REFERENCE = {
relevance: 0,
match: /\b[A-Z][a-z]+([A-Z][a-z]+)*/,
className: "title.class",
keywords: {
_: [
// se we still get relevance credit for JS library classes
...TYPES,
...ERROR_TYPES
]
}
};
const USE_STRICT = {
label: "use_strict",
className: 'meta',
relevance: 10,
begin: /^\s*['"]use (strict|asm)['"]/
};
const FUNCTION_DEFINITION = {
variants: [
{
match: [
/function/,
/\s+/,
IDENT_RE$1,
/(?=\s*\()/
]
},
// anonymous function
{
match: [
/function/,
/\s*(?=\()/
]
}
],
className: {
1: "keyword",
3: "title.function"
},
label: "func.def",
contains: [ PARAMS ],
illegal: /%/
};
const UPPER_CASE_CONSTANT = {
relevance: 0,
match: /\b[A-Z][A-Z_]+\b/,
className: "variable.constant"
};
function noneOf(list) {
return concat("(?!", list.join("|"), ")");
}
const FUNCTION_CALL = {
match: concat(
/\b/,
noneOf([
...BUILT_IN_GLOBALS,
"super"
]),
IDENT_RE$1, lookahead(/\(/)),
className: "title.function",
relevance: 0
};
const PROPERTY_ACCESS = {
begin: concat(/\./, lookahead(
concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)
)),
end: IDENT_RE$1,
excludeBegin: true,
keywords: "prototype",
className: "property",
relevance: 0
};
const GETTER_OR_SETTER = {
match: [
/get|set/,
/\s+/,
IDENT_RE$1,
/(?=\()/
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
{ // eat to avoid empty params
begin: /\(\)/
},
PARAMS
]
};
const FUNC_LEAD_IN_RE = '(\\(' +
'[^()]*(\\(' +
'[^()]*(\\(' +
'[^()]*' +
'\\)[^()]*)*' +
'\\)[^()]*)*' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>';
const FUNCTION_VARIABLE = {
match: [
/const|var|let/, /\s+/,
IDENT_RE$1, /\s*/,
/=\s*/,
lookahead(FUNC_LEAD_IN_RE)
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
PARAMS
]
};
return {

@@ -406,8 +563,3 @@ name: 'Javascript',

}),
{
label: "use_strict",
className: 'meta',
relevance: 10,
begin: /^\s*['"]use (strict|asm)['"]/
},
USE_STRICT,
hljs.APOS_STRING_MODE,

@@ -420,31 +572,13 @@ hljs.QUOTE_STRING_MODE,

NUMBER,
{ // object attr container
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
/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,
IDENT_RE$1 + '\\s*:'))),
relevance: 0,
contains: [
{
className: 'attr',
begin: IDENT_RE$1 + lookahead('\\s*:'),
relevance: 0
}
]
CLASS_REFERENCE,
{
className: 'attr',
begin: IDENT_RE$1 + lookahead(':'),
relevance: 0
},
FUNCTION_VARIABLE,
{ // "value" container
begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
keywords: 'return throw case',
relevance: 0,
contains: [

@@ -458,9 +592,3 @@ COMMENT,

// sub-expressions inside also surrounded by parens.
begin: '(\\(' +
'[^()]*(\\(' +
'[^()]*(\\(' +
'[^()]*' +
'\\)[^()]*)*' +
'\\)[^()]*)*' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>',
begin: FUNC_LEAD_IN_RE,
returnBegin: true,

@@ -494,9 +622,8 @@ end: '\\s*=>',

{ // could be a comma delimited list of params to a function call
begin: /,/, relevance: 0
begin: /,/,
relevance: 0
},
{
className: '',
begin: /\s/,
end: /\s*/,
skip: true
match: /\s+/,
relevance: 0
},

@@ -525,18 +652,5 @@ { // JSX

],
relevance: 0
},
FUNCTION_DEFINITION,
{
className: 'function',
beginKeywords: 'function',
end: /[{;]/,
excludeEnd: true,
keywords: KEYWORDS$1,
contains: [
'self',
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
PARAMS
],
illegal: /%/
},
{
// prevent this from getting swallowed up by function

@@ -547,7 +661,6 @@ // since they appear "function like"

{
className: 'function',
// we have to count the parens to make sure we actually have the correct
// bounding ( ). There could be any number of sub-expressions inside
// also surrounded by parens.
begin: hljs.UNDERSCORE_IDENT_RE +
begin: '\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +
'\\(' + // first parens

@@ -561,5 +674,6 @@ '[^()]*(\\(' +

returnBegin:true,
label: "func.def",
contains: [
PARAMS,
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: "title.function" })
]

@@ -569,13 +683,6 @@ },

{
begin: /\.\.\./,
match: /\.\.\./,
relevance: 0
},
{
begin: concat(/\./, lookahead(IDENT_RE$1)),
end: IDENT_RE$1,
excludeBegin: true,
keywords: "prototype",
className: "property",
relevance: 0
},
PROPERTY_ACCESS,
// hack: prevents detection of keywords in some circumstances

@@ -585,41 +692,16 @@ // .keyword()

{
variants: [
{ begin: '\\.' + IDENT_RE$1 },
{ begin: '\\$' + IDENT_RE$1 }
],
match: '\\$' + IDENT_RE$1,
relevance: 0
},
{ // ES6 class
className: 'class',
beginKeywords: 'class',
end: /[{;=]/,
excludeEnd: true,
illegal: /[:"[\]]/,
contains: [
{ beginKeywords: 'extends' },
hljs.UNDERSCORE_TITLE_MODE
]
},
{
begin: /\b(?=constructor)/,
end: /[{;]/,
excludeEnd: true,
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
'self',
PARAMS
]
match: [ /\bconstructor(?=\s*\()/ ],
className: { 1: "title.function" },
contains: [ PARAMS ]
},
FUNCTION_CALL,
UPPER_CASE_CONSTANT,
CLASS_OR_EXTENDS,
GETTER_OR_SETTER,
{
begin: '(get|set)\\s+(?=' + IDENT_RE$1 + '\\()',
end: /\{/,
keywords: "get set",
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
{ begin: /\(\)/ }, // eat to avoid empty params
PARAMS
]
},
{
begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
match: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
}

@@ -626,0 +708,0 @@ ]

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -26,3 +37,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

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

@@ -122,17 +122,4 @@ const KEYWORDS = [

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,

@@ -139,0 +126,0 @@ ERROR_TYPES

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -449,3 +463,3 @@ }

// allow matching common delimiters
{ begin: PAIRED_DOUBLE_RE("s|tr|y", either(...REGEX_DELIMS)) },
{ begin: PAIRED_DOUBLE_RE("s|tr|y", either(...REGEX_DELIMS, { capture: true })) },
// and then paired delmis

@@ -470,3 +484,3 @@ { begin: PAIRED_DOUBLE_RE("s|tr|y", "\\(", "\\)") },

// allow matching common delimiters
{ begin: PAIRED_RE("m|qr", either(...REGEX_DELIMS), /\1/)},
{ begin: PAIRED_RE("m|qr", either(...REGEX_DELIMS, { capture: true }), /\1/)},
// allow common paired delmins

@@ -473,0 +487,0 @@ { begin: PAIRED_RE("m|qr", /\(/, /\)/)},

@@ -0,1 +1,60 @@

/**
* @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;
}
function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**
* 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 opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*

@@ -10,2 +69,405 @@ Language: Processing

function processing(hljs) {
const BUILT_INS = [
"displayHeight",
"displayWidth",
"mouseY",
"mouseX",
"mousePressed",
"pmouseX",
"pmouseY",
"key",
"keyCode",
"pixels",
"focused",
"frameCount",
"frameRate",
"height",
"width",
"size",
"createGraphics",
"beginDraw",
"createShape",
"loadShape",
"PShape",
"arc",
"ellipse",
"line",
"point",
"quad",
"rect",
"triangle",
"bezier",
"bezierDetail",
"bezierPoint",
"bezierTangent",
"curve",
"curveDetail",
"curvePoint",
"curveTangent",
"curveTightness",
"shape",
"shapeMode",
"beginContour",
"beginShape",
"bezierVertex",
"curveVertex",
"endContour",
"endShape",
"quadraticVertex",
"vertex",
"ellipseMode",
"noSmooth",
"rectMode",
"smooth",
"strokeCap",
"strokeJoin",
"strokeWeight",
"mouseClicked",
"mouseDragged",
"mouseMoved",
"mousePressed",
"mouseReleased",
"mouseWheel",
"keyPressed",
"keyPressedkeyReleased",
"keyTyped",
"print",
"println",
"save",
"saveFrame",
"day",
"hour",
"millis",
"minute",
"month",
"second",
"year",
"background",
"clear",
"colorMode",
"fill",
"noFill",
"noStroke",
"stroke",
"alpha",
"blue",
"brightness",
"color",
"green",
"hue",
"lerpColor",
"red",
"saturation",
"modelX",
"modelY",
"modelZ",
"screenX",
"screenY",
"screenZ",
"ambient",
"emissive",
"shininess",
"specular",
"add",
"createImage",
"beginCamera",
"camera",
"endCamera",
"frustum",
"ortho",
"perspective",
"printCamera",
"printProjection",
"cursor",
"frameRate",
"noCursor",
"exit",
"loop",
"noLoop",
"popStyle",
"pushStyle",
"redraw",
"binary",
"boolean",
"byte",
"char",
"float",
"hex",
"int",
"str",
"unbinary",
"unhex",
"join",
"match",
"matchAll",
"nf",
"nfc",
"nfp",
"nfs",
"split",
"splitTokens",
"trim",
"append",
"arrayCopy",
"concat",
"expand",
"reverse",
"shorten",
"sort",
"splice",
"subset",
"box",
"sphere",
"sphereDetail",
"createInput",
"createReader",
"loadBytes",
"loadJSONArray",
"loadJSONObject",
"loadStrings",
"loadTable",
"loadXML",
"open",
"parseXML",
"saveTable",
"selectFolder",
"selectInput",
"beginRaw",
"beginRecord",
"createOutput",
"createWriter",
"endRaw",
"endRecord",
"PrintWritersaveBytes",
"saveJSONArray",
"saveJSONObject",
"saveStream",
"saveStrings",
"saveXML",
"selectOutput",
"popMatrix",
"printMatrix",
"pushMatrix",
"resetMatrix",
"rotate",
"rotateX",
"rotateY",
"rotateZ",
"scale",
"shearX",
"shearY",
"translate",
"ambientLight",
"directionalLight",
"lightFalloff",
"lights",
"lightSpecular",
"noLights",
"normal",
"pointLight",
"spotLight",
"image",
"imageMode",
"loadImage",
"noTint",
"requestImage",
"tint",
"texture",
"textureMode",
"textureWrap",
"blend",
"copy",
"filter",
"get",
"loadPixels",
"set",
"updatePixels",
"blendMode",
"loadShader",
"PShaderresetShader",
"shader",
"createFont",
"loadFont",
"text",
"textFont",
"textAlign",
"textLeading",
"textMode",
"textSize",
"textWidth",
"textAscent",
"textDescent",
"abs",
"ceil",
"constrain",
"dist",
"exp",
"floor",
"lerp",
"log",
"mag",
"map",
"max",
"min",
"norm",
"pow",
"round",
"sq",
"sqrt",
"acos",
"asin",
"atan",
"atan2",
"cos",
"degrees",
"radians",
"sin",
"tan",
"noise",
"noiseDetail",
"noiseSeed",
"random",
"randomGaussian",
"randomSeed"
];
const IDENT = hljs.IDENT_RE;
const FUNC_NAME = {
variants: [
{
match: concat(either(...BUILT_INS), lookahead(/\s*\(/)),
className: "built_in"
},
{
relevance: 0,
match: concat(
/\b(?!for|if|while)/,
IDENT, lookahead(/\s*\(/)),
className: "title.function"
}
]
};
const NEW_CLASS = {
match: [
/new\s+/,
IDENT
],
className: {
1: "keyword",
2: "class.title"
}
};
const PROPERTY = {
relevance: 0,
match: [
/\./,
IDENT
],
className: {
2: "property"
}
};
const CLASS = {
variants: [
{
match: [
/class/,
/\s+/,
IDENT,
/\s+/,
/extends/,
/\s+/,
IDENT
]
},
{
match: [
/class/,
/\s+/,
IDENT
]
}
],
className: {
1: "keyword",
3: "title.class",
5: "keyword",
7: "title.class.inherited"
}
};
const TYPES = [
"boolean",
"byte",
"char",
"color",
"double",
"float",
"int",
"long",
"short",
];
const CLASSES = [
"BufferedReader",
"PVector",
"PFont",
"PImage",
"PGraphics",
"HashMap",
"String",
"Array",
"FloatDict",
"ArrayList",
"FloatList",
"IntDict",
"IntList",
"JSONArray",
"JSONObject",
"Object",
"StringDict",
"StringList",
"Table",
"TableRow",
"XML"
];
const JAVA_KEYWORDS = [
"abstract",
"assert",
"break",
"case",
"catch",
"const",
"continue",
"default",
"else",
"enum",
"final",
"finally",
"for",
"if",
"import",
"instanceof",
"long",
"native",
"new",
"package",
"private",
"private",
"protected",
"protected",
"public",
"public",
"return",
"static",
"strictfp",
"switch",
"synchronized",
"throw",
"throws",
"transient",
"try",
"void",
"volatile",
"while"
];
return {

@@ -15,38 +477,19 @@ name: 'Processing',

keywords: {
keyword: 'BufferedReader PVector PFont PImage PGraphics HashMap boolean byte char color ' +
'double float int long String Array FloatDict FloatList IntDict IntList JSONArray JSONObject ' +
'Object StringDict StringList Table TableRow XML ' +
// Java keywords
'false synchronized int abstract float private char boolean static null if const ' +
'for true while long throw strictfp finally protected import native final return void ' +
'enum else break transient new catch instanceof byte super volatile case assert short ' +
'package default double public try this switch continue throws protected public private',
literal: 'P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI',
keyword: [
...JAVA_KEYWORDS
],
literal: 'P2D P3D HALF_PI PI QUARTER_PI TAU TWO_PI null true false',
title: 'setup draw',
built_in: 'displayHeight displayWidth mouseY mouseX mousePressed pmouseX pmouseY key ' +
'keyCode pixels focused frameCount frameRate height width ' +
'size createGraphics beginDraw createShape loadShape PShape arc ellipse line point ' +
'quad rect triangle bezier bezierDetail bezierPoint bezierTangent curve curveDetail curvePoint ' +
'curveTangent curveTightness shape shapeMode beginContour beginShape bezierVertex curveVertex ' +
'endContour endShape quadraticVertex vertex ellipseMode noSmooth rectMode smooth strokeCap ' +
'strokeJoin strokeWeight mouseClicked mouseDragged mouseMoved mousePressed mouseReleased ' +
'mouseWheel keyPressed keyPressedkeyReleased keyTyped print println save saveFrame day hour ' +
'millis minute month second year background clear colorMode fill noFill noStroke stroke alpha ' +
'blue brightness color green hue lerpColor red saturation modelX modelY modelZ screenX screenY ' +
'screenZ ambient emissive shininess specular add createImage beginCamera camera endCamera frustum ' +
'ortho perspective printCamera printProjection cursor frameRate noCursor exit loop noLoop popStyle ' +
'pushStyle redraw binary boolean byte char float hex int str unbinary unhex join match matchAll nf ' +
'nfc nfp nfs split splitTokens trim append arrayCopy concat expand reverse shorten sort splice subset ' +
'box sphere sphereDetail createInput createReader loadBytes loadJSONArray loadJSONObject loadStrings ' +
'loadTable loadXML open parseXML saveTable selectFolder selectInput beginRaw beginRecord createOutput ' +
'createWriter endRaw endRecord PrintWritersaveBytes saveJSONArray saveJSONObject saveStream saveStrings ' +
'saveXML selectOutput popMatrix printMatrix pushMatrix resetMatrix rotate rotateX rotateY rotateZ scale ' +
'shearX shearY translate ambientLight directionalLight lightFalloff lights lightSpecular noLights normal ' +
'pointLight spotLight image imageMode loadImage noTint requestImage tint texture textureMode textureWrap ' +
'blend copy filter get loadPixels set updatePixels blendMode loadShader PShaderresetShader shader createFont ' +
'loadFont text textFont textAlign textLeading textMode textSize textWidth textAscent textDescent abs ceil ' +
'constrain dist exp floor lerp log mag map max min norm pow round sq sqrt acos asin atan atan2 cos degrees ' +
'radians sin tan noise noiseDetail noiseSeed random randomGaussian randomSeed'
variable: "super this",
built_in: [
...BUILT_INS,
...CLASSES
],
type: TYPES
},
contains: [
CLASS,
NEW_CLASS,
FUNC_NAME,
PROPERTY,
hljs.C_LINE_COMMENT_MODE,

@@ -53,0 +496,0 @@ hljs.C_BLOCK_COMMENT_MODE,

@@ -230,3 +230,3 @@ /**

{
begin: /r(#*)"(.|\n)*?"\1(?!#)/
begin: /b?r(#*)"(.|\n)*?"\1(?!#)/
},

@@ -233,0 +233,0 @@ {

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -26,3 +37,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

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

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

@@ -471,2 +471,31 @@ /*

const BLOCK_COMMENT = hljs.COMMENT(
/\/\*/,
/\*\//,
{
relevance: 0,
contains: [
{
className: 'doctag',
match: /@(return|param)/
}
]
}
);
const INCLUDE = {
className: 'meta',
begin: /^#include\b/,
end: /$/,
relevance: 0, // relevance comes from keywords
keywords: "include",
contains: [
{
match: /[a-z][a-z-.]+/,
className: "string"
},
hljs.C_LINE_COMMENT_MODE
]
};
return {

@@ -483,26 +512,5 @@ name: 'Stan',

hljs.C_LINE_COMMENT_MODE,
hljs.COMMENT(
/#/,
/$/,
{
relevance: 0,
keywords: {
'meta-keyword': 'include'
}
}
),
hljs.COMMENT(
/\/\*/,
/\*\//,
{
relevance: 0,
// highlight doc strings mentioned in Stan reference
contains: [
{
className: 'doctag',
begin: /@(return|param)/
}
]
}
),
INCLUDE,
hljs.HASH_COMMENT_MODE,
BLOCK_COMMENT,
{

@@ -521,4 +529,3 @@ // hack: in range constraints, lower must follow "<"

className: 'keyword',
begin: /\btarget\s*\+=/,
relevance: 10
begin: /\btarget\s*\+=/
},

@@ -525,0 +532,0 @@ {

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -43,3 +54,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -77,2 +91,3 @@ }

// avoid conflicts with other rules
'actor',
'associatedtype',

@@ -396,6 +411,9 @@ 'async',

const DOT_KEYWORD = {
className: 'keyword',
begin: concat(/\./, lookahead(either(...dotKeywords, ...optionalDotKeywords))),
end: either(...dotKeywords, ...optionalDotKeywords),
excludeBegin: true
match: [
/\./,
either(...dotKeywords, ...optionalDotKeywords)
],
className: {
2: "keyword"
}
};

@@ -680,20 +698,2 @@ const KEYWORD_GUARD = {

// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID362
// Matches both the keyword func and the function title.
// Grouping these lets us differentiate between the operator function <
// and the start of the generic parameter clause (also <).
const FUNC_PLUS_TITLE = {
beginKeywords: 'func',
contains: [
{
className: 'title',
match: either(QUOTED_IDENTIFIER.match, identifier, operator),
// Required to make sure the opening < of the generic parameter clause
// isn't parsed as a second title.
endsParent: true,
relevance: 0
},
WHITESPACE
]
};
const GENERIC_PARAMETERS = {

@@ -743,7 +743,14 @@ begin: /</,

};
// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID362
const FUNCTION = {
className: 'function',
match: lookahead(/\bfunc\b/),
match: [
/func/,
/\s+/,
either(QUOTED_IDENTIFIER.match, identifier, operator)
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
FUNC_PLUS_TITLE,
GENERIC_PARAMETERS,

@@ -762,7 +769,8 @@ FUNCTION_PARAMETERS,

const INIT_SUBSCRIPT = {
className: 'function',
match: /\b(subscript|init[?!]?)\s*(?=[<(])/,
keywords: {
keyword: "subscript init init? init!",
$pattern: /\w+[?!]?/
match: [
/\b(?:subscript|init[?!]?)/,
/\s*(?=[<(])/,
],
className: {
1: "keyword"
},

@@ -778,12 +786,11 @@ contains: [

const OPERATOR_DECLARATION = {
beginKeywords: 'operator',
end: hljs.MATCH_NOTHING_RE,
contains: [
{
className: 'title',
match: operator,
endsParent: true,
relevance: 0
}
]
match: [
/operator/,
/\s+/,
operator
],
className: {
1: "keyword",
3: "title"
}
};

@@ -793,22 +800,17 @@

const PRECEDENCEGROUP = {
beginKeywords: 'precedencegroup',
end: hljs.MATCH_NOTHING_RE,
contains: [
{
className: 'title',
match: typeIdentifier,
relevance: 0
},
{
begin: /{/,
end: /}/,
relevance: 0,
endsParent: true,
keywords: [
...precedencegroupKeywords,
...literals
],
contains: [ TYPE ]
}
]
begin: [
/precedencegroup/,
/\s+/,
typeIdentifier
],
className: {
1: "keyword",
3: "title"
},
contains: [ TYPE ],
keywords: [
...precedencegroupKeywords,
...literals
],
end: /}/
};

@@ -850,4 +852,3 @@

{
className: 'class',
beginKeywords: 'struct protocol class extension enum',
beginKeywords: 'struct protocol class extension enum actor',
end: '\\{',

@@ -858,2 +859,3 @@ excludeEnd: true,

hljs.inherit(hljs.TITLE_MODE, {
className: "title.class",
begin: /[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/

@@ -860,0 +862,0 @@ }),

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

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -25,0 +25,0 @@

@@ -137,3 +137,2 @@ const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';

BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,

@@ -235,3 +234,4 @@ ERROR_TYPES

literal: LITERALS,
built_in: BUILT_INS
built_in: BUILT_INS,
"variable.language": BUILT_IN_VARIABLES
};

@@ -317,9 +317,15 @@

{
className: 'doctag',
begin: '@[A-Za-z]+',
begin: '(?=@[A-Za-z]+)',
relevance: 0,
contains: [
{
className: 'doctag',
begin: '@[A-Za-z]+'
},
{
className: 'type',
begin: '\\{',
end: '\\}',
excludeEnd: true,
excludeBegin: true,
relevance: 0

@@ -392,2 +398,153 @@ },

// ES6 classes
const CLASS_OR_EXTENDS = {
variants: [
{
match: [
/class/,
/\s+/,
IDENT_RE$1
],
scope: {
1: "keyword",
3: "title.class"
}
},
{
match: [
/extends/,
/\s+/,
concat(IDENT_RE$1, "(", concat(/\./, IDENT_RE$1), ")*")
],
scope: {
1: "keyword",
3: "title.class.inherited"
}
}
]
};
const CLASS_REFERENCE = {
relevance: 0,
match: /\b[A-Z][a-z]+([A-Z][a-z]+)*/,
className: "title.class",
keywords: {
_: [
// se we still get relevance credit for JS library classes
...TYPES,
...ERROR_TYPES
]
}
};
const USE_STRICT = {
label: "use_strict",
className: 'meta',
relevance: 10,
begin: /^\s*['"]use (strict|asm)['"]/
};
const FUNCTION_DEFINITION = {
variants: [
{
match: [
/function/,
/\s+/,
IDENT_RE$1,
/(?=\s*\()/
]
},
// anonymous function
{
match: [
/function/,
/\s*(?=\()/
]
}
],
className: {
1: "keyword",
3: "title.function"
},
label: "func.def",
contains: [ PARAMS ],
illegal: /%/
};
const UPPER_CASE_CONSTANT = {
relevance: 0,
match: /\b[A-Z][A-Z_]+\b/,
className: "variable.constant"
};
function noneOf(list) {
return concat("(?!", list.join("|"), ")");
}
const FUNCTION_CALL = {
match: concat(
/\b/,
noneOf([
...BUILT_IN_GLOBALS,
"super"
]),
IDENT_RE$1, lookahead(/\(/)),
className: "title.function",
relevance: 0
};
const PROPERTY_ACCESS = {
begin: concat(/\./, lookahead(
concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/)
)),
end: IDENT_RE$1,
excludeBegin: true,
keywords: "prototype",
className: "property",
relevance: 0
};
const GETTER_OR_SETTER = {
match: [
/get|set/,
/\s+/,
IDENT_RE$1,
/(?=\()/
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
{ // eat to avoid empty params
begin: /\(\)/
},
PARAMS
]
};
const FUNC_LEAD_IN_RE = '(\\(' +
'[^()]*(\\(' +
'[^()]*(\\(' +
'[^()]*' +
'\\)[^()]*)*' +
'\\)[^()]*)*' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>';
const FUNCTION_VARIABLE = {
match: [
/const|var|let/, /\s+/,
IDENT_RE$1, /\s*/,
/=\s*/,
lookahead(FUNC_LEAD_IN_RE)
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
PARAMS
]
};
return {

@@ -406,8 +563,3 @@ name: 'Javascript',

}),
{
label: "use_strict",
className: 'meta',
relevance: 10,
begin: /^\s*['"]use (strict|asm)['"]/
},
USE_STRICT,
hljs.APOS_STRING_MODE,

@@ -420,31 +572,13 @@ hljs.QUOTE_STRING_MODE,

NUMBER,
{ // object attr container
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
/(((\/\/.*$)|(\/\*(\*[^/]|[^*])*\*\/))\s*)*/,
IDENT_RE$1 + '\\s*:'))),
relevance: 0,
contains: [
{
className: 'attr',
begin: IDENT_RE$1 + lookahead('\\s*:'),
relevance: 0
}
]
CLASS_REFERENCE,
{
className: 'attr',
begin: IDENT_RE$1 + lookahead(':'),
relevance: 0
},
FUNCTION_VARIABLE,
{ // "value" container
begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
keywords: 'return throw case',
relevance: 0,
contains: [

@@ -458,9 +592,3 @@ COMMENT,

// sub-expressions inside also surrounded by parens.
begin: '(\\(' +
'[^()]*(\\(' +
'[^()]*(\\(' +
'[^()]*' +
'\\)[^()]*)*' +
'\\)[^()]*)*' +
'\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\s*=>',
begin: FUNC_LEAD_IN_RE,
returnBegin: true,

@@ -494,9 +622,8 @@ end: '\\s*=>',

{ // could be a comma delimited list of params to a function call
begin: /,/, relevance: 0
begin: /,/,
relevance: 0
},
{
className: '',
begin: /\s/,
end: /\s*/,
skip: true
match: /\s+/,
relevance: 0
},

@@ -525,18 +652,5 @@ { // JSX

],
relevance: 0
},
FUNCTION_DEFINITION,
{
className: 'function',
beginKeywords: 'function',
end: /[{;]/,
excludeEnd: true,
keywords: KEYWORDS$1,
contains: [
'self',
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
PARAMS
],
illegal: /%/
},
{
// prevent this from getting swallowed up by function

@@ -547,7 +661,6 @@ // since they appear "function like"

{
className: 'function',
// we have to count the parens to make sure we actually have the correct
// bounding ( ). There could be any number of sub-expressions inside
// also surrounded by parens.
begin: hljs.UNDERSCORE_IDENT_RE +
begin: '\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE +
'\\(' + // first parens

@@ -561,5 +674,6 @@ '[^()]*(\\(' +

returnBegin:true,
label: "func.def",
contains: [
PARAMS,
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: "title.function" })
]

@@ -569,13 +683,6 @@ },

{
begin: /\.\.\./,
match: /\.\.\./,
relevance: 0
},
{
begin: concat(/\./, lookahead(IDENT_RE$1)),
end: IDENT_RE$1,
excludeBegin: true,
keywords: "prototype",
className: "property",
relevance: 0
},
PROPERTY_ACCESS,
// hack: prevents detection of keywords in some circumstances

@@ -585,41 +692,16 @@ // .keyword()

{
variants: [
{ begin: '\\.' + IDENT_RE$1 },
{ begin: '\\$' + IDENT_RE$1 }
],
match: '\\$' + IDENT_RE$1,
relevance: 0
},
{ // ES6 class
className: 'class',
beginKeywords: 'class',
end: /[{;=]/,
excludeEnd: true,
illegal: /[:"[\]]/,
contains: [
{ beginKeywords: 'extends' },
hljs.UNDERSCORE_TITLE_MODE
]
},
{
begin: /\b(?=constructor)/,
end: /[{;]/,
excludeEnd: true,
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
'self',
PARAMS
]
match: [ /\bconstructor(?=\s*\()/ ],
className: { 1: "title.function" },
contains: [ PARAMS ]
},
FUNCTION_CALL,
UPPER_CASE_CONSTANT,
CLASS_OR_EXTENDS,
GETTER_OR_SETTER,
{
begin: '(get|set)\\s+(?=' + IDENT_RE$1 + '\\()',
end: /\{/,
keywords: "get set",
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),
{ begin: /\(\)/ }, // eat to avoid empty params
PARAMS
]
},
{
begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
match: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
}

@@ -681,3 +763,4 @@ ]

literal: LITERALS,
built_in: BUILT_INS.concat(TYPES)
built_in: BUILT_INS.concat(TYPES),
"variable.language": BUILT_IN_VARIABLES
};

@@ -713,3 +796,3 @@ const DECORATOR = {

const functionDeclaration = tsLanguage.contains.find(m => m.className === "function");
const functionDeclaration = tsLanguage.contains.find(m => m.label === "func.def");
functionDeclaration.relevance = 0; // () => {} is more typical in TypeScript

@@ -716,0 +799,0 @@

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

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

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -35,3 +46,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -38,0 +52,0 @@ }

@@ -30,3 +30,3 @@ /**

function optional(re) {
return concat('(', re, ')?');
return concat('(?:', re, ')?');
}

@@ -43,2 +43,13 @@

function stripOptionsFromArgs(args) {
const opts = args[args.length - 1];
if (typeof opts === 'object' && opts.constructor === Object) {
args.splice(args.length - 1, 1);
return opts;
} else {
return {};
}
}
/**

@@ -52,3 +63,6 @@ * Any of the passed expresssions may match

function either(...args) {
const joined = '(' + args.map((x) => source(x)).join("|") + ")";
const opts = stripOptionsFromArgs(args);
const joined = '(' +
(opts.capture ? "" : "?:") +
args.map((x) => source(x)).join("|") + ")";
return joined;

@@ -199,4 +213,3 @@ }

'<style' as a single word, followed by a whitespace or an
ending braket. The '$' is needed for the lexeme to be recognized
by hljs.subMode() that tests lexemes outside the stream.
ending bracket.
*/

@@ -203,0 +216,0 @@ begin: /<style(?=\s|>)/,

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

"homepage": "https://highlightjs.org/",
"version": "11.0.0-alpha1",
"version": "11.0.0-beta0",
"author": {

@@ -107,4 +107,7 @@ "name": "Ivan Sagalaev",

"import": "./es/languages/*.js"
}
},
"./scss/*": "./scss/*",
"./styles/*": "./styles/*",
"./types/*": "./types/*"
}
}

@@ -61,3 +61,3 @@ # Highlight.js

#### Upgrading to Version 11 (currently in alpha)
#### Upgrading to Version 11 (currently in beta)

@@ -64,0 +64,0 @@ As always our major releases do contain breaking changes which may require action from users. Please read [VERSION_11_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/main/VERSION_11_UPGRADE.md) for a detailed summary of breaking changes and any actions you may need to take.

# Security Policy
Due to both time and resource constrains the Highlight.js core team fully supports only the current major/minor release of the library. Prior major releases may be supported for a short time after new major releases are issued. Problems with minor releases are often resolved by upgrading to the most recent release.
Due to both time and resource constrains the Highlight.js core team fully supports only the current major/minor release of the library. Prior major releases may be supported for a short time after new major releases are issued. Problems with minor releases are often resolved by upgrading to the most recent minor release.
### Supported Versions
### Release Status
| Version | | Status |
| Version | Support | Status |
| :-----: | :-: | :------ |
| 11.0 | :fire: :pray: | The 11.x series is currently in alpha. <br>See [VERSION_11_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_11_UPGRADE.md). |
| 11.0 | :white_check_mark: | The 11.x series is currently in beta. <br>See [VERSION_11_UPGRADE.md](https://github.com/highlightjs/highlight.js/blob/master/VERSION_11_UPGRADE.md). |
| 10.7.1 | :white_check_mark: | The 10.x series recieves regular updates, new features & security fixes. |
| <= 10.4.0 | :x: | Known vulnerabities. |
| 9.18.5 | :x: | [EOL](https://github.com/highlightjs/highlight.js/issues/2877). No longer supported. |
| <= 9.18.3 | :x: | Known vulnerabities. |
| <= 8.x | :x: | Obsolete. Known vulnerabities. |
| <= 9.18.5 | :x: | Known vulnerabities. [EOL](https://github.com/highlightjs/highlight.js/issues/2877) |
| 7.x, 8.x | :x: | Obsolete. Known vulnerabities. |

@@ -16,0 +15,0 @@

@@ -135,2 +135,3 @@ /* eslint-disable no-unused-vars */

__emitter: EmitterConstructor
ignoreUnescapedHTML?: boolean
}

@@ -137,0 +138,0 @@

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

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 not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc