完成世界书、骰子、apiconfig页面处理

This commit is contained in:
2026-04-30 01:35:10 +08:00
parent a3e3711b2b
commit ba9b925c32
4602 changed files with 785225 additions and 23 deletions

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/1c" instead of "highlight.js/lib/languages/1c.js"'
);
}
}
emitWarning();
module.exports = require('./1c.js');

View File

@@ -0,0 +1,83 @@
/*
Language: Augmented Backus-Naur Form
Author: Alex McKibben <alex@nullscope.net>
Website: https://tools.ietf.org/html/rfc5234
Category: syntax
Audit: 2020
*/
/** @type LanguageFn */
function abnf(hljs) {
const regex = hljs.regex;
const IDENT = /^[a-zA-Z][a-zA-Z0-9-]*/;
const KEYWORDS = [
"ALPHA",
"BIT",
"CHAR",
"CR",
"CRLF",
"CTL",
"DIGIT",
"DQUOTE",
"HEXDIG",
"HTAB",
"LF",
"LWSP",
"OCTET",
"SP",
"VCHAR",
"WSP"
];
const COMMENT = hljs.COMMENT(/;/, /$/);
const TERMINAL_BINARY = {
scope: "symbol",
match: /%b[0-1]+(-[0-1]+|(\.[0-1]+)+)?/
};
const TERMINAL_DECIMAL = {
scope: "symbol",
match: /%d[0-9]+(-[0-9]+|(\.[0-9]+)+)?/
};
const TERMINAL_HEXADECIMAL = {
scope: "symbol",
match: /%x[0-9A-F]+(-[0-9A-F]+|(\.[0-9A-F]+)+)?/
};
const CASE_SENSITIVITY = {
scope: "symbol",
match: /%[si](?=".*")/
};
const RULE_DECLARATION = {
scope: "attribute",
match: regex.concat(IDENT, /(?=\s*=)/)
};
const ASSIGNMENT = {
scope: "operator",
match: /=\/?/
};
return {
name: 'Augmented Backus-Naur Form',
illegal: /[!@#$^&',?+~`|:]/,
keywords: KEYWORDS,
contains: [
ASSIGNMENT,
RULE_DECLARATION,
COMMENT,
TERMINAL_BINARY,
TERMINAL_DECIMAL,
TERMINAL_HEXADECIMAL,
CASE_SENSITIVITY,
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE
]
};
}
module.exports = abnf;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/abnf" instead of "highlight.js/lib/languages/abnf.js"'
);
}
}
emitWarning();
module.exports = require('./abnf.js');

265
frontend/node_modules/highlight.js/lib/languages/ada.js generated vendored Normal file
View File

@@ -0,0 +1,265 @@
/*
Language: Ada
Author: Lars Schulna <kartoffelbrei.mit.muskatnuss@gmail.org>
Description: Ada is a general-purpose programming language that has great support for saftey critical and real-time applications.
It has been developed by the DoD and thus has been used in military and safety-critical applications (like civil aviation).
The first version appeared in the 80s, but it's still actively developed today with
the newest standard being Ada2012.
*/
// We try to support full Ada2012
//
// We highlight all appearances of types, keywords, literals (string, char, number, bool)
// and titles (user defined function/procedure/package)
// CSS classes are set accordingly
//
// Languages causing problems for language detection:
// xml (broken by Foo : Bar type), elm (broken by Foo : Bar type), vbscript-html (broken by body keyword)
// sql (ada default.txt has a lot of sql keywords)
/** @type LanguageFn */
function ada(hljs) {
// Regular expression for Ada numeric literals.
// stolen form the VHDL highlighter
// Decimal literal:
const INTEGER_RE = '\\d(_|\\d)*';
const EXPONENT_RE = '[eE][-+]?' + INTEGER_RE;
const DECIMAL_LITERAL_RE = INTEGER_RE + '(\\.' + INTEGER_RE + ')?' + '(' + EXPONENT_RE + ')?';
// Based literal:
const BASED_INTEGER_RE = '\\w+';
const BASED_LITERAL_RE = INTEGER_RE + '#' + BASED_INTEGER_RE + '(\\.' + BASED_INTEGER_RE + ')?' + '#' + '(' + EXPONENT_RE + ')?';
const NUMBER_RE = '\\b(' + BASED_LITERAL_RE + '|' + DECIMAL_LITERAL_RE + ')';
// Identifier regex
const ID_REGEX = '[A-Za-z](_?[A-Za-z0-9.])*';
// bad chars, only allowed in literals
const BAD_CHARS = `[]\\{\\}%#'"`;
// Ada doesn't have block comments, only line comments
const COMMENTS = hljs.COMMENT('--', '$');
// variable declarations of the form
// Foo : Bar := Baz;
// where only Bar will be highlighted
const VAR_DECLS = {
// TODO: These spaces are not required by the Ada syntax
// however, I have yet to see handwritten Ada code where
// someone does not put spaces around :
begin: '\\s+:\\s+',
end: '\\s*(:=|;|\\)|=>|$)',
// endsWithParent: true,
// returnBegin: true,
illegal: BAD_CHARS,
contains: [
{
// workaround to avoid highlighting
// named loops and declare blocks
beginKeywords: 'loop for declare others',
endsParent: true
},
{
// properly highlight all modifiers
className: 'keyword',
beginKeywords: 'not null constant access function procedure in out aliased exception'
},
{
className: 'type',
begin: ID_REGEX,
endsParent: true,
relevance: 0
}
]
};
const KEYWORDS = [
"abort",
"else",
"new",
"return",
"abs",
"elsif",
"not",
"reverse",
"abstract",
"end",
"accept",
"entry",
"select",
"access",
"exception",
"of",
"separate",
"aliased",
"exit",
"or",
"some",
"all",
"others",
"subtype",
"and",
"for",
"out",
"synchronized",
"array",
"function",
"overriding",
"at",
"tagged",
"generic",
"package",
"task",
"begin",
"goto",
"pragma",
"terminate",
"body",
"private",
"then",
"if",
"procedure",
"type",
"case",
"in",
"protected",
"constant",
"interface",
"is",
"raise",
"use",
"declare",
"range",
"delay",
"limited",
"record",
"when",
"delta",
"loop",
"rem",
"while",
"digits",
"renames",
"with",
"do",
"mod",
"requeue",
"xor"
];
return {
name: 'Ada',
case_insensitive: true,
keywords: {
keyword: KEYWORDS,
literal: [
"True",
"False"
]
},
contains: [
COMMENTS,
// strings "foobar"
{
className: 'string',
begin: /"/,
end: /"/,
contains: [
{
begin: /""/,
relevance: 0
}
]
},
// characters ''
{
// character literals always contain one char
className: 'string',
begin: /'.'/
},
{
// number literals
className: 'number',
begin: NUMBER_RE,
relevance: 0
},
{
// Attributes
className: 'symbol',
begin: "'" + ID_REGEX
},
{
// package definition, maybe inside generic
className: 'title',
begin: '(\\bwith\\s+)?(\\bprivate\\s+)?\\bpackage\\s+(\\bbody\\s+)?',
end: '(is|$)',
keywords: 'package body',
excludeBegin: true,
excludeEnd: true,
illegal: BAD_CHARS
},
{
// function/procedure declaration/definition
// maybe inside generic
begin: '(\\b(with|overriding)\\s+)?\\b(function|procedure)\\s+',
end: '(\\bis|\\bwith|\\brenames|\\)\\s*;)',
keywords: 'overriding function procedure with is renames return',
// we need to re-match the 'function' keyword, so that
// the title mode below matches only exactly once
returnBegin: true,
contains:
[
COMMENTS,
{
// name of the function/procedure
className: 'title',
begin: '(\\bwith\\s+)?\\b(function|procedure)\\s+',
end: '(\\(|\\s+|$)',
excludeBegin: true,
excludeEnd: true,
illegal: BAD_CHARS
},
// 'self'
// // parameter types
VAR_DECLS,
{
// return type
className: 'type',
begin: '\\breturn\\s+',
end: '(\\s+|;|$)',
keywords: 'return',
excludeBegin: true,
excludeEnd: true,
// we are done with functions
endsParent: true,
illegal: BAD_CHARS
}
]
},
{
// new type declarations
// maybe inside generic
className: 'type',
begin: '\\b(sub)?type\\s+',
end: '\\s+',
keywords: 'type',
excludeBegin: true,
illegal: BAD_CHARS
},
// see comment above the definition
VAR_DECLS
// no markup
// relevance boosters for small snippets
// {begin: '\\s*=>\\s*'},
// {begin: '\\s*:=\\s*'},
// {begin: '\\s+:=\\s+'},
]
};
}
module.exports = ada;

View File

@@ -0,0 +1,178 @@
/*
Language: AngelScript
Author: Melissa Geels <melissa@nimble.tools>
Category: scripting
Website: https://www.angelcode.com/angelscript/
*/
/** @type LanguageFn */
function angelscript(hljs) {
const builtInTypeMode = {
className: 'built_in',
begin: '\\b(void|bool|int8|int16|int32|int64|int|uint8|uint16|uint32|uint64|uint|string|ref|array|double|float|auto|dictionary)'
};
const objectHandleMode = {
className: 'symbol',
begin: '[a-zA-Z0-9_]+@'
};
const genericMode = {
className: 'keyword',
begin: '<',
end: '>',
contains: [
builtInTypeMode,
objectHandleMode
]
};
builtInTypeMode.contains = [ genericMode ];
objectHandleMode.contains = [ genericMode ];
const KEYWORDS = [
"for",
"in|0",
"break",
"continue",
"while",
"do|0",
"return",
"if",
"else",
"case",
"switch",
"namespace",
"is",
"cast",
"or",
"and",
"xor",
"not",
"get|0",
"in",
"inout|10",
"out",
"override",
"set|0",
"private",
"public",
"const",
"default|0",
"final",
"shared",
"external",
"mixin|10",
"enum",
"typedef",
"funcdef",
"this",
"super",
"import",
"from",
"interface",
"abstract|0",
"try",
"catch",
"protected",
"explicit",
"property"
];
return {
name: 'AngelScript',
aliases: [ 'asc' ],
keywords: KEYWORDS,
// avoid close detection with C# and JS
illegal: '(^using\\s+[A-Za-z0-9_\\.]+;$|\\bfunction\\s*[^\\(])',
contains: [
{ // 'strings'
className: 'string',
begin: '\'',
end: '\'',
illegal: '\\n',
contains: [ hljs.BACKSLASH_ESCAPE ],
relevance: 0
},
// """heredoc strings"""
{
className: 'string',
begin: '"""',
end: '"""'
},
{ // "strings"
className: 'string',
begin: '"',
end: '"',
illegal: '\\n',
contains: [ hljs.BACKSLASH_ESCAPE ],
relevance: 0
},
hljs.C_LINE_COMMENT_MODE, // single-line comments
hljs.C_BLOCK_COMMENT_MODE, // comment blocks
{ // metadata
className: 'string',
begin: '^\\s*\\[',
end: '\\]'
},
{ // interface or namespace declaration
beginKeywords: 'interface namespace',
end: /\{/,
illegal: '[;.\\-]',
contains: [
{ // interface or namespace name
className: 'symbol',
begin: '[a-zA-Z0-9_]+'
}
]
},
{ // class declaration
beginKeywords: 'class',
end: /\{/,
illegal: '[;.\\-]',
contains: [
{ // class name
className: 'symbol',
begin: '[a-zA-Z0-9_]+',
contains: [
{
begin: '[:,]\\s*',
contains: [
{
className: 'symbol',
begin: '[a-zA-Z0-9_]+'
}
]
}
]
}
]
},
builtInTypeMode, // built-in types
objectHandleMode, // object handles
{ // literals
className: 'literal',
begin: '\\b(null|true|false)'
},
{ // numbers
className: 'number',
relevance: 0,
begin: '(-?)(\\b0[xXbBoOdD][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?f?|\\.\\d+f?)([eE][-+]?\\d+f?)?)'
}
]
};
}
module.exports = angelscript;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/apache" instead of "highlight.js/lib/languages/apache.js"'
);
}
}
emitWarning();
module.exports = require('./apache.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/arduino" instead of "highlight.js/lib/languages/arduino.js"'
);
}
}
emitWarning();
module.exports = require('./arduino.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/asciidoc" instead of "highlight.js/lib/languages/asciidoc.js"'
);
}
}
emitWarning();
module.exports = require('./asciidoc.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/aspectj" instead of "highlight.js/lib/languages/aspectj.js"'
);
}
}
emitWarning();
module.exports = require('./aspectj.js');

View File

@@ -0,0 +1,75 @@
/*
Language: AutoHotkey
Author: Seongwon Lee <dlimpid@gmail.com>
Description: AutoHotkey language definition
Category: scripting
*/
/** @type LanguageFn */
function autohotkey(hljs) {
const BACKTICK_ESCAPE = { begin: '`[\\s\\S]' };
return {
name: 'AutoHotkey',
case_insensitive: true,
aliases: [ 'ahk' ],
keywords: {
keyword: 'Break Continue Critical Exit ExitApp Gosub Goto New OnExit Pause return SetBatchLines SetTimer Suspend Thread Throw Until ahk_id ahk_class ahk_pid ahk_exe ahk_group',
literal: 'true false NOT AND OR',
built_in: 'ComSpec Clipboard ClipboardAll ErrorLevel'
},
contains: [
BACKTICK_ESCAPE,
hljs.inherit(hljs.QUOTE_STRING_MODE, { contains: [ BACKTICK_ESCAPE ] }),
hljs.COMMENT(';', '$', { relevance: 0 }),
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'number',
begin: hljs.NUMBER_RE,
relevance: 0
},
{
// subst would be the most accurate however fails the point of
// highlighting. variable is comparably the most accurate that actually
// has some effect
className: 'variable',
begin: '%[a-zA-Z0-9#_$@]+%'
},
{
className: 'built_in',
begin: '^\\s*\\w+\\s*(,|%)'
// I don't really know if this is totally relevant
},
{
// symbol would be most accurate however is highlighted just like
// built_in and that makes up a lot of AutoHotkey code meaning that it
// would fail to highlight anything
className: 'title',
variants: [
{ begin: '^[^\\n";]+::(?!=)' },
{
begin: '^[^\\n";]+:(?!=)',
// zero relevance as it catches a lot of things
// followed by a single ':' in many languages
relevance: 0
}
]
},
{
className: 'meta',
begin: '^\\s*#\\w+',
end: '$',
relevance: 0
},
{
className: 'built_in',
begin: 'A_[a-zA-Z0-9]+'
},
{
// consecutive commas, not for highlighting but just for relevance
begin: ',\\s*,' }
]
};
}
module.exports = autohotkey;

View File

@@ -0,0 +1,78 @@
/*
Language: AVR Assembly
Author: Vladimir Ermakov <vooon341@gmail.com>
Category: assembler
Website: https://www.microchip.com/webdoc/avrassembler/avrassembler.wb_instruction_list.html
*/
/** @type LanguageFn */
function avrasm(hljs) {
return {
name: 'AVR Assembly',
case_insensitive: true,
keywords: {
$pattern: '\\.?' + hljs.IDENT_RE,
keyword:
/* mnemonic */
'adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs '
+ 'brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr '
+ 'clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor '
+ 'fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul '
+ 'muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs '
+ 'sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub '
+ 'subi swap tst wdr',
built_in:
/* general purpose registers */
'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 '
+ 'r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl '
/* IO Registers (ATMega128) */
+ 'ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h '
+ 'tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c '
+ 'ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg '
+ 'ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk '
+ 'tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al '
+ 'ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr '
+ 'porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 '
+ 'ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf',
meta:
'.byte .cseg .db .def .device .dseg .dw .endmacro .equ .eseg .exit .include .list '
+ '.listmac .macro .nolist .org .set'
},
contains: [
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT(
';',
'$',
{ relevance: 0 }
),
hljs.C_NUMBER_MODE, // 0x..., decimal, float
hljs.BINARY_NUMBER_MODE, // 0b...
{
className: 'number',
begin: '\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)' // $..., 0o...
},
hljs.QUOTE_STRING_MODE,
{
className: 'string',
begin: '\'',
end: '[^\\\\]\'',
illegal: '[^\\\\][^\']'
},
{
className: 'symbol',
begin: '^[A-Za-z0-9_.$]+:'
},
{
className: 'meta',
begin: '#',
end: '$'
},
{ // substitution within a macro
className: 'subst',
begin: '@[0-9]+'
}
]
};
}
module.exports = avrasm;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/c" instead of "highlight.js/lib/languages/c.js"'
);
}
}
emitWarning();
module.exports = require('./c.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/cal" instead of "highlight.js/lib/languages/cal.js"'
);
}
}
emitWarning();
module.exports = require('./cal.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/ceylon" instead of "highlight.js/lib/languages/ceylon.js"'
);
}
}
emitWarning();
module.exports = require('./ceylon.js');

View File

@@ -0,0 +1,67 @@
/*
Language: Clean
Author: Camil Staps <info@camilstaps.nl>
Category: functional
Website: http://clean.cs.ru.nl
*/
/** @type LanguageFn */
function clean(hljs) {
const KEYWORDS = [
"if",
"let",
"in",
"with",
"where",
"case",
"of",
"class",
"instance",
"otherwise",
"implementation",
"definition",
"system",
"module",
"from",
"import",
"qualified",
"as",
"special",
"code",
"inline",
"foreign",
"export",
"ccall",
"stdcall",
"generic",
"derive",
"infix",
"infixl",
"infixr"
];
return {
name: 'Clean',
aliases: [
'icl',
'dcl'
],
keywords: {
keyword: KEYWORDS,
built_in:
'Int Real Char Bool',
literal:
'True False'
},
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
{ // relevance booster
begin: '->|<-[|:]?|#!?|>>=|\\{\\||\\|\\}|:==|=:|<>' }
]
};
}
module.exports = clean;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/clean" instead of "highlight.js/lib/languages/clean.js"'
);
}
}
emitWarning();
module.exports = require('./clean.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/clojure-repl" instead of "highlight.js/lib/languages/clojure-repl.js"'
);
}
}
emitWarning();
module.exports = require('./clojure-repl.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/cos" instead of "highlight.js/lib/languages/cos.js"'
);
}
}
emitWarning();
module.exports = require('./cos.js');

605
frontend/node_modules/highlight.js/lib/languages/cpp.js generated vendored Normal file
View File

@@ -0,0 +1,605 @@
/*
Language: C++
Category: common, system
Website: https://isocpp.org
*/
/** @type LanguageFn */
function cpp(hljs) {
const regex = hljs.regex;
// added for historic reasons because `hljs.C_LINE_COMMENT_MODE` does
// not include such support nor can we be sure all the grammars depending
// on it would desire this behavior
const C_LINE_COMMENT_MODE = hljs.COMMENT('//', '$', { contains: [ { begin: /\\\n/ } ] });
const DECLTYPE_AUTO_RE = 'decltype\\(auto\\)';
const NAMESPACE_RE = '[a-zA-Z_]\\w*::';
const TEMPLATE_ARGUMENT_RE = '<[^<>]+>';
const FUNCTION_TYPE_RE = '(?!struct)('
+ DECLTYPE_AUTO_RE + '|'
+ regex.optional(NAMESPACE_RE)
+ '[a-zA-Z_]\\w*' + regex.optional(TEMPLATE_ARGUMENT_RE)
+ ')';
const CPP_PRIMITIVE_TYPES = {
className: 'type',
begin: '\\b[a-z\\d_]*_t\\b'
};
// https://en.cppreference.com/w/cpp/language/escape
// \\ \x \xFF \u2837 \u00323747 \374
const CHARACTER_ESCAPES = '\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)';
const STRINGS = {
className: 'string',
variants: [
{
begin: '(u8?|U|L)?"',
end: '"',
illegal: '\\n',
contains: [ hljs.BACKSLASH_ESCAPE ]
},
{
begin: '(u8?|U|L)?\'(' + CHARACTER_ESCAPES + '|.)',
end: '\'',
illegal: '.'
},
hljs.END_SAME_AS_BEGIN({
begin: /(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,
end: /\)([^()\\ ]{0,16})"/
})
]
};
const NUMBERS = {
className: 'number',
variants: [
// Floating-point literal.
{ begin:
"[+-]?(?:" // Leading sign.
// Decimal.
+ "(?:"
+"[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?"
+ "|\\.[0-9](?:'?[0-9])*"
+ ")(?:[Ee][+-]?[0-9](?:'?[0-9])*)?"
+ "|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*"
// Hexadecimal.
+ "|0[Xx](?:"
+"[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?"
+ "|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*"
+ ")[Pp][+-]?[0-9](?:'?[0-9])*"
+ ")(?:" // Literal suffixes.
+ "[Ff](?:16|32|64|128)?"
+ "|(BF|bf)16"
+ "|[Ll]"
+ "|" // Literal suffix is optional.
+ ")"
},
// Integer literal.
{ begin:
"[+-]?\\b(?:" // Leading sign.
+ "0[Bb][01](?:'?[01])*" // Binary.
+ "|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*" // Hexadecimal.
+ "|0(?:'?[0-7])*" // Octal or just a lone zero.
+ "|[1-9](?:'?[0-9])*" // Decimal.
+ ")(?:" // Literal suffixes.
+ "[Uu](?:LL?|ll?)"
+ "|[Uu][Zz]?"
+ "|(?:LL?|ll?)[Uu]?"
+ "|[Zz][Uu]"
+ "|" // Literal suffix is optional.
+ ")"
// Note: there are user-defined literal suffixes too, but perhaps having the custom suffix not part of the
// literal highlight actually makes it stand out more.
}
],
relevance: 0
};
const PREPROCESSOR = {
className: 'meta',
begin: /#\s*[a-z]+\b/,
end: /$/,
keywords: { keyword:
'if else elif endif define undef warning error line '
+ 'pragma _Pragma ifdef ifndef include' },
contains: [
{
begin: /\\\n/,
relevance: 0
},
hljs.inherit(STRINGS, { className: 'string' }),
{
className: 'string',
begin: /<.*?>/
},
C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
};
const TITLE_MODE = {
className: 'title',
begin: regex.optional(NAMESPACE_RE) + hljs.IDENT_RE,
relevance: 0
};
const FUNCTION_TITLE = regex.optional(NAMESPACE_RE) + hljs.IDENT_RE + '\\s*\\(';
// https://en.cppreference.com/w/cpp/keyword
const RESERVED_KEYWORDS = [
'alignas',
'alignof',
'and',
'and_eq',
'asm',
'atomic_cancel',
'atomic_commit',
'atomic_noexcept',
'auto',
'bitand',
'bitor',
'break',
'case',
'catch',
'class',
'co_await',
'co_return',
'co_yield',
'compl',
'concept',
'const_cast|10',
'consteval',
'constexpr',
'constinit',
'continue',
'decltype',
'default',
'delete',
'do',
'dynamic_cast|10',
'else',
'enum',
'explicit',
'export',
'extern',
'false',
'final',
'for',
'friend',
'goto',
'if',
'import',
'inline',
'module',
'mutable',
'namespace',
'new',
'noexcept',
'not',
'not_eq',
'nullptr',
'operator',
'or',
'or_eq',
'override',
'private',
'protected',
'public',
'reflexpr',
'register',
'reinterpret_cast|10',
'requires',
'return',
'sizeof',
'static_assert',
'static_cast|10',
'struct',
'switch',
'synchronized',
'template',
'this',
'thread_local',
'throw',
'transaction_safe',
'transaction_safe_dynamic',
'true',
'try',
'typedef',
'typeid',
'typename',
'union',
'using',
'virtual',
'volatile',
'while',
'xor',
'xor_eq'
];
// https://en.cppreference.com/w/cpp/keyword
const RESERVED_TYPES = [
'bool',
'char',
'char16_t',
'char32_t',
'char8_t',
'double',
'float',
'int',
'long',
'short',
'void',
'wchar_t',
'unsigned',
'signed',
'const',
'static'
];
const TYPE_HINTS = [
'any',
'auto_ptr',
'barrier',
'binary_semaphore',
'bitset',
'complex',
'condition_variable',
'condition_variable_any',
'counting_semaphore',
'deque',
'false_type',
'flat_map',
'flat_set',
'future',
'imaginary',
'initializer_list',
'istringstream',
'jthread',
'latch',
'lock_guard',
'multimap',
'multiset',
'mutex',
'optional',
'ostringstream',
'packaged_task',
'pair',
'promise',
'priority_queue',
'queue',
'recursive_mutex',
'recursive_timed_mutex',
'scoped_lock',
'set',
'shared_future',
'shared_lock',
'shared_mutex',
'shared_timed_mutex',
'shared_ptr',
'stack',
'string_view',
'stringstream',
'timed_mutex',
'thread',
'true_type',
'tuple',
'unique_lock',
'unique_ptr',
'unordered_map',
'unordered_multimap',
'unordered_multiset',
'unordered_set',
'variant',
'vector',
'weak_ptr',
'wstring',
'wstring_view'
];
const FUNCTION_HINTS = [
'abort',
'abs',
'acos',
'apply',
'as_const',
'asin',
'atan',
'atan2',
'calloc',
'ceil',
'cerr',
'cin',
'clog',
'cos',
'cosh',
'cout',
'declval',
'endl',
'exchange',
'exit',
'exp',
'fabs',
'floor',
'fmod',
'forward',
'fprintf',
'fputs',
'free',
'frexp',
'fscanf',
'future',
'invoke',
'isalnum',
'isalpha',
'iscntrl',
'isdigit',
'isgraph',
'islower',
'isprint',
'ispunct',
'isspace',
'isupper',
'isxdigit',
'labs',
'launder',
'ldexp',
'log',
'log10',
'make_pair',
'make_shared',
'make_shared_for_overwrite',
'make_tuple',
'make_unique',
'malloc',
'memchr',
'memcmp',
'memcpy',
'memset',
'modf',
'move',
'pow',
'printf',
'putchar',
'puts',
'realloc',
'scanf',
'sin',
'sinh',
'snprintf',
'sprintf',
'sqrt',
'sscanf',
'std',
'stderr',
'stdin',
'stdout',
'strcat',
'strchr',
'strcmp',
'strcpy',
'strcspn',
'strlen',
'strncat',
'strncmp',
'strncpy',
'strpbrk',
'strrchr',
'strspn',
'strstr',
'swap',
'tan',
'tanh',
'terminate',
'to_underlying',
'tolower',
'toupper',
'vfprintf',
'visit',
'vprintf',
'vsprintf'
];
const LITERALS = [
'NULL',
'false',
'nullopt',
'nullptr',
'true'
];
// https://en.cppreference.com/w/cpp/keyword
const BUILT_IN = [ '_Pragma' ];
const CPP_KEYWORDS = {
type: RESERVED_TYPES,
keyword: RESERVED_KEYWORDS,
literal: LITERALS,
built_in: BUILT_IN,
_type_hints: TYPE_HINTS
};
const FUNCTION_DISPATCH = {
className: 'function.dispatch',
relevance: 0,
keywords: {
// Only for relevance, not highlighting.
_hint: FUNCTION_HINTS },
begin: regex.concat(
/\b/,
/(?!decltype)/,
/(?!if)/,
/(?!for)/,
/(?!switch)/,
/(?!while)/,
hljs.IDENT_RE,
regex.lookahead(/(<[^<>]+>|)\s*\(/))
};
const EXPRESSION_CONTAINS = [
FUNCTION_DISPATCH,
PREPROCESSOR,
CPP_PRIMITIVE_TYPES,
C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
NUMBERS,
STRINGS
];
const EXPRESSION_CONTEXT = {
// This mode covers expression context where we can't expect a function
// definition and shouldn't highlight anything that looks like one:
// `return some()`, `else if()`, `(x*sum(1, 2))`
variants: [
{
begin: /=/,
end: /;/
},
{
begin: /\(/,
end: /\)/
},
{
beginKeywords: 'new throw return else',
end: /;/
}
],
keywords: CPP_KEYWORDS,
contains: EXPRESSION_CONTAINS.concat([
{
begin: /\(/,
end: /\)/,
keywords: CPP_KEYWORDS,
contains: EXPRESSION_CONTAINS.concat([ 'self' ]),
relevance: 0
}
]),
relevance: 0
};
const FUNCTION_DECLARATION = {
className: 'function',
begin: '(' + FUNCTION_TYPE_RE + '[\\*&\\s]+)+' + FUNCTION_TITLE,
returnBegin: true,
end: /[{;=]/,
excludeEnd: true,
keywords: CPP_KEYWORDS,
illegal: /[^\w\s\*&:<>.]/,
contains: [
{ // to prevent it from being confused as the function title
begin: DECLTYPE_AUTO_RE,
keywords: CPP_KEYWORDS,
relevance: 0
},
{
begin: FUNCTION_TITLE,
returnBegin: true,
contains: [ TITLE_MODE ],
relevance: 0
},
// needed because we do not have look-behind on the below rule
// to prevent it from grabbing the final : in a :: pair
{
begin: /::/,
relevance: 0
},
// initializers
{
begin: /:/,
endsWithParent: true,
contains: [
STRINGS,
NUMBERS
]
},
// allow for multiple declarations, e.g.:
// extern void f(int), g(char);
{
relevance: 0,
match: /,/
},
{
className: 'params',
begin: /\(/,
end: /\)/,
keywords: CPP_KEYWORDS,
relevance: 0,
contains: [
C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
STRINGS,
NUMBERS,
CPP_PRIMITIVE_TYPES,
// Count matching parentheses.
{
begin: /\(/,
end: /\)/,
keywords: CPP_KEYWORDS,
relevance: 0,
contains: [
'self',
C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
STRINGS,
NUMBERS,
CPP_PRIMITIVE_TYPES
]
}
]
},
CPP_PRIMITIVE_TYPES,
C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
PREPROCESSOR
]
};
return {
name: 'C++',
aliases: [
'cc',
'c++',
'h++',
'hpp',
'hh',
'hxx',
'cxx'
],
keywords: CPP_KEYWORDS,
illegal: '</',
classNameAliases: { 'function.dispatch': 'built_in' },
contains: [].concat(
EXPRESSION_CONTEXT,
FUNCTION_DECLARATION,
FUNCTION_DISPATCH,
EXPRESSION_CONTAINS,
[
PREPROCESSOR,
{ // 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|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)',
end: '>',
keywords: CPP_KEYWORDS,
contains: [
'self',
CPP_PRIMITIVE_TYPES
]
},
{
begin: hljs.IDENT_RE + '::',
keywords: CPP_KEYWORDS
},
{
match: [
// extra complexity to deal with `enum class` and `enum struct`
/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,
/\s+/,
/\w+/
],
className: {
1: 'keyword',
3: 'title.class'
}
}
])
};
}
module.exports = cpp;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/cpp" instead of "highlight.js/lib/languages/cpp.js"'
);
}
}
emitWarning();
module.exports = require('./cpp.js');

View File

@@ -0,0 +1,312 @@
/*
Language: Crystal
Author: TSUYUSATO Kitsune <make.just.on@gmail.com>
Website: https://crystal-lang.org
Category: system
*/
/** @type LanguageFn */
function crystal(hljs) {
const INT_SUFFIX = '(_?[ui](8|16|32|64|128))?';
const FLOAT_SUFFIX = '(_?f(32|64))?';
const CRYSTAL_IDENT_RE = '[a-zA-Z_]\\w*[!?=]?';
const CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|[=!]~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~|]|//|//=|&[-+*]=?|&\\*\\*|\\[\\][=?]?';
const CRYSTAL_PATH_RE = '[A-Za-z_]\\w*(::\\w+)*(\\?|!)?';
const CRYSTAL_KEYWORDS = {
$pattern: CRYSTAL_IDENT_RE,
keyword:
'abstract alias annotation as as? asm begin break case class def do else elsif end ensure enum extend for fun if '
+ 'include instance_sizeof is_a? lib macro module next nil? of out pointerof private protected rescue responds_to? '
+ 'return require select self sizeof struct super then type typeof union uninitialized unless until verbatim when while with yield '
+ '__DIR__ __END_LINE__ __FILE__ __LINE__',
literal: 'false nil true'
};
const SUBST = {
className: 'subst',
begin: /#\{/,
end: /\}/,
keywords: CRYSTAL_KEYWORDS
};
// borrowed from Ruby
const VARIABLE = {
// negative-look forward attemps to prevent false matches like:
// @ident@ or $ident$ that might indicate this is not ruby at all
className: "variable",
begin: '(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])' + `(?![A-Za-z])(?![@$?'])`
};
const EXPANSION = {
className: 'template-variable',
variants: [
{
begin: '\\{\\{',
end: '\\}\\}'
},
{
begin: '\\{%',
end: '%\\}'
}
],
keywords: CRYSTAL_KEYWORDS
};
function recursiveParen(begin, end) {
const
contains = [
{
begin: begin,
end: end
}
];
contains[0].contains = contains;
return contains;
}
const STRING = {
className: 'string',
contains: [
hljs.BACKSLASH_ESCAPE,
SUBST
],
variants: [
{
begin: /'/,
end: /'/
},
{
begin: /"/,
end: /"/
},
{
begin: /`/,
end: /`/
},
{
begin: '%[Qwi]?\\(',
end: '\\)',
contains: recursiveParen('\\(', '\\)')
},
{
begin: '%[Qwi]?\\[',
end: '\\]',
contains: recursiveParen('\\[', '\\]')
},
{
begin: '%[Qwi]?\\{',
end: /\}/,
contains: recursiveParen(/\{/, /\}/)
},
{
begin: '%[Qwi]?<',
end: '>',
contains: recursiveParen('<', '>')
},
{
begin: '%[Qwi]?\\|',
end: '\\|'
},
{
begin: /<<-\w+$/,
end: /^\s*\w+$/
}
],
relevance: 0
};
const Q_STRING = {
className: 'string',
variants: [
{
begin: '%q\\(',
end: '\\)',
contains: recursiveParen('\\(', '\\)')
},
{
begin: '%q\\[',
end: '\\]',
contains: recursiveParen('\\[', '\\]')
},
{
begin: '%q\\{',
end: /\}/,
contains: recursiveParen(/\{/, /\}/)
},
{
begin: '%q<',
end: '>',
contains: recursiveParen('<', '>')
},
{
begin: '%q\\|',
end: '\\|'
},
{
begin: /<<-'\w+'$/,
end: /^\s*\w+$/
}
],
relevance: 0
};
const REGEXP = {
begin: '(?!%\\})(' + hljs.RE_STARTERS_RE + '|\\n|\\b(case|if|select|unless|until|when|while)\\b)\\s*',
keywords: 'case if select unless until when while',
contains: [
{
className: 'regexp',
contains: [
hljs.BACKSLASH_ESCAPE,
SUBST
],
variants: [
{
begin: '//[a-z]*',
relevance: 0
},
{
begin: '/(?!\\/)',
end: '/[a-z]*'
}
]
}
],
relevance: 0
};
const REGEXP2 = {
className: 'regexp',
contains: [
hljs.BACKSLASH_ESCAPE,
SUBST
],
variants: [
{
begin: '%r\\(',
end: '\\)',
contains: recursiveParen('\\(', '\\)')
},
{
begin: '%r\\[',
end: '\\]',
contains: recursiveParen('\\[', '\\]')
},
{
begin: '%r\\{',
end: /\}/,
contains: recursiveParen(/\{/, /\}/)
},
{
begin: '%r<',
end: '>',
contains: recursiveParen('<', '>')
},
{
begin: '%r\\|',
end: '\\|'
}
],
relevance: 0
};
const ATTRIBUTE = {
className: 'meta',
begin: '@\\[',
end: '\\]',
contains: [ hljs.inherit(hljs.QUOTE_STRING_MODE, { className: 'string' }) ]
};
const CRYSTAL_DEFAULT_CONTAINS = [
EXPANSION,
STRING,
Q_STRING,
REGEXP2,
REGEXP,
ATTRIBUTE,
VARIABLE,
hljs.HASH_COMMENT_MODE,
{
className: 'class',
beginKeywords: 'class module struct',
end: '$|;',
illegal: /=/,
contains: [
hljs.HASH_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, { begin: CRYSTAL_PATH_RE }),
{ // relevance booster for inheritance
begin: '<' }
]
},
{
className: 'class',
beginKeywords: 'lib enum union',
end: '$|;',
illegal: /=/,
contains: [
hljs.HASH_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, { begin: CRYSTAL_PATH_RE })
]
},
{
beginKeywords: 'annotation',
end: '$|;',
illegal: /=/,
contains: [
hljs.HASH_COMMENT_MODE,
hljs.inherit(hljs.TITLE_MODE, { begin: CRYSTAL_PATH_RE })
],
relevance: 2
},
{
className: 'function',
beginKeywords: 'def',
end: /\B\b/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
begin: CRYSTAL_METHOD_RE,
endsParent: true
})
]
},
{
className: 'function',
beginKeywords: 'fun macro',
end: /\B\b/,
contains: [
hljs.inherit(hljs.TITLE_MODE, {
begin: CRYSTAL_METHOD_RE,
endsParent: true
})
],
relevance: 2
},
{
className: 'symbol',
begin: hljs.UNDERSCORE_IDENT_RE + '(!|\\?)?:',
relevance: 0
},
{
className: 'symbol',
begin: ':',
contains: [
STRING,
{ begin: CRYSTAL_METHOD_RE }
],
relevance: 0
},
{
className: 'number',
variants: [
{ begin: '\\b0b([01_]+)' + INT_SUFFIX },
{ begin: '\\b0o([0-7_]+)' + INT_SUFFIX },
{ begin: '\\b0x([A-Fa-f0-9_]+)' + INT_SUFFIX },
{ begin: '\\b([1-9][0-9_]*[0-9]|[0-9])(\\.[0-9][0-9_]*)?([eE]_?[-+]?[0-9_]*)?' + FLOAT_SUFFIX + '(?!_)' },
{ begin: '\\b([1-9][0-9_]*|0)' + INT_SUFFIX }
],
relevance: 0
}
];
SUBST.contains = CRYSTAL_DEFAULT_CONTAINS;
EXPANSION.contains = CRYSTAL_DEFAULT_CONTAINS.slice(1); // without EXPANSION
return {
name: 'Crystal',
aliases: [ 'cr' ],
keywords: CRYSTAL_KEYWORDS,
contains: CRYSTAL_DEFAULT_CONTAINS
};
}
module.exports = crystal;

View File

@@ -0,0 +1,58 @@
/*
Language: CSP
Description: Content Security Policy definition highlighting
Author: Taras <oxdef@oxdef.info>
Website: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
Category: web
vim: ts=2 sw=2 st=2
*/
/** @type LanguageFn */
function csp(hljs) {
const KEYWORDS = [
"base-uri",
"child-src",
"connect-src",
"default-src",
"font-src",
"form-action",
"frame-ancestors",
"frame-src",
"img-src",
"manifest-src",
"media-src",
"object-src",
"plugin-types",
"report-uri",
"sandbox",
"script-src",
"style-src",
"trusted-types",
"unsafe-hashes",
"worker-src"
];
return {
name: 'CSP',
case_insensitive: false,
keywords: {
$pattern: '[a-zA-Z][a-zA-Z0-9_-]*',
keyword: KEYWORDS
},
contains: [
{
className: 'string',
begin: "'",
end: "'"
},
{
className: 'attribute',
begin: '^Content',
end: ':',
excludeEnd: true
}
]
};
}
module.exports = csp;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/csp" instead of "highlight.js/lib/languages/csp.js"'
);
}
}
emitWarning();
module.exports = require('./csp.js');

272
frontend/node_modules/highlight.js/lib/languages/d.js generated vendored Normal file
View File

@@ -0,0 +1,272 @@
/*
Language: D
Author: Aleksandar Ruzicic <aleksandar@ruzicic.info>
Description: D is a language with C-like syntax and static typing. It pragmatically combines efficiency, control, and modeling power, with safety and programmer productivity.
Version: 1.0a
Website: https://dlang.org
Category: system
Date: 2012-04-08
*/
/**
* Known issues:
*
* - invalid hex string literals will be recognized as a double quoted strings
* but 'x' at the beginning of string will not be matched
*
* - delimited string literals are not checked for matching end delimiter
* (not possible to do with js regexp)
*
* - content of token string is colored as a string (i.e. no keyword coloring inside a token string)
* also, content of token string is not validated to contain only valid D tokens
*
* - special token sequence rule is not strictly following D grammar (anything following #line
* up to the end of line is matched as special token sequence)
*/
/** @type LanguageFn */
function d(hljs) {
/**
* Language keywords
*
* @type {Object}
*/
const D_KEYWORDS = {
$pattern: hljs.UNDERSCORE_IDENT_RE,
keyword:
'abstract alias align asm assert auto body break byte case cast catch class '
+ 'const continue debug default delete deprecated do else enum export extern final '
+ 'finally for foreach foreach_reverse|10 goto if immutable import in inout int '
+ 'interface invariant is lazy macro mixin module new nothrow out override package '
+ 'pragma private protected public pure ref return scope shared static struct '
+ 'super switch synchronized template this throw try typedef typeid typeof union '
+ 'unittest version void volatile while with __FILE__ __LINE__ __gshared|10 '
+ '__thread __traits __DATE__ __EOF__ __TIME__ __TIMESTAMP__ __VENDOR__ __VERSION__',
built_in:
'bool cdouble cent cfloat char creal dchar delegate double dstring float function '
+ 'idouble ifloat ireal long real short string ubyte ucent uint ulong ushort wchar '
+ 'wstring',
literal:
'false null true'
};
/**
* Number literal regexps
*
* @type {String}
*/
const decimal_integer_re = '(0|[1-9][\\d_]*)';
const decimal_integer_nosus_re = '(0|[1-9][\\d_]*|\\d[\\d_]*|[\\d_]+?\\d)';
const binary_integer_re = '0[bB][01_]+';
const hexadecimal_digits_re = '([\\da-fA-F][\\da-fA-F_]*|_[\\da-fA-F][\\da-fA-F_]*)';
const hexadecimal_integer_re = '0[xX]' + hexadecimal_digits_re;
const decimal_exponent_re = '([eE][+-]?' + decimal_integer_nosus_re + ')';
const decimal_float_re = '(' + decimal_integer_nosus_re + '(\\.\\d*|' + decimal_exponent_re + ')|'
+ '\\d+\\.' + decimal_integer_nosus_re + '|'
+ '\\.' + decimal_integer_re + decimal_exponent_re + '?'
+ ')';
const hexadecimal_float_re = '(0[xX]('
+ hexadecimal_digits_re + '\\.' + hexadecimal_digits_re + '|'
+ '\\.?' + hexadecimal_digits_re
+ ')[pP][+-]?' + decimal_integer_nosus_re + ')';
const integer_re = '('
+ decimal_integer_re + '|'
+ binary_integer_re + '|'
+ hexadecimal_integer_re
+ ')';
const float_re = '('
+ hexadecimal_float_re + '|'
+ decimal_float_re
+ ')';
/**
* Escape sequence supported in D string and character literals
*
* @type {String}
*/
const escape_sequence_re = '\\\\('
+ '[\'"\\?\\\\abfnrtv]|' // common escapes
+ 'u[\\dA-Fa-f]{4}|' // four hex digit unicode codepoint
+ '[0-7]{1,3}|' // one to three octal digit ascii char code
+ 'x[\\dA-Fa-f]{2}|' // two hex digit ascii char code
+ 'U[\\dA-Fa-f]{8}' // eight hex digit unicode codepoint
+ ')|'
+ '&[a-zA-Z\\d]{2,};'; // named character entity
/**
* D integer number literals
*
* @type {Object}
*/
const D_INTEGER_MODE = {
className: 'number',
begin: '\\b' + integer_re + '(L|u|U|Lu|LU|uL|UL)?',
relevance: 0
};
/**
* [D_FLOAT_MODE description]
* @type {Object}
*/
const D_FLOAT_MODE = {
className: 'number',
begin: '\\b('
+ float_re + '([fF]|L|i|[fF]i|Li)?|'
+ integer_re + '(i|[fF]i|Li)'
+ ')',
relevance: 0
};
/**
* D character literal
*
* @type {Object}
*/
const D_CHARACTER_MODE = {
className: 'string',
begin: '\'(' + escape_sequence_re + '|.)',
end: '\'',
illegal: '.'
};
/**
* D string escape sequence
*
* @type {Object}
*/
const D_ESCAPE_SEQUENCE = {
begin: escape_sequence_re,
relevance: 0
};
/**
* D double quoted string literal
*
* @type {Object}
*/
const D_STRING_MODE = {
className: 'string',
begin: '"',
contains: [ D_ESCAPE_SEQUENCE ],
end: '"[cwd]?'
};
/**
* D wysiwyg and delimited string literals
*
* @type {Object}
*/
const D_WYSIWYG_DELIMITED_STRING_MODE = {
className: 'string',
begin: '[rq]"',
end: '"[cwd]?',
relevance: 5
};
/**
* D alternate wysiwyg string literal
*
* @type {Object}
*/
const D_ALTERNATE_WYSIWYG_STRING_MODE = {
className: 'string',
begin: '`',
end: '`[cwd]?'
};
/**
* D hexadecimal string literal
*
* @type {Object}
*/
const D_HEX_STRING_MODE = {
className: 'string',
begin: 'x"[\\da-fA-F\\s\\n\\r]*"[cwd]?',
relevance: 10
};
/**
* D delimited string literal
*
* @type {Object}
*/
const D_TOKEN_STRING_MODE = {
className: 'string',
begin: 'q"\\{',
end: '\\}"'
};
/**
* Hashbang support
*
* @type {Object}
*/
const D_HASHBANG_MODE = {
className: 'meta',
begin: '^#!',
end: '$',
relevance: 5
};
/**
* D special token sequence
*
* @type {Object}
*/
const D_SPECIAL_TOKEN_SEQUENCE_MODE = {
className: 'meta',
begin: '#(line)',
end: '$',
relevance: 5
};
/**
* D attributes
*
* @type {Object}
*/
const D_ATTRIBUTE_MODE = {
className: 'keyword',
begin: '@[a-zA-Z_][a-zA-Z_\\d]*'
};
/**
* D nesting comment
*
* @type {Object}
*/
const D_NESTING_COMMENT_MODE = hljs.COMMENT(
'\\/\\+',
'\\+\\/',
{
contains: [ 'self' ],
relevance: 10
}
);
return {
name: 'D',
keywords: D_KEYWORDS,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
D_NESTING_COMMENT_MODE,
D_HEX_STRING_MODE,
D_STRING_MODE,
D_WYSIWYG_DELIMITED_STRING_MODE,
D_ALTERNATE_WYSIWYG_STRING_MODE,
D_TOKEN_STRING_MODE,
D_FLOAT_MODE,
D_INTEGER_MODE,
D_CHARACTER_MODE,
D_HASHBANG_MODE,
D_SPECIAL_TOKEN_SEQUENCE_MODE,
D_ATTRIBUTE_MODE
]
};
}
module.exports = d;

View File

@@ -0,0 +1,246 @@
/*
Language: Delphi
Website: https://www.embarcadero.com/products/delphi
Category: system
*/
/** @type LanguageFn */
function delphi(hljs) {
const KEYWORDS = [
"exports",
"register",
"file",
"shl",
"array",
"record",
"property",
"for",
"mod",
"while",
"set",
"ally",
"label",
"uses",
"raise",
"not",
"stored",
"class",
"safecall",
"var",
"interface",
"or",
"private",
"static",
"exit",
"index",
"inherited",
"to",
"else",
"stdcall",
"override",
"shr",
"asm",
"far",
"resourcestring",
"finalization",
"packed",
"virtual",
"out",
"and",
"protected",
"library",
"do",
"xorwrite",
"goto",
"near",
"function",
"end",
"div",
"overload",
"object",
"unit",
"begin",
"string",
"on",
"inline",
"repeat",
"until",
"destructor",
"write",
"message",
"program",
"with",
"read",
"initialization",
"except",
"default",
"nil",
"if",
"case",
"cdecl",
"in",
"downto",
"threadvar",
"of",
"try",
"pascal",
"const",
"external",
"constructor",
"type",
"public",
"then",
"implementation",
"finally",
"published",
"procedure",
"absolute",
"reintroduce",
"operator",
"as",
"is",
"abstract",
"alias",
"assembler",
"bitpacked",
"break",
"continue",
"cppdecl",
"cvar",
"enumerator",
"experimental",
"platform",
"deprecated",
"unimplemented",
"dynamic",
"export",
"far16",
"forward",
"generic",
"helper",
"implements",
"interrupt",
"iochecks",
"local",
"name",
"nodefault",
"noreturn",
"nostackframe",
"oldfpccall",
"otherwise",
"saveregisters",
"softfloat",
"specialize",
"strict",
"unaligned",
"varargs"
];
const COMMENT_MODES = [
hljs.C_LINE_COMMENT_MODE,
hljs.COMMENT(/\{/, /\}/, { relevance: 0 }),
hljs.COMMENT(/\(\*/, /\*\)/, { relevance: 10 })
];
const DIRECTIVE = {
className: 'meta',
variants: [
{
begin: /\{\$/,
end: /\}/
},
{
begin: /\(\*\$/,
end: /\*\)/
}
]
};
const STRING = {
className: 'string',
begin: /'/,
end: /'/,
contains: [ { begin: /''/ } ]
};
const NUMBER = {
className: 'number',
relevance: 0,
// Source: https://www.freepascal.org/docs-html/ref/refse6.html
variants: [
{
// Regular numbers, e.g., 123, 123.456.
match: /\b\d[\d_]*(\.\d[\d_]*)?/ },
{
// Hexadecimal notation, e.g., $7F.
match: /\$[\dA-Fa-f_]+/ },
{
// Hexadecimal literal with no digits
match: /\$/,
relevance: 0 },
{
// Octal notation, e.g., &42.
match: /&[0-7][0-7_]*/ },
{
// Binary notation, e.g., %1010.
match: /%[01_]+/ },
{
// Binary literal with no digits
match: /%/,
relevance: 0 }
]
};
const CHAR_STRING = {
className: 'string',
variants: [
{ match: /#\d[\d_]*/ },
{ match: /#\$[\dA-Fa-f][\dA-Fa-f_]*/ },
{ match: /#&[0-7][0-7_]*/ },
{ match: /#%[01][01_]*/ }
]
};
const CLASS = {
begin: hljs.IDENT_RE + '\\s*=\\s*class\\s*\\(',
returnBegin: true,
contains: [ hljs.TITLE_MODE ]
};
const FUNCTION = {
className: 'function',
beginKeywords: 'function constructor destructor procedure',
end: /[:;]/,
keywords: 'function constructor|10 destructor|10 procedure|10',
contains: [
hljs.TITLE_MODE,
{
className: 'params',
begin: /\(/,
end: /\)/,
keywords: KEYWORDS,
contains: [
STRING,
CHAR_STRING,
DIRECTIVE
].concat(COMMENT_MODES)
},
DIRECTIVE
].concat(COMMENT_MODES)
};
return {
name: 'Delphi',
aliases: [
'dpr',
'dfm',
'pas',
'pascal'
],
case_insensitive: true,
keywords: KEYWORDS,
illegal: /"|\$[G-Zg-z]|\/\*|<\/|\|/,
contains: [
STRING,
CHAR_STRING,
NUMBER,
CLASS,
FUNCTION,
DIRECTIVE
].concat(COMMENT_MODES)
};
}
module.exports = delphi;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/diff" instead of "highlight.js/lib/languages/diff.js"'
);
}
}
emitWarning();
module.exports = require('./diff.js');

View File

@@ -0,0 +1,75 @@
/*
Language: Django
Description: Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Requires: xml.js
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
Contributors: Ilya Baryshev <baryshev@gmail.com>
Website: https://www.djangoproject.com
Category: template
*/
/** @type LanguageFn */
function django(hljs) {
const FILTER = {
begin: /\|[A-Za-z]+:?/,
keywords: { name:
'truncatewords removetags linebreaksbr yesno get_digit timesince random striptags '
+ 'filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands '
+ 'title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode '
+ 'timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort '
+ 'dictsortreversed default_if_none pluralize lower join center default '
+ 'truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first '
+ 'escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize '
+ 'localtime utc timezone' },
contains: [
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE
]
};
return {
name: 'Django',
aliases: [ 'jinja' ],
case_insensitive: true,
subLanguage: 'xml',
contains: [
hljs.COMMENT(/\{%\s*comment\s*%\}/, /\{%\s*endcomment\s*%\}/),
hljs.COMMENT(/\{#/, /#\}/),
{
className: 'template-tag',
begin: /\{%/,
end: /%\}/,
contains: [
{
className: 'name',
begin: /\w+/,
keywords: { name:
'comment endcomment load templatetag ifchanged endifchanged if endif firstof for '
+ 'endfor ifnotequal endifnotequal widthratio extends include spaceless '
+ 'endspaceless regroup ifequal endifequal ssi now with cycle url filter '
+ 'endfilter debug block endblock else autoescape endautoescape csrf_token empty elif '
+ 'endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix '
+ 'plural get_current_language language get_available_languages '
+ 'get_current_language_bidi get_language_info get_language_info_list localize '
+ 'endlocalize localtime endlocaltime timezone endtimezone get_current_timezone '
+ 'verbatim' },
starts: {
endsWithParent: true,
keywords: 'in by as',
contains: [ FILTER ],
relevance: 0
}
}
]
},
{
className: 'template-variable',
begin: /\{\{/,
end: /\}\}/,
contains: [ FILTER ]
}
]
};
}
module.exports = django;

167
frontend/node_modules/highlight.js/lib/languages/dos.js generated vendored Normal file
View File

@@ -0,0 +1,167 @@
/*
Language: Batch file (DOS)
Author: Alexander Makarov <sam@rmcreative.ru>
Contributors: Anton Kochkov <anton.kochkov@gmail.com>
Website: https://en.wikipedia.org/wiki/Batch_file
Category: scripting
*/
/** @type LanguageFn */
function dos(hljs) {
const COMMENT = hljs.COMMENT(
/^\s*@?rem\b/, /$/,
{ relevance: 10 }
);
const LABEL = {
className: 'symbol',
begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)',
relevance: 0
};
const KEYWORDS = [
"if",
"else",
"goto",
"for",
"in",
"do",
"call",
"exit",
"not",
"exist",
"errorlevel",
"defined",
"equ",
"neq",
"lss",
"leq",
"gtr",
"geq"
];
const BUILT_INS = [
"prn",
"nul",
"lpt3",
"lpt2",
"lpt1",
"con",
"com4",
"com3",
"com2",
"com1",
"aux",
"shift",
"cd",
"dir",
"echo",
"setlocal",
"endlocal",
"set",
"pause",
"copy",
"append",
"assoc",
"at",
"attrib",
"break",
"cacls",
"cd",
"chcp",
"chdir",
"chkdsk",
"chkntfs",
"cls",
"cmd",
"color",
"comp",
"compact",
"convert",
"date",
"dir",
"diskcomp",
"diskcopy",
"doskey",
"erase",
"fs",
"find",
"findstr",
"format",
"ftype",
"graftabl",
"help",
"keyb",
"label",
"md",
"mkdir",
"mode",
"more",
"move",
"path",
"pause",
"print",
"popd",
"pushd",
"promt",
"rd",
"recover",
"rem",
"rename",
"replace",
"restore",
"rmdir",
"shift",
"sort",
"start",
"subst",
"time",
"title",
"tree",
"type",
"ver",
"verify",
"vol",
// winutils
"ping",
"net",
"ipconfig",
"taskkill",
"xcopy",
"ren",
"del"
];
return {
name: 'Batch file (DOS)',
aliases: [
'bat',
'cmd'
],
case_insensitive: true,
illegal: /\/\*/,
keywords: {
keyword: KEYWORDS,
built_in: BUILT_INS
},
contains: [
{
className: 'variable',
begin: /%%[^ ]|%[^ ]+?%|![^ ]+?!/
},
{
className: 'function',
begin: LABEL.begin,
end: 'goto:eof',
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*' }),
COMMENT
]
},
{
className: 'number',
begin: '\\b\\d+',
relevance: 0
},
COMMENT
]
};
}
module.exports = dos;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/dsconfig" instead of "highlight.js/lib/languages/dsconfig.js"'
);
}
}
emitWarning();
module.exports = require('./dsconfig.js');

View File

@@ -0,0 +1,54 @@
/*
Language: Extended Backus-Naur Form
Author: Alex McKibben <alex@nullscope.net>
Website: https://en.wikipedia.org/wiki/Extended_BackusNaur_form
Category: syntax
*/
/** @type LanguageFn */
function ebnf(hljs) {
const commentMode = hljs.COMMENT(/\(\*/, /\*\)/);
const nonTerminalMode = {
className: "attribute",
begin: /^[ ]*[a-zA-Z]+([\s_-]+[a-zA-Z]+)*/
};
const specialSequenceMode = {
className: "meta",
begin: /\?.*\?/
};
const ruleBodyMode = {
begin: /=/,
end: /[.;]/,
contains: [
commentMode,
specialSequenceMode,
{
// terminals
className: 'string',
variants: [
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{
begin: '`',
end: '`'
}
]
}
]
};
return {
name: 'Extended Backus-Naur Form',
illegal: /\S/,
contains: [
commentMode,
nonTerminalMode,
ruleBodyMode
]
};
}
module.exports = ebnf;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/ebnf" instead of "highlight.js/lib/languages/ebnf.js"'
);
}
}
emitWarning();
module.exports = require('./ebnf.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/elixir" instead of "highlight.js/lib/languages/elixir.js"'
);
}
}
emitWarning();
module.exports = require('./elixir.js');

View File

@@ -0,0 +1,29 @@
/*
Language: ERB (Embedded Ruby)
Requires: xml.js, ruby.js
Author: Lucas Mazza <lucastmazza@gmail.com>
Contributors: Kassio Borges <kassioborgesm@gmail.com>
Description: "Bridge" language defining fragments of Ruby in HTML within <% .. %>
Website: https://ruby-doc.org/stdlib-2.6.5/libdoc/erb/rdoc/ERB.html
Category: template
*/
/** @type LanguageFn */
function erb(hljs) {
return {
name: 'ERB',
subLanguage: 'xml',
contains: [
hljs.COMMENT('<%#', '%>'),
{
begin: '<%[%=-]?',
end: '[%-]?%>',
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true
}
]
};
}
module.exports = erb;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/excel" instead of "highlight.js/lib/languages/excel.js"'
);
}
}
emitWarning();
module.exports = require('./excel.js');

View File

@@ -0,0 +1,39 @@
/*
Language: FIX
Author: Brent Bradbury <brent@brentium.com>
*/
/** @type LanguageFn */
function fix(hljs) {
return {
name: 'FIX',
contains: [
{
begin: /[^\u2401\u0001]+/,
end: /[\u2401\u0001]/,
excludeEnd: true,
returnBegin: true,
returnEnd: false,
contains: [
{
begin: /([^\u2401\u0001=]+)/,
end: /=([^\u2401\u0001=]+)/,
returnEnd: true,
returnBegin: false,
className: 'attr'
},
{
begin: /=/,
end: /([\u2401\u0001])/,
excludeEnd: true,
excludeBegin: true,
className: 'string'
}
]
}
],
case_insensitive: true
};
}
module.exports = fix;

View File

@@ -0,0 +1,79 @@
/*
Language: Flix
Category: functional
Author: Magnus Madsen <mmadsen@uwaterloo.ca>
Website: https://flix.dev/
*/
/** @type LanguageFn */
function flix(hljs) {
const CHAR = {
className: 'string',
begin: /'(.|\\[xXuU][a-zA-Z0-9]+)'/
};
const STRING = {
className: 'string',
variants: [
{
begin: '"',
end: '"'
}
]
};
const NAME = {
className: 'title',
relevance: 0,
begin: /[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/
};
const METHOD = {
className: 'function',
beginKeywords: 'def',
end: /[:={\[(\n;]/,
excludeEnd: true,
contains: [ NAME ]
};
return {
name: 'Flix',
keywords: {
keyword: [
"case",
"class",
"def",
"else",
"enum",
"if",
"impl",
"import",
"in",
"lat",
"rel",
"index",
"let",
"match",
"namespace",
"switch",
"type",
"yield",
"with"
],
literal: [
"true",
"false"
]
},
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
CHAR,
STRING,
METHOD,
hljs.C_NUMBER_MODE
]
};
}
module.exports = flix;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/flix" instead of "highlight.js/lib/languages/flix.js"'
);
}
}
emitWarning();
module.exports = require('./flix.js');

View File

@@ -0,0 +1,627 @@
/**
* @param {string} value
* @returns {RegExp}
* */
function escape(value) {
return new RegExp(value.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'm');
}
/**
* @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;
}
/**
* @param { Array<string | RegExp | Object> } args
* @returns {object}
*/
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 {};
}
}
/** @typedef { {capture?: boolean} } RegexEitherOptions */
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args
* @returns {string}
*/
function either(...args) {
/** @type { object & {capture?: boolean} } */
const opts = stripOptionsFromArgs(args);
const joined = '('
+ (opts.capture ? "" : "?:")
+ args.map((x) => source(x)).join("|") + ")";
return joined;
}
/*
Language: F#
Author: Jonas Follesø <jonas@follesoe.no>
Contributors: Troy Kershaw <hello@troykershaw.com>, Henrik Feldt <henrik@haf.se>, Melvyn Laïly <melvyn.laily@gmail.com>
Website: https://docs.microsoft.com/en-us/dotnet/fsharp/
Category: functional
*/
/** @type LanguageFn */
function fsharp(hljs) {
const KEYWORDS = [
"abstract",
"and",
"as",
"assert",
"base",
"begin",
"class",
"default",
"delegate",
"do",
"done",
"downcast",
"downto",
"elif",
"else",
"end",
"exception",
"extern",
// "false", // literal
"finally",
"fixed",
"for",
"fun",
"function",
"global",
"if",
"in",
"inherit",
"inline",
"interface",
"internal",
"lazy",
"let",
"match",
"member",
"module",
"mutable",
"namespace",
"new",
// "not", // built_in
// "null", // literal
"of",
"open",
"or",
"override",
"private",
"public",
"rec",
"return",
"static",
"struct",
"then",
"to",
// "true", // literal
"try",
"type",
"upcast",
"use",
"val",
"void",
"when",
"while",
"with",
"yield"
];
const BANG_KEYWORD_MODE = {
// monad builder keywords (matches before non-bang keywords)
scope: 'keyword',
match: /\b(yield|return|let|do|match|use)!/
};
const PREPROCESSOR_KEYWORDS = [
"if",
"else",
"endif",
"line",
"nowarn",
"light",
"r",
"i",
"I",
"load",
"time",
"help",
"quit"
];
const LITERALS = [
"true",
"false",
"null",
"Some",
"None",
"Ok",
"Error",
"infinity",
"infinityf",
"nan",
"nanf"
];
const SPECIAL_IDENTIFIERS = [
"__LINE__",
"__SOURCE_DIRECTORY__",
"__SOURCE_FILE__"
];
// Since it's possible to re-bind/shadow names (e.g. let char = 'c'),
// these builtin types should only be matched when a type name is expected.
const KNOWN_TYPES = [
// basic types
"bool",
"byte",
"sbyte",
"int8",
"int16",
"int32",
"uint8",
"uint16",
"uint32",
"int",
"uint",
"int64",
"uint64",
"nativeint",
"unativeint",
"decimal",
"float",
"double",
"float32",
"single",
"char",
"string",
"unit",
"bigint",
// other native types or lowercase aliases
"option",
"voption",
"list",
"array",
"seq",
"byref",
"exn",
"inref",
"nativeptr",
"obj",
"outref",
"voidptr",
// other important FSharp types
"Result"
];
const BUILTINS = [
// Somewhat arbitrary list of builtin functions and values.
// Most of them are declared in Microsoft.FSharp.Core
// I tried to stay relevant by adding only the most idiomatic
// and most used symbols that are not already declared as types.
"not",
"ref",
"raise",
"reraise",
"dict",
"readOnlyDict",
"set",
"get",
"enum",
"sizeof",
"typeof",
"typedefof",
"nameof",
"nullArg",
"invalidArg",
"invalidOp",
"id",
"fst",
"snd",
"ignore",
"lock",
"using",
"box",
"unbox",
"tryUnbox",
"printf",
"printfn",
"sprintf",
"eprintf",
"eprintfn",
"fprintf",
"fprintfn",
"failwith",
"failwithf"
];
const ALL_KEYWORDS = {
keyword: KEYWORDS,
literal: LITERALS,
built_in: BUILTINS,
'variable.constant': SPECIAL_IDENTIFIERS
};
// (* potentially multi-line Meta Language style comment *)
const ML_COMMENT =
hljs.COMMENT(/\(\*(?!\))/, /\*\)/, {
contains: ["self"]
});
// Either a multi-line (* Meta Language style comment *) or a single line // C style comment.
const COMMENT = {
variants: [
ML_COMMENT,
hljs.C_LINE_COMMENT_MODE,
]
};
// Most identifiers can contain apostrophes
const IDENTIFIER_RE = /[a-zA-Z_](\w|')*/;
const QUOTED_IDENTIFIER = {
scope: 'variable',
begin: /``/,
end: /``/
};
// 'a or ^a where a can be a ``quoted identifier``
const BEGIN_GENERIC_TYPE_SYMBOL_RE = /\B('|\^)/;
const GENERIC_TYPE_SYMBOL = {
scope: 'symbol',
variants: [
// the type name is a quoted identifier:
{ match: concat(BEGIN_GENERIC_TYPE_SYMBOL_RE, /``.*?``/) },
// the type name is a normal identifier (we don't use IDENTIFIER_RE because there cannot be another apostrophe here):
{ match: concat(BEGIN_GENERIC_TYPE_SYMBOL_RE, hljs.UNDERSCORE_IDENT_RE) }
],
relevance: 0
};
const makeOperatorMode = function({ includeEqual }) {
// List or symbolic operator characters from the FSharp Spec 4.1, minus the dot, and with `?` added, used for nullable operators.
let allOperatorChars;
if (includeEqual)
allOperatorChars = "!%&*+-/<=>@^|~?";
else
allOperatorChars = "!%&*+-/<>@^|~?";
const OPERATOR_CHARS = Array.from(allOperatorChars);
const OPERATOR_CHAR_RE = concat('[', ...OPERATOR_CHARS.map(escape), ']');
// The lone dot operator is special. It cannot be redefined, and we don't want to highlight it. It can be used as part of a multi-chars operator though.
const OPERATOR_CHAR_OR_DOT_RE = either(OPERATOR_CHAR_RE, /\./);
// When a dot is present, it must be followed by another operator char:
const OPERATOR_FIRST_CHAR_OF_MULTIPLE_RE = concat(OPERATOR_CHAR_OR_DOT_RE, lookahead(OPERATOR_CHAR_OR_DOT_RE));
const SYMBOLIC_OPERATOR_RE = either(
concat(OPERATOR_FIRST_CHAR_OF_MULTIPLE_RE, OPERATOR_CHAR_OR_DOT_RE, '*'), // Matches at least 2 chars operators
concat(OPERATOR_CHAR_RE, '+'), // Matches at least one char operators
);
return {
scope: 'operator',
match: either(
// symbolic operators:
SYMBOLIC_OPERATOR_RE,
// other symbolic keywords:
// Type casting and conversion operators:
/:\?>/,
/:\?/,
/:>/,
/:=/, // Reference cell assignment
/::?/, // : or ::
/\$/), // A single $ can be used as an operator
relevance: 0
};
};
const OPERATOR = makeOperatorMode({ includeEqual: true });
// This variant is used when matching '=' should end a parent mode:
const OPERATOR_WITHOUT_EQUAL = makeOperatorMode({ includeEqual: false });
const makeTypeAnnotationMode = function(prefix, prefixScope) {
return {
begin: concat( // a type annotation is a
prefix, // should be a colon or the 'of' keyword
lookahead( // that has to be followed by
concat(
/\s*/, // optional space
either( // then either of:
/\w/, // word
/'/, // generic type name
/\^/, // generic type name
/#/, // flexible type name
/``/, // quoted type name
/\(/, // parens type expression
/{\|/, // anonymous type annotation
)))),
beginScope: prefixScope,
// BUG: because ending with \n is necessary for some cases, multi-line type annotations are not properly supported.
// Examples where \n is required at the end:
// - abstract member definitions in classes: abstract Property : int * string
// - return type annotations: let f f' = f' () : returnTypeAnnotation
// - record fields definitions: { A : int \n B : string }
end: lookahead(
either(
/\n/,
/=/)),
relevance: 0,
// we need the known types, and we need the type constraint keywords and literals. e.g.: when 'a : null
keywords: hljs.inherit(ALL_KEYWORDS, { type: KNOWN_TYPES }),
contains: [
COMMENT,
GENERIC_TYPE_SYMBOL,
hljs.inherit(QUOTED_IDENTIFIER, { scope: null }), // match to avoid strange patterns inside that may break the parsing
OPERATOR_WITHOUT_EQUAL
]
};
};
const TYPE_ANNOTATION = makeTypeAnnotationMode(/:/, 'operator');
const DISCRIMINATED_UNION_TYPE_ANNOTATION = makeTypeAnnotationMode(/\bof\b/, 'keyword');
// type MyType<'a> = ...
const TYPE_DECLARATION = {
begin: [
/(^|\s+)/, // prevents matching the following: `match s.stype with`
/type/,
/\s+/,
IDENTIFIER_RE
],
beginScope: {
2: 'keyword',
4: 'title.class'
},
end: lookahead(/\(|=|$/),
keywords: ALL_KEYWORDS, // match keywords in type constraints. e.g.: when 'a : null
contains: [
COMMENT,
hljs.inherit(QUOTED_IDENTIFIER, { scope: null }), // match to avoid strange patterns inside that may break the parsing
GENERIC_TYPE_SYMBOL,
{
// For visual consistency, highlight type brackets as operators.
scope: 'operator',
match: /<|>/
},
TYPE_ANNOTATION // generic types can have constraints, which are type annotations. e.g. type MyType<'T when 'T : delegate<obj * string>> =
]
};
const COMPUTATION_EXPRESSION = {
// computation expressions:
scope: 'computation-expression',
// BUG: might conflict with record deconstruction. e.g. let f { Name = name } = name // will highlight f
match: /\b[_a-z]\w*(?=\s*\{)/
};
const PREPROCESSOR = {
// preprocessor directives and fsi commands:
begin: [
/^\s*/,
concat(/#/, either(...PREPROCESSOR_KEYWORDS)),
/\b/
],
beginScope: { 2: 'meta' },
end: lookahead(/\s|$/)
};
// TODO: this definition is missing support for type suffixes and octal notation.
// BUG: range operator without any space is wrongly interpreted as a single number (e.g. 1..10 )
const NUMBER = {
variants: [
hljs.BINARY_NUMBER_MODE,
hljs.C_NUMBER_MODE
]
};
// All the following string definitions are potentially multi-line.
// BUG: these definitions are missing support for byte strings (suffixed with B)
// "..."
const QUOTED_STRING = {
scope: 'string',
begin: /"/,
end: /"/,
contains: [
hljs.BACKSLASH_ESCAPE
]
};
// @"..."
const VERBATIM_STRING = {
scope: 'string',
begin: /@"/,
end: /"/,
contains: [
{
match: /""/ // escaped "
},
hljs.BACKSLASH_ESCAPE
]
};
// """..."""
const TRIPLE_QUOTED_STRING = {
scope: 'string',
begin: /"""/,
end: /"""/,
relevance: 2
};
const SUBST = {
scope: 'subst',
begin: /\{/,
end: /\}/,
keywords: ALL_KEYWORDS
};
// $"...{1+1}..."
const INTERPOLATED_STRING = {
scope: 'string',
begin: /\$"/,
end: /"/,
contains: [
{
match: /\{\{/ // escaped {
},
{
match: /\}\}/ // escaped }
},
hljs.BACKSLASH_ESCAPE,
SUBST
]
};
// $@"...{1+1}..."
const INTERPOLATED_VERBATIM_STRING = {
scope: 'string',
begin: /(\$@|@\$)"/,
end: /"/,
contains: [
{
match: /\{\{/ // escaped {
},
{
match: /\}\}/ // escaped }
},
{
match: /""/
},
hljs.BACKSLASH_ESCAPE,
SUBST
]
};
// $"""...{1+1}..."""
const INTERPOLATED_TRIPLE_QUOTED_STRING = {
scope: 'string',
begin: /\$"""/,
end: /"""/,
contains: [
{
match: /\{\{/ // escaped {
},
{
match: /\}\}/ // escaped }
},
SUBST
],
relevance: 2
};
// '.'
const CHAR_LITERAL = {
scope: 'string',
match: concat(
/'/,
either(
/[^\\']/, // either a single non escaped char...
/\\(?:.|\d{3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}|U[a-fA-F\d]{8})/ // ...or an escape sequence
),
/'/
)
};
// F# allows a lot of things inside string placeholders.
// Things that don't currently seem allowed by the compiler: types definition, attributes usage.
// (Strictly speaking, some of the followings are only allowed inside triple quoted interpolated strings...)
SUBST.contains = [
INTERPOLATED_VERBATIM_STRING,
INTERPOLATED_STRING,
VERBATIM_STRING,
QUOTED_STRING,
CHAR_LITERAL,
BANG_KEYWORD_MODE,
COMMENT,
QUOTED_IDENTIFIER,
TYPE_ANNOTATION,
COMPUTATION_EXPRESSION,
PREPROCESSOR,
NUMBER,
GENERIC_TYPE_SYMBOL,
OPERATOR
];
const STRING = {
variants: [
INTERPOLATED_TRIPLE_QUOTED_STRING,
INTERPOLATED_VERBATIM_STRING,
INTERPOLATED_STRING,
TRIPLE_QUOTED_STRING,
VERBATIM_STRING,
QUOTED_STRING,
CHAR_LITERAL
]
};
return {
name: 'F#',
aliases: [
'fs',
'f#'
],
keywords: ALL_KEYWORDS,
illegal: /\/\*/,
classNameAliases: {
'computation-expression': 'keyword'
},
contains: [
BANG_KEYWORD_MODE,
STRING,
COMMENT,
QUOTED_IDENTIFIER,
TYPE_DECLARATION,
{
// e.g. [<Attributes("")>] or [<``module``: MyCustomAttributeThatWorksOnModules>]
// or [<Sealed; NoEquality; NoComparison; CompiledName("FSharpAsync`1")>]
scope: 'meta',
begin: /\[</,
end: />\]/,
relevance: 2,
contains: [
QUOTED_IDENTIFIER,
// can contain any constant value
TRIPLE_QUOTED_STRING,
VERBATIM_STRING,
QUOTED_STRING,
CHAR_LITERAL,
NUMBER
]
},
DISCRIMINATED_UNION_TYPE_ANNOTATION,
TYPE_ANNOTATION,
COMPUTATION_EXPRESSION,
PREPROCESSOR,
NUMBER,
GENERIC_TYPE_SYMBOL,
OPERATOR
]
};
}
module.exports = fsharp;

View File

@@ -0,0 +1,181 @@
/*
Language: GAMS
Author: Stefan Bechert <stefan.bechert@gmx.net>
Contributors: Oleg Efimov <efimovov@gmail.com>, Mikko Kouhia <mikko.kouhia@iki.fi>
Description: The General Algebraic Modeling System language
Website: https://www.gams.com
Category: scientific
*/
/** @type LanguageFn */
function gams(hljs) {
const regex = hljs.regex;
const KEYWORDS = {
keyword:
'abort acronym acronyms alias all and assign binary card diag display '
+ 'else eq file files for free ge gt if integer le loop lt maximizing '
+ 'minimizing model models ne negative no not option options or ord '
+ 'positive prod put putpage puttl repeat sameas semicont semiint smax '
+ 'smin solve sos1 sos2 sum system table then until using while xor yes',
literal:
'eps inf na',
built_in:
'abs arccos arcsin arctan arctan2 Beta betaReg binomial ceil centropy '
+ 'cos cosh cvPower div div0 eDist entropy errorf execSeed exp fact '
+ 'floor frac gamma gammaReg log logBeta logGamma log10 log2 mapVal max '
+ 'min mod ncpCM ncpF ncpVUpow ncpVUsin normal pi poly power '
+ 'randBinomial randLinear randTriangle round rPower sigmoid sign '
+ 'signPower sin sinh slexp sllog10 slrec sqexp sqlog10 sqr sqrec sqrt '
+ 'tan tanh trunc uniform uniformInt vcPower bool_and bool_eqv bool_imp '
+ 'bool_not bool_or bool_xor ifThen rel_eq rel_ge rel_gt rel_le rel_lt '
+ 'rel_ne gday gdow ghour gleap gmillisec gminute gmonth gsecond gyear '
+ 'jdate jnow jstart jtime errorLevel execError gamsRelease gamsVersion '
+ 'handleCollect handleDelete handleStatus handleSubmit heapFree '
+ 'heapLimit heapSize jobHandle jobKill jobStatus jobTerminate '
+ 'licenseLevel licenseStatus maxExecError sleep timeClose timeComp '
+ 'timeElapsed timeExec timeStart'
};
const PARAMS = {
className: 'params',
begin: /\(/,
end: /\)/,
excludeBegin: true,
excludeEnd: true
};
const SYMBOLS = {
className: 'symbol',
variants: [
{ begin: /=[lgenxc]=/ },
{ begin: /\$/ }
]
};
const QSTR = { // One-line quoted comment string
className: 'comment',
variants: [
{
begin: '\'',
end: '\''
},
{
begin: '"',
end: '"'
}
],
illegal: '\\n',
contains: [ hljs.BACKSLASH_ESCAPE ]
};
const ASSIGNMENT = {
begin: '/',
end: '/',
keywords: KEYWORDS,
contains: [
QSTR,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
hljs.C_NUMBER_MODE
]
};
const COMMENT_WORD = /[a-z0-9&#*=?@\\><:,()$[\]_.{}!+%^-]+/;
const DESCTEXT = { // Parameter/set/variable description text
begin: /[a-z][a-z0-9_]*(\([a-z0-9_, ]*\))?[ \t]+/,
excludeBegin: true,
end: '$',
endsWithParent: true,
contains: [
QSTR,
ASSIGNMENT,
{
className: 'comment',
// one comment word, then possibly more
begin: regex.concat(
COMMENT_WORD,
// [ ] because \s would be too broad (matching newlines)
regex.anyNumberOfTimes(regex.concat(/[ ]+/, COMMENT_WORD))
),
relevance: 0
}
]
};
return {
name: 'GAMS',
aliases: [ 'gms' ],
case_insensitive: true,
keywords: KEYWORDS,
contains: [
hljs.COMMENT(/^\$ontext/, /^\$offtext/),
{
className: 'meta',
begin: '^\\$[a-z0-9]+',
end: '$',
returnBegin: true,
contains: [
{
className: 'keyword',
begin: '^\\$[a-z0-9]+'
}
]
},
hljs.COMMENT('^\\*', '$'),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
// Declarations
{
beginKeywords:
'set sets parameter parameters variable variables '
+ 'scalar scalars equation equations',
end: ';',
contains: [
hljs.COMMENT('^\\*', '$'),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
ASSIGNMENT,
DESCTEXT
]
},
{ // table environment
beginKeywords: 'table',
end: ';',
returnBegin: true,
contains: [
{ // table header row
beginKeywords: 'table',
end: '$',
contains: [ DESCTEXT ]
},
hljs.COMMENT('^\\*', '$'),
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
hljs.C_NUMBER_MODE
// Table does not contain DESCTEXT or ASSIGNMENT
]
},
// Function definitions
{
className: 'function',
begin: /^[a-z][a-z0-9_,\-+' ()$]+\.{2}/,
returnBegin: true,
contains: [
{ // Function title
className: 'title',
begin: /^[a-z0-9_]+/
},
PARAMS,
SYMBOLS
]
},
hljs.C_NUMBER_MODE,
SYMBOLS
]
};
}
module.exports = gams;

View File

@@ -0,0 +1,306 @@
/*
Language: GAUSS
Author: Matt Evans <matt@aptech.com>
Description: GAUSS Mathematical and Statistical language
Website: https://www.aptech.com
Category: scientific
*/
function gauss(hljs) {
const KEYWORDS = {
keyword: 'bool break call callexe checkinterrupt clear clearg closeall cls comlog compile '
+ 'continue create debug declare delete disable dlibrary dllcall do dos ed edit else '
+ 'elseif enable end endfor endif endp endo errorlog errorlogat expr external fn '
+ 'for format goto gosub graph if keyword let lib library line load loadarray loadexe '
+ 'loadf loadk loadm loadp loads loadx local locate loopnextindex lprint lpwidth lshow '
+ 'matrix msym ndpclex new open output outwidth plot plotsym pop prcsn print '
+ 'printdos proc push retp return rndcon rndmod rndmult rndseed run save saveall screen '
+ 'scroll setarray show sparse stop string struct system trace trap threadfor '
+ 'threadendfor threadbegin threadjoin threadstat threadend until use while winprint '
+ 'ne ge le gt lt and xor or not eq eqv',
built_in: 'abs acf aconcat aeye amax amean AmericanBinomCall AmericanBinomCall_Greeks AmericanBinomCall_ImpVol '
+ 'AmericanBinomPut AmericanBinomPut_Greeks AmericanBinomPut_ImpVol AmericanBSCall AmericanBSCall_Greeks '
+ 'AmericanBSCall_ImpVol AmericanBSPut AmericanBSPut_Greeks AmericanBSPut_ImpVol amin amult annotationGetDefaults '
+ 'annotationSetBkd annotationSetFont annotationSetLineColor annotationSetLineStyle annotationSetLineThickness '
+ 'annualTradingDays arccos arcsin areshape arrayalloc arrayindex arrayinit arraytomat asciiload asclabel astd '
+ 'astds asum atan atan2 atranspose axmargin balance band bandchol bandcholsol bandltsol bandrv bandsolpd bar '
+ 'base10 begwind besselj bessely beta box boxcox cdfBeta cdfBetaInv cdfBinomial cdfBinomialInv cdfBvn cdfBvn2 '
+ 'cdfBvn2e cdfCauchy cdfCauchyInv cdfChic cdfChii cdfChinc cdfChincInv cdfExp cdfExpInv cdfFc cdfFnc cdfFncInv '
+ 'cdfGam cdfGenPareto cdfHyperGeo cdfLaplace cdfLaplaceInv cdfLogistic cdfLogisticInv cdfmControlCreate cdfMvn '
+ 'cdfMvn2e cdfMvnce cdfMvne cdfMvt2e cdfMvtce cdfMvte cdfN cdfN2 cdfNc cdfNegBinomial cdfNegBinomialInv cdfNi '
+ 'cdfPoisson cdfPoissonInv cdfRayleigh cdfRayleighInv cdfTc cdfTci cdfTnc cdfTvn cdfWeibull cdfWeibullInv cdir '
+ 'ceil ChangeDir chdir chiBarSquare chol choldn cholsol cholup chrs close code cols colsf combinate combinated '
+ 'complex con cond conj cons ConScore contour conv convertsatostr convertstrtosa corrm corrms corrvc corrx corrxs '
+ 'cos cosh counts countwts crossprd crout croutp csrcol csrlin csvReadM csvReadSA cumprodc cumsumc curve cvtos '
+ 'datacreate datacreatecomplex datalist dataload dataloop dataopen datasave date datestr datestring datestrymd '
+ 'dayinyr dayofweek dbAddDatabase dbClose dbCommit dbCreateQuery dbExecQuery dbGetConnectOptions dbGetDatabaseName '
+ 'dbGetDriverName dbGetDrivers dbGetHostName dbGetLastErrorNum dbGetLastErrorText dbGetNumericalPrecPolicy '
+ 'dbGetPassword dbGetPort dbGetTableHeaders dbGetTables dbGetUserName dbHasFeature dbIsDriverAvailable dbIsOpen '
+ 'dbIsOpenError dbOpen dbQueryBindValue dbQueryClear dbQueryCols dbQueryExecPrepared dbQueryFetchAllM dbQueryFetchAllSA '
+ 'dbQueryFetchOneM dbQueryFetchOneSA dbQueryFinish dbQueryGetBoundValue dbQueryGetBoundValues dbQueryGetField '
+ 'dbQueryGetLastErrorNum dbQueryGetLastErrorText dbQueryGetLastInsertID dbQueryGetLastQuery dbQueryGetPosition '
+ 'dbQueryIsActive dbQueryIsForwardOnly dbQueryIsNull dbQueryIsSelect dbQueryIsValid dbQueryPrepare dbQueryRows '
+ 'dbQuerySeek dbQuerySeekFirst dbQuerySeekLast dbQuerySeekNext dbQuerySeekPrevious dbQuerySetForwardOnly '
+ 'dbRemoveDatabase dbRollback dbSetConnectOptions dbSetDatabaseName dbSetHostName dbSetNumericalPrecPolicy '
+ 'dbSetPort dbSetUserName dbTransaction DeleteFile delif delrows denseToSp denseToSpRE denToZero design det detl '
+ 'dfft dffti diag diagrv digamma doswin DOSWinCloseall DOSWinOpen dotfeq dotfeqmt dotfge dotfgemt dotfgt dotfgtmt '
+ 'dotfle dotflemt dotflt dotfltmt dotfne dotfnemt draw drop dsCreate dstat dstatmt dstatmtControlCreate dtdate dtday '
+ 'dttime dttodtv dttostr dttoutc dtvnormal dtvtodt dtvtoutc dummy dummybr dummydn eig eigh eighv eigv elapsedTradingDays '
+ 'endwind envget eof eqSolve eqSolvemt eqSolvemtControlCreate eqSolvemtOutCreate eqSolveset erf erfc erfccplx erfcplx error '
+ 'etdays ethsec etstr EuropeanBinomCall EuropeanBinomCall_Greeks EuropeanBinomCall_ImpVol EuropeanBinomPut '
+ 'EuropeanBinomPut_Greeks EuropeanBinomPut_ImpVol EuropeanBSCall EuropeanBSCall_Greeks EuropeanBSCall_ImpVol '
+ 'EuropeanBSPut EuropeanBSPut_Greeks EuropeanBSPut_ImpVol exctsmpl exec execbg exp extern eye fcheckerr fclearerr feq '
+ 'feqmt fflush fft ffti fftm fftmi fftn fge fgemt fgets fgetsa fgetsat fgetst fgt fgtmt fileinfo filesa fle flemt '
+ 'floor flt fltmt fmod fne fnemt fonts fopen formatcv formatnv fputs fputst fseek fstrerror ftell ftocv ftos ftostrC '
+ 'gamma gammacplx gammaii gausset gdaAppend gdaCreate gdaDStat gdaDStatMat gdaGetIndex gdaGetName gdaGetNames gdaGetOrders '
+ 'gdaGetType gdaGetTypes gdaGetVarInfo gdaIsCplx gdaLoad gdaPack gdaRead gdaReadByIndex gdaReadSome gdaReadSparse '
+ 'gdaReadStruct gdaReportVarInfo gdaSave gdaUpdate gdaUpdateAndPack gdaVars gdaWrite gdaWrite32 gdaWriteSome getarray '
+ 'getdims getf getGAUSShome getmatrix getmatrix4D getname getnamef getNextTradingDay getNextWeekDay getnr getorders '
+ 'getpath getPreviousTradingDay getPreviousWeekDay getRow getscalar3D getscalar4D getTrRow getwind glm gradcplx gradMT '
+ 'gradMTm gradMTT gradMTTm gradp graphprt graphset hasimag header headermt hess hessMT hessMTg hessMTgw hessMTm '
+ 'hessMTmw hessMTT hessMTTg hessMTTgw hessMTTm hessMTw hessp hist histf histp hsec imag indcv indexcat indices indices2 '
+ 'indicesf indicesfn indnv indsav integrate1d integrateControlCreate intgrat2 intgrat3 inthp1 inthp2 inthp3 inthp4 '
+ 'inthpControlCreate intquad1 intquad2 intquad3 intrleav intrleavsa intrsect intsimp inv invpd invswp iscplx iscplxf '
+ 'isden isinfnanmiss ismiss key keyav keyw lag lag1 lagn lapEighb lapEighi lapEighvb lapEighvi lapgEig lapgEigh lapgEighv '
+ 'lapgEigv lapgSchur lapgSvdcst lapgSvds lapgSvdst lapSvdcusv lapSvds lapSvdusv ldlp ldlsol linSolve listwise ln lncdfbvn '
+ 'lncdfbvn2 lncdfmvn lncdfn lncdfn2 lncdfnc lnfact lngammacplx lnpdfmvn lnpdfmvt lnpdfn lnpdft loadd loadstruct loadwind '
+ 'loess loessmt loessmtControlCreate log loglog logx logy lower lowmat lowmat1 ltrisol lu lusol machEpsilon make makevars '
+ 'makewind margin matalloc matinit mattoarray maxbytes maxc maxindc maxv maxvec mbesselei mbesselei0 mbesselei1 mbesseli '
+ 'mbesseli0 mbesseli1 meanc median mergeby mergevar minc minindc minv miss missex missrv moment momentd movingave '
+ 'movingaveExpwgt movingaveWgt nextindex nextn nextnevn nextwind ntos null null1 numCombinations ols olsmt olsmtControlCreate '
+ 'olsqr olsqr2 olsqrmt ones optn optnevn orth outtyp pacf packedToSp packr parse pause pdfCauchy pdfChi pdfExp pdfGenPareto '
+ 'pdfHyperGeo pdfLaplace pdfLogistic pdfn pdfPoisson pdfRayleigh pdfWeibull pi pinv pinvmt plotAddArrow plotAddBar plotAddBox '
+ 'plotAddHist plotAddHistF plotAddHistP plotAddPolar plotAddScatter plotAddShape plotAddTextbox plotAddTS plotAddXY plotArea '
+ 'plotBar plotBox plotClearLayout plotContour plotCustomLayout plotGetDefaults plotHist plotHistF plotHistP plotLayout '
+ 'plotLogLog plotLogX plotLogY plotOpenWindow plotPolar plotSave plotScatter plotSetAxesPen plotSetBar plotSetBarFill '
+ 'plotSetBarStacked plotSetBkdColor plotSetFill plotSetGrid plotSetLegend plotSetLineColor plotSetLineStyle plotSetLineSymbol '
+ 'plotSetLineThickness plotSetNewWindow plotSetTitle plotSetWhichYAxis plotSetXAxisShow plotSetXLabel plotSetXRange '
+ 'plotSetXTicInterval plotSetXTicLabel plotSetYAxisShow plotSetYLabel plotSetYRange plotSetZAxisShow plotSetZLabel '
+ 'plotSurface plotTS plotXY polar polychar polyeval polygamma polyint polymake polymat polymroot polymult polyroot '
+ 'pqgwin previousindex princomp printfm printfmt prodc psi putarray putf putvals pvCreate pvGetIndex pvGetParNames '
+ 'pvGetParVector pvLength pvList pvPack pvPacki pvPackm pvPackmi pvPacks pvPacksi pvPacksm pvPacksmi pvPutParVector '
+ 'pvTest pvUnpack QNewton QNewtonmt QNewtonmtControlCreate QNewtonmtOutCreate QNewtonSet QProg QProgmt QProgmtInCreate '
+ 'qqr qqre qqrep qr qre qrep qrsol qrtsol qtyr qtyre qtyrep quantile quantiled qyr qyre qyrep qz rank rankindx readr '
+ 'real reclassify reclassifyCuts recode recserar recsercp recserrc rerun rescale reshape rets rev rfft rffti rfftip rfftn '
+ 'rfftnp rfftp rndBernoulli rndBeta rndBinomial rndCauchy rndChiSquare rndCon rndCreateState rndExp rndGamma rndGeo rndGumbel '
+ 'rndHyperGeo rndi rndKMbeta rndKMgam rndKMi rndKMn rndKMnb rndKMp rndKMu rndKMvm rndLaplace rndLCbeta rndLCgam rndLCi rndLCn '
+ 'rndLCnb rndLCp rndLCu rndLCvm rndLogNorm rndMTu rndMVn rndMVt rndn rndnb rndNegBinomial rndp rndPoisson rndRayleigh '
+ 'rndStateSkip rndu rndvm rndWeibull rndWishart rotater round rows rowsf rref sampleData satostrC saved saveStruct savewind '
+ 'scale scale3d scalerr scalinfnanmiss scalmiss schtoc schur searchsourcepath seekr select selif seqa seqm setdif setdifsa '
+ 'setvars setvwrmode setwind shell shiftr sin singleindex sinh sleep solpd sortc sortcc sortd sorthc sorthcc sortind '
+ 'sortindc sortmc sortr sortrc spBiconjGradSol spChol spConjGradSol spCreate spDenseSubmat spDiagRvMat spEigv spEye spLDL '
+ 'spline spLU spNumNZE spOnes spreadSheetReadM spreadSheetReadSA spreadSheetWrite spScale spSubmat spToDense spTrTDense '
+ 'spTScalar spZeros sqpSolve sqpSolveMT sqpSolveMTControlCreate sqpSolveMTlagrangeCreate sqpSolveMToutCreate sqpSolveSet '
+ 'sqrt statements stdc stdsc stocv stof strcombine strindx strlen strput strrindx strsect strsplit strsplitPad strtodt '
+ 'strtof strtofcplx strtriml strtrimr strtrunc strtruncl strtruncpad strtruncr submat subscat substute subvec sumc sumr '
+ 'surface svd svd1 svd2 svdcusv svds svdusv sysstate tab tan tanh tempname '
+ 'time timedt timestr timeutc title tkf2eps tkf2ps tocart todaydt toeplitz token topolar trapchk '
+ 'trigamma trimr trunc type typecv typef union unionsa uniqindx uniqindxsa unique uniquesa upmat upmat1 upper utctodt '
+ 'utctodtv utrisol vals varCovMS varCovXS varget vargetl varmall varmares varput varputl vartypef vcm vcms vcx vcxs '
+ 'vec vech vecr vector vget view viewxyz vlist vnamecv volume vput vread vtypecv wait waitc walkindex where window '
+ 'writer xlabel xlsGetSheetCount xlsGetSheetSize xlsGetSheetTypes xlsMakeRange xlsReadM xlsReadSA xlsWrite xlsWriteM '
+ 'xlsWriteSA xpnd xtics xy xyz ylabel ytics zeros zeta zlabel ztics cdfEmpirical dot h5create h5open h5read h5readAttribute '
+ 'h5write h5writeAttribute ldl plotAddErrorBar plotAddSurface plotCDFEmpirical plotSetColormap plotSetContourLabels '
+ 'plotSetLegendFont plotSetTextInterpreter plotSetXTicCount plotSetYTicCount plotSetZLevels powerm strjoin sylvester '
+ 'strtrim',
literal: 'DB_AFTER_LAST_ROW DB_ALL_TABLES DB_BATCH_OPERATIONS DB_BEFORE_FIRST_ROW DB_BLOB DB_EVENT_NOTIFICATIONS '
+ 'DB_FINISH_QUERY DB_HIGH_PRECISION DB_LAST_INSERT_ID DB_LOW_PRECISION_DOUBLE DB_LOW_PRECISION_INT32 '
+ 'DB_LOW_PRECISION_INT64 DB_LOW_PRECISION_NUMBERS DB_MULTIPLE_RESULT_SETS DB_NAMED_PLACEHOLDERS '
+ 'DB_POSITIONAL_PLACEHOLDERS DB_PREPARED_QUERIES DB_QUERY_SIZE DB_SIMPLE_LOCKING DB_SYSTEM_TABLES DB_TABLES '
+ 'DB_TRANSACTIONS DB_UNICODE DB_VIEWS __STDIN __STDOUT __STDERR __FILE_DIR'
};
const AT_COMMENT_MODE = hljs.COMMENT('@', '@');
const PREPROCESSOR =
{
className: 'meta',
begin: '#',
end: '$',
keywords: { keyword: 'define definecs|10 undef ifdef ifndef iflight ifdllcall ifmac ifos2win ifunix else endif lineson linesoff srcfile srcline' },
contains: [
{
begin: /\\\n/,
relevance: 0
},
{
beginKeywords: 'include',
end: '$',
keywords: { keyword: 'include' },
contains: [
{
className: 'string',
begin: '"',
end: '"',
illegal: '\\n'
}
]
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
AT_COMMENT_MODE
]
};
const STRUCT_TYPE =
{
begin: /\bstruct\s+/,
end: /\s/,
keywords: "struct",
contains: [
{
className: "type",
begin: hljs.UNDERSCORE_IDENT_RE,
relevance: 0
}
]
};
// only for definitions
const PARSE_PARAMS = [
{
className: 'params',
begin: /\(/,
end: /\)/,
excludeBegin: true,
excludeEnd: true,
endsWithParent: true,
relevance: 0,
contains: [
{ // dots
className: 'literal',
begin: /\.\.\./
},
hljs.C_NUMBER_MODE,
hljs.C_BLOCK_COMMENT_MODE,
AT_COMMENT_MODE,
STRUCT_TYPE
]
}
];
const FUNCTION_DEF =
{
className: "title",
begin: hljs.UNDERSCORE_IDENT_RE,
relevance: 0
};
const DEFINITION = function(beginKeywords, end, inherits) {
const mode = hljs.inherit(
{
className: "function",
beginKeywords: beginKeywords,
end: end,
excludeEnd: true,
contains: [].concat(PARSE_PARAMS)
},
{}
);
mode.contains.push(FUNCTION_DEF);
mode.contains.push(hljs.C_NUMBER_MODE);
mode.contains.push(hljs.C_BLOCK_COMMENT_MODE);
mode.contains.push(AT_COMMENT_MODE);
return mode;
};
const BUILT_IN_REF =
{ // these are explicitly named internal function calls
className: 'built_in',
begin: '\\b(' + KEYWORDS.built_in.split(' ').join('|') + ')\\b'
};
const STRING_REF =
{
className: 'string',
begin: '"',
end: '"',
contains: [ hljs.BACKSLASH_ESCAPE ],
relevance: 0
};
const FUNCTION_REF =
{
// className: "fn_ref",
begin: hljs.UNDERSCORE_IDENT_RE + '\\s*\\(',
returnBegin: true,
keywords: KEYWORDS,
relevance: 0,
contains: [
{ beginKeywords: KEYWORDS.keyword },
BUILT_IN_REF,
{ // ambiguously named function calls get a relevance of 0
className: 'built_in',
begin: hljs.UNDERSCORE_IDENT_RE,
relevance: 0
}
]
};
const FUNCTION_REF_PARAMS =
{
// className: "fn_ref_params",
begin: /\(/,
end: /\)/,
relevance: 0,
keywords: {
built_in: KEYWORDS.built_in,
literal: KEYWORDS.literal
},
contains: [
hljs.C_NUMBER_MODE,
hljs.C_BLOCK_COMMENT_MODE,
AT_COMMENT_MODE,
BUILT_IN_REF,
FUNCTION_REF,
STRING_REF,
'self'
]
};
FUNCTION_REF.contains.push(FUNCTION_REF_PARAMS);
return {
name: 'GAUSS',
aliases: [ 'gss' ],
case_insensitive: true, // language is case-insensitive
keywords: KEYWORDS,
illegal: /(\{[%#]|[%#]\}| <- )/,
contains: [
hljs.C_NUMBER_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
AT_COMMENT_MODE,
STRING_REF,
PREPROCESSOR,
{
className: 'keyword',
begin: /\bexternal (matrix|string|array|sparse matrix|struct|proc|keyword|fn)/
},
DEFINITION('proc keyword', ';'),
DEFINITION('fn', '='),
{
beginKeywords: 'for threadfor',
end: /;/,
// end: /\(/,
relevance: 0,
contains: [
hljs.C_BLOCK_COMMENT_MODE,
AT_COMMENT_MODE,
FUNCTION_REF_PARAMS
]
},
{ // custom method guard
// excludes method names from keyword processing
variants: [
{ begin: hljs.UNDERSCORE_IDENT_RE + '\\.' + hljs.UNDERSCORE_IDENT_RE },
{ begin: hljs.UNDERSCORE_IDENT_RE + '\\s*=' }
],
relevance: 0
},
FUNCTION_REF,
STRUCT_TYPE
]
};
}
module.exports = gauss;

View File

@@ -0,0 +1,189 @@
/*
Language: G-code (ISO 6983)
Contributors: Adam Joseph Cook <adam.joseph.cook@gmail.com>
Description: G-code syntax highlighter for Fanuc and other common CNC machine tool controls.
Website: https://www.sis.se/api/document/preview/911952/
Category: hardware
*/
function gcode(hljs) {
const regex = hljs.regex;
const GCODE_KEYWORDS = {
$pattern: /[A-Z]+|%/,
keyword: [
// conditions
'THEN',
'ELSE',
'ENDIF',
'IF',
// controls
'GOTO',
'DO',
'WHILE',
'WH',
'END',
'CALL',
// scoping
'SUB',
'ENDSUB',
// comparisons
'EQ',
'NE',
'LT',
'GT',
'LE',
'GE',
'AND',
'OR',
'XOR',
// start/end of program
'%'
],
built_in: [
'ATAN',
'ABS',
'ACOS',
'ASIN',
'COS',
'EXP',
'FIX',
'FUP',
'ROUND',
'LN',
'SIN',
'SQRT',
'TAN',
'EXISTS'
]
};
// TODO: post v12 lets use look-behind, until then \b and a callback filter will be used
// const LETTER_BOUNDARY_RE = /(?<![A-Z])/;
const LETTER_BOUNDARY_RE = /\b/;
function LETTER_BOUNDARY_CALLBACK(matchdata, response) {
if (matchdata.index === 0) {
return;
}
const charBeforeMatch = matchdata.input[matchdata.index - 1];
if (charBeforeMatch >= '0' && charBeforeMatch <= '9') {
return;
}
if (charBeforeMatch === '_') {
return;
}
response.ignoreMatch();
}
const NUMBER_RE = /[+-]?((\.\d+)|(\d+)(\.\d*)?)/;
const GENERAL_MISC_FUNCTION_RE = /[GM]\s*\d+(\.\d+)?/;
const TOOLS_RE = /T\s*\d+/;
const SUBROUTINE_RE = /O\s*\d+/;
const SUBROUTINE_NAMED_RE = /O<.+>/;
const AXES_RE = /[ABCUVWXYZ]\s*/;
const PARAMETERS_RE = /[FHIJKPQRS]\s*/;
const GCODE_CODE = [
// comments
hljs.COMMENT(/\(/, /\)/),
hljs.COMMENT(/;/, /$/),
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
// gcodes
{
scope: 'title.function',
variants: [
// G General functions: G0, G5.1, G5.2, …
// M Misc functions: M0, M55.6, M199, …
{ match: regex.concat(LETTER_BOUNDARY_RE, GENERAL_MISC_FUNCTION_RE) },
{
begin: GENERAL_MISC_FUNCTION_RE,
'on:begin': LETTER_BOUNDARY_CALLBACK
},
// T Tools
{ match: regex.concat(LETTER_BOUNDARY_RE, TOOLS_RE), },
{
begin: TOOLS_RE,
'on:begin': LETTER_BOUNDARY_CALLBACK
}
]
},
{
scope: 'symbol',
variants: [
// O Subroutine ID: O100, O110, …
{ match: regex.concat(LETTER_BOUNDARY_RE, SUBROUTINE_RE) },
{
begin: SUBROUTINE_RE,
'on:begin': LETTER_BOUNDARY_CALLBACK
},
// O Subroutine name: O<some>, …
{ match: regex.concat(LETTER_BOUNDARY_RE, SUBROUTINE_NAMED_RE) },
{
begin: SUBROUTINE_NAMED_RE,
'on:begin': LETTER_BOUNDARY_CALLBACK
},
// Checksum at end of line: *71, *199, …
{ match: /\*\s*\d+\s*$/ }
]
},
{
scope: 'operator', // N Line number: N1, N2, N1020, …
match: /^N\s*\d+/
},
{
scope: 'variable',
match: /-?#\s*\d+/
},
{
scope: 'property', // Physical axes,
variants: [
{ match: regex.concat(LETTER_BOUNDARY_RE, AXES_RE, NUMBER_RE) },
{
begin: regex.concat(AXES_RE, NUMBER_RE),
'on:begin': LETTER_BOUNDARY_CALLBACK
},
]
},
{
scope: 'params', // Different types of parameters
variants: [
{ match: regex.concat(LETTER_BOUNDARY_RE, PARAMETERS_RE, NUMBER_RE) },
{
begin: regex.concat(PARAMETERS_RE, NUMBER_RE),
'on:begin': LETTER_BOUNDARY_CALLBACK
},
]
},
];
return {
name: 'G-code (ISO 6983)',
aliases: [ 'nc' ],
// Some implementations (CNC controls) of G-code are interoperable with uppercase and lowercase letters seamlessly.
// However, most prefer all uppercase and uppercase is customary.
case_insensitive: true,
// TODO: post v12 with the use of look-behind this can be enabled
disableAutodetect: true,
keywords: GCODE_KEYWORDS,
contains: GCODE_CODE
};
}
module.exports = gcode;

View File

@@ -0,0 +1,128 @@
/*
Language: GLSL
Description: OpenGL Shading Language
Author: Sergey Tikhomirov <sergey@tikhomirov.io>
Website: https://en.wikipedia.org/wiki/OpenGL_Shading_Language
Category: graphics
*/
function glsl(hljs) {
return {
name: 'GLSL',
keywords: {
keyword:
// Statements
'break continue discard do else for if return while switch case default '
// Qualifiers
+ 'attribute binding buffer ccw centroid centroid varying coherent column_major const cw '
+ 'depth_any depth_greater depth_less depth_unchanged early_fragment_tests equal_spacing '
+ 'flat fractional_even_spacing fractional_odd_spacing highp in index inout invariant '
+ 'invocations isolines layout line_strip lines lines_adjacency local_size_x local_size_y '
+ 'local_size_z location lowp max_vertices mediump noperspective offset origin_upper_left '
+ 'out packed patch pixel_center_integer point_mode points precise precision quads r11f_g11f_b10f '
+ 'r16 r16_snorm r16f r16i r16ui r32f r32i r32ui r8 r8_snorm r8i r8ui readonly restrict '
+ 'rg16 rg16_snorm rg16f rg16i rg16ui rg32f rg32i rg32ui rg8 rg8_snorm rg8i rg8ui rgb10_a2 '
+ 'rgb10_a2ui rgba16 rgba16_snorm rgba16f rgba16i rgba16ui rgba32f rgba32i rgba32ui rgba8 '
+ 'rgba8_snorm rgba8i rgba8ui row_major sample shared smooth std140 std430 stream triangle_strip '
+ 'triangles triangles_adjacency uniform varying vertices volatile writeonly',
type:
'atomic_uint bool bvec2 bvec3 bvec4 dmat2 dmat2x2 dmat2x3 dmat2x4 dmat3 dmat3x2 dmat3x3 '
+ 'dmat3x4 dmat4 dmat4x2 dmat4x3 dmat4x4 double dvec2 dvec3 dvec4 float iimage1D iimage1DArray '
+ 'iimage2D iimage2DArray iimage2DMS iimage2DMSArray iimage2DRect iimage3D iimageBuffer '
+ 'iimageCube iimageCubeArray image1D image1DArray image2D image2DArray image2DMS image2DMSArray '
+ 'image2DRect image3D imageBuffer imageCube imageCubeArray int isampler1D isampler1DArray '
+ 'isampler2D isampler2DArray isampler2DMS isampler2DMSArray isampler2DRect isampler3D '
+ 'isamplerBuffer isamplerCube isamplerCubeArray ivec2 ivec3 ivec4 mat2 mat2x2 mat2x3 '
+ 'mat2x4 mat3 mat3x2 mat3x3 mat3x4 mat4 mat4x2 mat4x3 mat4x4 sampler1D sampler1DArray '
+ 'sampler1DArrayShadow sampler1DShadow sampler2D sampler2DArray sampler2DArrayShadow '
+ 'sampler2DMS sampler2DMSArray sampler2DRect sampler2DRectShadow sampler2DShadow sampler3D '
+ 'samplerBuffer samplerCube samplerCubeArray samplerCubeArrayShadow samplerCubeShadow '
+ 'image1D uimage1DArray uimage2D uimage2DArray uimage2DMS uimage2DMSArray uimage2DRect '
+ 'uimage3D uimageBuffer uimageCube uimageCubeArray uint usampler1D usampler1DArray '
+ 'usampler2D usampler2DArray usampler2DMS usampler2DMSArray usampler2DRect usampler3D '
+ 'samplerBuffer usamplerCube usamplerCubeArray uvec2 uvec3 uvec4 vec2 vec3 vec4 void',
built_in:
// Constants
'gl_MaxAtomicCounterBindings gl_MaxAtomicCounterBufferSize gl_MaxClipDistances gl_MaxClipPlanes '
+ 'gl_MaxCombinedAtomicCounterBuffers gl_MaxCombinedAtomicCounters gl_MaxCombinedImageUniforms '
+ 'gl_MaxCombinedImageUnitsAndFragmentOutputs gl_MaxCombinedTextureImageUnits gl_MaxComputeAtomicCounterBuffers '
+ 'gl_MaxComputeAtomicCounters gl_MaxComputeImageUniforms gl_MaxComputeTextureImageUnits '
+ 'gl_MaxComputeUniformComponents gl_MaxComputeWorkGroupCount gl_MaxComputeWorkGroupSize '
+ 'gl_MaxDrawBuffers gl_MaxFragmentAtomicCounterBuffers gl_MaxFragmentAtomicCounters '
+ 'gl_MaxFragmentImageUniforms gl_MaxFragmentInputComponents gl_MaxFragmentInputVectors '
+ 'gl_MaxFragmentUniformComponents gl_MaxFragmentUniformVectors gl_MaxGeometryAtomicCounterBuffers '
+ 'gl_MaxGeometryAtomicCounters gl_MaxGeometryImageUniforms gl_MaxGeometryInputComponents '
+ 'gl_MaxGeometryOutputComponents gl_MaxGeometryOutputVertices gl_MaxGeometryTextureImageUnits '
+ 'gl_MaxGeometryTotalOutputComponents gl_MaxGeometryUniformComponents gl_MaxGeometryVaryingComponents '
+ 'gl_MaxImageSamples gl_MaxImageUnits gl_MaxLights gl_MaxPatchVertices gl_MaxProgramTexelOffset '
+ 'gl_MaxTessControlAtomicCounterBuffers gl_MaxTessControlAtomicCounters gl_MaxTessControlImageUniforms '
+ 'gl_MaxTessControlInputComponents gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits '
+ 'gl_MaxTessControlTotalOutputComponents gl_MaxTessControlUniformComponents '
+ 'gl_MaxTessEvaluationAtomicCounterBuffers gl_MaxTessEvaluationAtomicCounters '
+ 'gl_MaxTessEvaluationImageUniforms gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents '
+ 'gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents '
+ 'gl_MaxTessGenLevel gl_MaxTessPatchComponents gl_MaxTextureCoords gl_MaxTextureImageUnits '
+ 'gl_MaxTextureUnits gl_MaxVaryingComponents gl_MaxVaryingFloats gl_MaxVaryingVectors '
+ 'gl_MaxVertexAtomicCounterBuffers gl_MaxVertexAtomicCounters gl_MaxVertexAttribs gl_MaxVertexImageUniforms '
+ 'gl_MaxVertexOutputComponents gl_MaxVertexOutputVectors gl_MaxVertexTextureImageUnits '
+ 'gl_MaxVertexUniformComponents gl_MaxVertexUniformVectors gl_MaxViewports gl_MinProgramTexelOffset '
// Variables
+ 'gl_BackColor gl_BackLightModelProduct gl_BackLightProduct gl_BackMaterial '
+ 'gl_BackSecondaryColor gl_ClipDistance gl_ClipPlane gl_ClipVertex gl_Color '
+ 'gl_DepthRange gl_EyePlaneQ gl_EyePlaneR gl_EyePlaneS gl_EyePlaneT gl_Fog gl_FogCoord '
+ 'gl_FogFragCoord gl_FragColor gl_FragCoord gl_FragData gl_FragDepth gl_FrontColor '
+ 'gl_FrontFacing gl_FrontLightModelProduct gl_FrontLightProduct gl_FrontMaterial '
+ 'gl_FrontSecondaryColor gl_GlobalInvocationID gl_InstanceID gl_InvocationID gl_Layer gl_LightModel '
+ 'gl_LightSource gl_LocalInvocationID gl_LocalInvocationIndex gl_ModelViewMatrix '
+ 'gl_ModelViewMatrixInverse gl_ModelViewMatrixInverseTranspose gl_ModelViewMatrixTranspose '
+ 'gl_ModelViewProjectionMatrix gl_ModelViewProjectionMatrixInverse gl_ModelViewProjectionMatrixInverseTranspose '
+ 'gl_ModelViewProjectionMatrixTranspose gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 '
+ 'gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 '
+ 'gl_Normal gl_NormalMatrix gl_NormalScale gl_NumSamples gl_NumWorkGroups gl_ObjectPlaneQ '
+ 'gl_ObjectPlaneR gl_ObjectPlaneS gl_ObjectPlaneT gl_PatchVerticesIn gl_Point gl_PointCoord '
+ 'gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_ProjectionMatrix gl_ProjectionMatrixInverse '
+ 'gl_ProjectionMatrixInverseTranspose gl_ProjectionMatrixTranspose gl_SampleID gl_SampleMask '
+ 'gl_SampleMaskIn gl_SamplePosition gl_SecondaryColor gl_TessCoord gl_TessLevelInner gl_TessLevelOuter '
+ 'gl_TexCoord gl_TextureEnvColor gl_TextureMatrix gl_TextureMatrixInverse gl_TextureMatrixInverseTranspose '
+ 'gl_TextureMatrixTranspose gl_Vertex gl_VertexID gl_ViewportIndex gl_WorkGroupID gl_WorkGroupSize gl_in gl_out '
// Functions
+ 'EmitStreamVertex EmitVertex EndPrimitive EndStreamPrimitive abs acos acosh all any asin '
+ 'asinh atan atanh atomicAdd atomicAnd atomicCompSwap atomicCounter atomicCounterDecrement '
+ 'atomicCounterIncrement atomicExchange atomicMax atomicMin atomicOr atomicXor barrier '
+ 'bitCount bitfieldExtract bitfieldInsert bitfieldReverse ceil clamp cos cosh cross '
+ 'dFdx dFdy degrees determinant distance dot equal exp exp2 faceforward findLSB findMSB '
+ 'floatBitsToInt floatBitsToUint floor fma fract frexp ftransform fwidth greaterThan '
+ 'greaterThanEqual groupMemoryBarrier imageAtomicAdd imageAtomicAnd imageAtomicCompSwap '
+ 'imageAtomicExchange imageAtomicMax imageAtomicMin imageAtomicOr imageAtomicXor imageLoad '
+ 'imageSize imageStore imulExtended intBitsToFloat interpolateAtCentroid interpolateAtOffset '
+ 'interpolateAtSample inverse inversesqrt isinf isnan ldexp length lessThan lessThanEqual log '
+ 'log2 matrixCompMult max memoryBarrier memoryBarrierAtomicCounter memoryBarrierBuffer '
+ 'memoryBarrierImage memoryBarrierShared min mix mod modf noise1 noise2 noise3 noise4 '
+ 'normalize not notEqual outerProduct packDouble2x32 packHalf2x16 packSnorm2x16 packSnorm4x8 '
+ 'packUnorm2x16 packUnorm4x8 pow radians reflect refract round roundEven shadow1D shadow1DLod '
+ 'shadow1DProj shadow1DProjLod shadow2D shadow2DLod shadow2DProj shadow2DProjLod sign sin sinh '
+ 'smoothstep sqrt step tan tanh texelFetch texelFetchOffset texture texture1D texture1DLod '
+ 'texture1DProj texture1DProjLod texture2D texture2DLod texture2DProj texture2DProjLod '
+ 'texture3D texture3DLod texture3DProj texture3DProjLod textureCube textureCubeLod '
+ 'textureGather textureGatherOffset textureGatherOffsets textureGrad textureGradOffset '
+ 'textureLod textureLodOffset textureOffset textureProj textureProjGrad textureProjGradOffset '
+ 'textureProjLod textureProjLodOffset textureProjOffset textureQueryLevels textureQueryLod '
+ 'textureSize transpose trunc uaddCarry uintBitsToFloat umulExtended unpackDouble2x32 '
+ 'unpackHalf2x16 unpackSnorm2x16 unpackSnorm4x8 unpackUnorm2x16 unpackUnorm4x8 usubBorrow',
literal: 'true false'
},
illegal: '"',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.C_NUMBER_MODE,
{
className: 'meta',
begin: '#',
end: '$'
}
]
};
}
module.exports = glsl;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/glsl" instead of "highlight.js/lib/languages/glsl.js"'
);
}
}
emitWarning();
module.exports = require('./glsl.js');

View File

@@ -0,0 +1,81 @@
/*
Language: Golo
Author: Philippe Charriere <ph.charriere@gmail.com>
Description: a lightweight dynamic language for the JVM
Website: http://golo-lang.org/
Category: system
*/
function golo(hljs) {
const KEYWORDS = [
"println",
"readln",
"print",
"import",
"module",
"function",
"local",
"return",
"let",
"var",
"while",
"for",
"foreach",
"times",
"in",
"case",
"when",
"match",
"with",
"break",
"continue",
"augment",
"augmentation",
"each",
"find",
"filter",
"reduce",
"if",
"then",
"else",
"otherwise",
"try",
"catch",
"finally",
"raise",
"throw",
"orIfNull",
"DynamicObject|10",
"DynamicVariable",
"struct",
"Observable",
"map",
"set",
"vector",
"list",
"array"
];
return {
name: 'Golo',
keywords: {
keyword: KEYWORDS,
literal: [
"true",
"false",
"null"
]
},
contains: [
hljs.HASH_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.C_NUMBER_MODE,
{
className: 'meta',
begin: '@[A-Za-z]+'
}
]
};
}
module.exports = golo;

View File

@@ -0,0 +1,113 @@
/*
Language: HAML
Requires: ruby.js
Author: Dan Allen <dan.j.allen@gmail.com>
Website: http://haml.info
Category: template
*/
// TODO support filter tags like :javascript, support inline HTML
function haml(hljs) {
return {
name: 'HAML',
case_insensitive: true,
contains: [
{
className: 'meta',
begin: '^!!!( (5|1\\.1|Strict|Frameset|Basic|Mobile|RDFa|XML\\b.*))?$',
relevance: 10
},
// FIXME these comments should be allowed to span indented lines
hljs.COMMENT(
'^\\s*(!=#|=#|-#|/).*$',
null,
{ relevance: 0 }
),
{
begin: '^\\s*(-|=|!=)(?!#)',
end: /$/,
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true
},
{
className: 'tag',
begin: '^\\s*%',
contains: [
{
className: 'selector-tag',
begin: '\\w+'
},
{
className: 'selector-id',
begin: '#[\\w-]+'
},
{
className: 'selector-class',
begin: '\\.[\\w-]+'
},
{
begin: /\{\s*/,
end: /\s*\}/,
contains: [
{
begin: ':\\w+\\s*=>',
end: ',\\s+',
returnBegin: true,
endsWithParent: true,
contains: [
{
className: 'attr',
begin: ':\\w+'
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{
begin: '\\w+',
relevance: 0
}
]
}
]
},
{
begin: '\\(\\s*',
end: '\\s*\\)',
excludeEnd: true,
contains: [
{
begin: '\\w+\\s*=',
end: '\\s+',
returnBegin: true,
endsWithParent: true,
contains: [
{
className: 'attr',
begin: '\\w+',
relevance: 0
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{
begin: '\\w+',
relevance: 0
}
]
}
]
}
]
},
{ begin: '^\\s*[=~]\\s*' },
{
begin: /#\{/,
end: /\}/,
subLanguage: 'ruby',
excludeBegin: true,
excludeEnd: true
}
]
};
}
module.exports = haml;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/haml" instead of "highlight.js/lib/languages/haml.js"'
);
}
}
emitWarning();
module.exports = require('./haml.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/hsp" instead of "highlight.js/lib/languages/hsp.js"'
);
}
}
emitWarning();
module.exports = require('./hsp.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/http" instead of "highlight.js/lib/languages/http.js"'
);
}
}
emitWarning();
module.exports = require('./http.js');

137
frontend/node_modules/highlight.js/lib/languages/hy.js generated vendored Normal file
View File

@@ -0,0 +1,137 @@
/*
Language: Hy
Description: Hy is a wonderful dialect of Lisp thats embedded in Python.
Author: Sergey Sobko <s.sobko@profitware.ru>
Website: http://docs.hylang.org/en/stable/
Category: lisp
*/
function hy(hljs) {
const SYMBOLSTART = 'a-zA-Z_\\-!.?+*=<>&#\'';
const SYMBOL_RE = '[' + SYMBOLSTART + '][' + SYMBOLSTART + '0-9/;:]*';
const keywords = {
$pattern: SYMBOL_RE,
built_in:
// keywords
'!= % %= & &= * ** **= *= *map '
+ '+ += , --build-class-- --import-- -= . / // //= '
+ '/= < << <<= <= = > >= >> >>= '
+ '@ @= ^ ^= abs accumulate all and any ap-compose '
+ 'ap-dotimes ap-each ap-each-while ap-filter ap-first ap-if ap-last ap-map ap-map-when ap-pipe '
+ 'ap-reduce ap-reject apply as-> ascii assert assoc bin break butlast '
+ 'callable calling-module-name car case cdr chain chr coll? combinations compile '
+ 'compress cond cons cons? continue count curry cut cycle dec '
+ 'def default-method defclass defmacro defmacro-alias defmacro/g! defmain defmethod defmulti defn '
+ 'defn-alias defnc defnr defreader defseq del delattr delete-route dict-comp dir '
+ 'disassemble dispatch-reader-macro distinct divmod do doto drop drop-last drop-while empty? '
+ 'end-sequence eval eval-and-compile eval-when-compile even? every? except exec filter first '
+ 'flatten float? fn fnc fnr for for* format fraction genexpr '
+ 'gensym get getattr global globals group-by hasattr hash hex id '
+ 'identity if if* if-not if-python2 import in inc input instance? '
+ 'integer integer-char? integer? interleave interpose is is-coll is-cons is-empty is-even '
+ 'is-every is-float is-instance is-integer is-integer-char is-iterable is-iterator is-keyword is-neg is-none '
+ 'is-not is-numeric is-odd is-pos is-string is-symbol is-zero isinstance islice issubclass '
+ 'iter iterable? iterate iterator? keyword keyword? lambda last len let '
+ 'lif lif-not list* list-comp locals loop macro-error macroexpand macroexpand-1 macroexpand-all '
+ 'map max merge-with method-decorator min multi-decorator multicombinations name neg? next '
+ 'none? nonlocal not not-in not? nth numeric? oct odd? open '
+ 'or ord partition permutations pos? post-route postwalk pow prewalk print '
+ 'product profile/calls profile/cpu put-route quasiquote quote raise range read read-str '
+ 'recursive-replace reduce remove repeat repeatedly repr require rest round route '
+ 'route-with-methods rwm second seq set-comp setattr setv some sorted string '
+ 'string? sum switch symbol? take take-nth take-while tee try unless '
+ 'unquote unquote-splicing vars walk when while with with* with-decorator with-gensyms '
+ 'xi xor yield yield-from zero? zip zip-longest | |= ~'
};
const SIMPLE_NUMBER_RE = '[-+]?\\d+(\\.\\d+)?';
const SYMBOL = {
begin: SYMBOL_RE,
relevance: 0
};
const NUMBER = {
className: 'number',
begin: SIMPLE_NUMBER_RE,
relevance: 0
};
const STRING = hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null });
const COMMENT = hljs.COMMENT(
';',
'$',
{ relevance: 0 }
);
const LITERAL = {
className: 'literal',
begin: /\b([Tt]rue|[Ff]alse|nil|None)\b/
};
const COLLECTION = {
begin: '[\\[\\{]',
end: '[\\]\\}]',
relevance: 0
};
const HINT = {
className: 'comment',
begin: '\\^' + SYMBOL_RE
};
const HINT_COL = hljs.COMMENT('\\^\\{', '\\}');
const KEY = {
className: 'symbol',
begin: '[:]{1,2}' + SYMBOL_RE
};
const LIST = {
begin: '\\(',
end: '\\)'
};
const BODY = {
endsWithParent: true,
relevance: 0
};
const NAME = {
className: 'name',
relevance: 0,
keywords: keywords,
begin: SYMBOL_RE,
starts: BODY
};
const DEFAULT_CONTAINS = [
LIST,
STRING,
HINT,
HINT_COL,
COMMENT,
KEY,
COLLECTION,
NUMBER,
LITERAL,
SYMBOL
];
LIST.contains = [
hljs.COMMENT('comment', ''),
NAME,
BODY
];
BODY.contains = DEFAULT_CONTAINS;
COLLECTION.contains = DEFAULT_CONTAINS;
return {
name: 'Hy',
aliases: [ 'hylang' ],
illegal: /\S/,
contains: [
hljs.SHEBANG(),
LIST,
STRING,
HINT,
HINT_COL,
COMMENT,
KEY,
COLLECTION,
NUMBER,
LITERAL
]
};
}
module.exports = hy;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/hy" instead of "highlight.js/lib/languages/hy.js"'
);
}
}
emitWarning();
module.exports = require('./hy.js');

3205
frontend/node_modules/highlight.js/lib/languages/isbl.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/javascript" instead of "highlight.js/lib/languages/javascript.js"'
);
}
}
emitWarning();
module.exports = require('./javascript.js');

View File

@@ -0,0 +1,63 @@
/*
Language: JBoss CLI
Author: Raphaël Parrëe <rparree@edc4it.com>
Description: language definition jboss cli
Website: https://docs.jboss.org/author/display/WFLY/Command+Line+Interface
Category: config
*/
function jbossCli(hljs) {
const PARAM = {
begin: /[\w-]+ *=/,
returnBegin: true,
relevance: 0,
contains: [
{
className: 'attr',
begin: /[\w-]+/
}
]
};
const PARAMSBLOCK = {
className: 'params',
begin: /\(/,
end: /\)/,
contains: [ PARAM ],
relevance: 0
};
const OPERATION = {
className: 'function',
begin: /:[\w\-.]+/,
relevance: 0
};
const PATH = {
className: 'string',
begin: /\B([\/.])[\w\-.\/=]+/
};
const COMMAND_PARAMS = {
className: 'params',
begin: /--[\w\-=\/]+/
};
return {
name: 'JBoss CLI',
aliases: [ 'wildfly-cli' ],
keywords: {
$pattern: '[a-z\-]+',
keyword: 'alias batch cd clear command connect connection-factory connection-info data-source deploy '
+ 'deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls '
+ 'patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias '
+ 'undeploy unset version xa-data-source', // module
literal: 'true false'
},
contains: [
hljs.HASH_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
COMMAND_PARAMS,
OPERATION,
PATH,
PARAMSBLOCK
]
};
}
module.exports = jbossCli;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/julia" instead of "highlight.js/lib/languages/julia.js"'
);
}
}
emitWarning();
module.exports = require('./julia.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/ldif" instead of "highlight.js/lib/languages/ldif.js"'
);
}
}
emitWarning();
module.exports = require('./ldif.js');

View File

@@ -0,0 +1,135 @@
/*
Language: LLVM IR
Author: Michael Rodler <contact@f0rki.at>
Description: language used as intermediate representation in the LLVM compiler framework
Website: https://llvm.org/docs/LangRef.html
Category: assembler
Audit: 2020
*/
/** @type LanguageFn */
function llvm(hljs) {
const regex = hljs.regex;
const IDENT_RE = /([-a-zA-Z$._][\w$.-]*)/;
const TYPE = {
className: 'type',
begin: /\bi\d+(?=\s|\b)/
};
const OPERATOR = {
className: 'operator',
relevance: 0,
begin: /=/
};
const PUNCTUATION = {
className: 'punctuation',
relevance: 0,
begin: /,/
};
const NUMBER = {
className: 'number',
variants: [
{ begin: /[su]?0[xX][KMLHR]?[a-fA-F0-9]+/ },
{ begin: /[-+]?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?/ }
],
relevance: 0
};
const LABEL = {
className: 'symbol',
variants: [ { begin: /^\s*[a-z]+:/ }, // labels
],
relevance: 0
};
const VARIABLE = {
className: 'variable',
variants: [
{ begin: regex.concat(/%/, IDENT_RE) },
{ begin: /%\d+/ },
{ begin: /#\d+/ },
]
};
const FUNCTION = {
className: 'title',
variants: [
{ begin: regex.concat(/@/, IDENT_RE) },
{ begin: /@\d+/ },
{ begin: regex.concat(/!/, IDENT_RE) },
{ begin: regex.concat(/!\d+/, IDENT_RE) },
// https://llvm.org/docs/LangRef.html#namedmetadatastructure
// obviously a single digit can also be used in this fashion
{ begin: /!\d+/ }
]
};
return {
name: 'LLVM IR',
// TODO: split into different categories of keywords
keywords: {
keyword: 'begin end true false declare define global '
+ 'constant private linker_private internal '
+ 'available_externally linkonce linkonce_odr weak '
+ 'weak_odr appending dllimport dllexport common '
+ 'default hidden protected extern_weak external '
+ 'thread_local zeroinitializer undef null to tail '
+ 'target triple datalayout volatile nuw nsw nnan '
+ 'ninf nsz arcp fast exact inbounds align '
+ 'addrspace section alias module asm sideeffect '
+ 'gc dbg linker_private_weak attributes blockaddress '
+ 'initialexec localdynamic localexec prefix unnamed_addr '
+ 'ccc fastcc coldcc x86_stdcallcc x86_fastcallcc '
+ 'arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device '
+ 'ptx_kernel intel_ocl_bicc msp430_intrcc spir_func '
+ 'spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc '
+ 'cc c signext zeroext inreg sret nounwind '
+ 'noreturn noalias nocapture byval nest readnone '
+ 'readonly inlinehint noinline alwaysinline optsize ssp '
+ 'sspreq noredzone noimplicitfloat naked builtin cold '
+ 'nobuiltin noduplicate nonlazybind optnone returns_twice '
+ 'sanitize_address sanitize_memory sanitize_thread sspstrong '
+ 'uwtable returned type opaque eq ne slt sgt '
+ 'sle sge ult ugt ule uge oeq one olt ogt '
+ 'ole oge ord uno ueq une x acq_rel acquire '
+ 'alignstack atomic catch cleanup filter inteldialect '
+ 'max min monotonic nand personality release seq_cst '
+ 'singlethread umax umin unordered xchg add fadd '
+ 'sub fsub mul fmul udiv sdiv fdiv urem srem '
+ 'frem shl lshr ashr and or xor icmp fcmp '
+ 'phi call trunc zext sext fptrunc fpext uitofp '
+ 'sitofp fptoui fptosi inttoptr ptrtoint bitcast '
+ 'addrspacecast select va_arg ret br switch invoke '
+ 'unwind unreachable indirectbr landingpad resume '
+ 'malloc alloca free load store getelementptr '
+ 'extractelement insertelement shufflevector getresult '
+ 'extractvalue insertvalue atomicrmw cmpxchg fence '
+ 'argmemonly',
type: 'void half bfloat float double fp128 x86_fp80 ppc_fp128 '
+ 'x86_amx x86_mmx ptr label token metadata opaque'
},
contains: [
TYPE,
// this matches "empty comments"...
// ...because it's far more likely this is a statement terminator in
// another language than an actual comment
hljs.COMMENT(/;\s*$/, null, { relevance: 0 }),
hljs.COMMENT(/;/, /$/),
{
className: 'string',
begin: /"/,
end: /"/,
contains: [
{
className: 'char.escape',
match: /\\\d\d/
}
]
},
FUNCTION,
PUNCTUATION,
OPERATOR,
VARIABLE,
LABEL,
NUMBER
]
};
}
module.exports = llvm;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/llvm" instead of "highlight.js/lib/languages/llvm.js"'
);
}
}
emitWarning();
module.exports = require('./llvm.js');

View File

@@ -0,0 +1,248 @@
/*
Language: Markdown
Requires: xml.js
Author: John Crepezzi <john.crepezzi@gmail.com>
Website: https://daringfireball.net/projects/markdown/
Category: common, markup
*/
function markdown(hljs) {
const regex = hljs.regex;
const INLINE_HTML = {
begin: /<\/?[A-Za-z_]/,
end: '>',
subLanguage: 'xml',
relevance: 0
};
const HORIZONTAL_RULE = {
begin: '^[-\\*]{3,}',
end: '$'
};
const CODE = {
className: 'code',
variants: [
// TODO: fix to allow these to work with sublanguage also
{ begin: '(`{3,})[^`](.|\\n)*?\\1`*[ ]*' },
{ begin: '(~{3,})[^~](.|\\n)*?\\1~*[ ]*' },
// needed to allow markdown as a sublanguage to work
{
begin: '```',
end: '```+[ ]*$'
},
{
begin: '~~~',
end: '~~~+[ ]*$'
},
{ begin: '`.+?`' },
{
begin: '(?=^( {4}|\\t))',
// use contains to gobble up multiple lines to allow the block to be whatever size
// but only have a single open/close tag vs one per line
contains: [
{
begin: '^( {4}|\\t)',
end: '(\\n)$'
}
],
relevance: 0
}
]
};
const LIST = {
className: 'bullet',
begin: '^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)',
end: '\\s+',
excludeEnd: true
};
const LINK_REFERENCE = {
begin: /^\[[^\n]+\]:/,
returnBegin: true,
contains: [
{
className: 'symbol',
begin: /\[/,
end: /\]/,
excludeBegin: true,
excludeEnd: true
},
{
className: 'link',
begin: /:\s*/,
end: /$/,
excludeBegin: true
}
]
};
const URL_SCHEME = /[A-Za-z][A-Za-z0-9+.-]*/;
const LINK = {
variants: [
// too much like nested array access in so many languages
// to have any real relevance
{
begin: /\[.+?\]\[.*?\]/,
relevance: 0
},
// popular internet URLs
{
begin: /\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,
relevance: 2
},
{
begin: regex.concat(/\[.+?\]\(/, URL_SCHEME, /:\/\/.*?\)/),
relevance: 2
},
// relative urls
{
begin: /\[.+?\]\([./?&#].*?\)/,
relevance: 1
},
// whatever else, lower relevance (might not be a link at all)
{
begin: /\[.*?\]\(.*?\)/,
relevance: 0
}
],
returnBegin: true,
contains: [
{
// empty strings for alt or link text
match: /\[(?=\])/ },
{
className: 'string',
relevance: 0,
begin: '\\[',
end: '\\]',
excludeBegin: true,
returnEnd: true
},
{
className: 'link',
relevance: 0,
begin: '\\]\\(',
end: '\\)',
excludeBegin: true,
excludeEnd: true
},
{
className: 'symbol',
relevance: 0,
begin: '\\]\\[',
end: '\\]',
excludeBegin: true,
excludeEnd: true
}
]
};
const BOLD = {
className: 'strong',
contains: [], // defined later
variants: [
{
begin: /_{2}(?!\s)/,
end: /_{2}/
},
{
begin: /\*{2}(?!\s)/,
end: /\*{2}/
}
]
};
const ITALIC = {
className: 'emphasis',
contains: [], // defined later
variants: [
{
begin: /\*(?![*\s])/,
end: /\*/
},
{
begin: /_(?![_\s])/,
end: /_/,
relevance: 0
}
]
};
// 3 level deep nesting is not allowed because it would create confusion
// in cases like `***testing***` because where we don't know if the last
// `***` is starting a new bold/italic or finishing the last one
const BOLD_WITHOUT_ITALIC = hljs.inherit(BOLD, { contains: [] });
const ITALIC_WITHOUT_BOLD = hljs.inherit(ITALIC, { contains: [] });
BOLD.contains.push(ITALIC_WITHOUT_BOLD);
ITALIC.contains.push(BOLD_WITHOUT_ITALIC);
let CONTAINABLE = [
INLINE_HTML,
LINK
];
[
BOLD,
ITALIC,
BOLD_WITHOUT_ITALIC,
ITALIC_WITHOUT_BOLD
].forEach(m => {
m.contains = m.contains.concat(CONTAINABLE);
});
CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);
const HEADER = {
className: 'section',
variants: [
{
begin: '^#{1,6}',
end: '$',
contains: CONTAINABLE
},
{
begin: '(?=^.+?\\n[=-]{2,}$)',
contains: [
{ begin: '^[=-]*$' },
{
begin: '^',
end: "\\n",
contains: CONTAINABLE
}
]
}
]
};
const BLOCKQUOTE = {
className: 'quote',
begin: '^>\\s+',
contains: CONTAINABLE,
end: '$'
};
const ENTITY = {
//https://spec.commonmark.org/0.31.2/#entity-references
scope: 'literal',
match: /&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/
};
return {
name: 'Markdown',
aliases: [
'md',
'mkdown',
'mkd'
],
contains: [
HEADER,
INLINE_HTML,
LIST,
BOLD,
ITALIC,
BLOCKQUOTE,
CODE,
HORIZONTAL_RULE,
LINK,
LINK_REFERENCE,
ENTITY
]
};
}
module.exports = markdown;

View File

@@ -0,0 +1,107 @@
/*
Language: Matlab
Author: Denis Bardadym <bardadymchik@gmail.com>
Contributors: Eugene Nizhibitsky <nizhibitsky@ya.ru>, Egor Rogov <e.rogov@postgrespro.ru>
Website: https://www.mathworks.com/products/matlab.html
Category: scientific
*/
/*
Formal syntax is not published, helpful link:
https://github.com/kornilova-l/matlab-IntelliJ-plugin/blob/master/src/main/grammar/Matlab.bnf
*/
function matlab(hljs) {
const TRANSPOSE_RE = '(\'|\\.\')+';
const TRANSPOSE = {
relevance: 0,
contains: [ { begin: TRANSPOSE_RE } ]
};
return {
name: 'Matlab',
keywords: {
keyword:
'arguments break case catch classdef continue else elseif end enumeration events for function '
+ 'global if methods otherwise parfor persistent properties return spmd switch try while',
built_in:
'sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan '
+ 'atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot '
+ 'cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog '
+ 'realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal '
+ 'cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli '
+ 'besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma '
+ 'gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms '
+ 'nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones '
+ 'eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length '
+ 'ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril '
+ 'triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute '
+ 'shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i|0 inf nan '
+ 'isnan isinf isfinite j|0 why compan gallery hadamard hankel hilb invhilb magic pascal '
+ 'rosser toeplitz vander wilkinson max min nanmax nanmin mean nanmean type table '
+ 'readtable writetable sortrows sort figure plot plot3 scatter scatter3 cellfun '
+ 'legend intersect ismember procrustes hold num2cell '
},
illegal: '(//|"|#|/\\*|\\s+/\\w+)',
contains: [
{
className: 'function',
beginKeywords: 'function',
end: '$',
contains: [
hljs.UNDERSCORE_TITLE_MODE,
{
className: 'params',
variants: [
{
begin: '\\(',
end: '\\)'
},
{
begin: '\\[',
end: '\\]'
}
]
}
]
},
{
className: 'built_in',
begin: /true|false/,
relevance: 0,
starts: TRANSPOSE
},
{
begin: '[a-zA-Z][a-zA-Z_0-9]*' + TRANSPOSE_RE,
relevance: 0
},
{
className: 'number',
begin: hljs.C_NUMBER_RE,
relevance: 0,
starts: TRANSPOSE
},
{
className: 'string',
begin: '\'',
end: '\'',
contains: [ { begin: '\'\'' } ]
},
{
begin: /\]|\}|\)/,
relevance: 0,
starts: TRANSPOSE
},
{
className: 'string',
begin: '"',
end: '"',
contains: [ { begin: '""' } ],
starts: TRANSPOSE
},
hljs.COMMENT('^\\s*%\\{\\s*$', '^\\s*%\\}\\s*$'),
hljs.COMMENT('%', '$')
]
};
}
module.exports = matlab;

View File

@@ -0,0 +1,414 @@
/*
Language: Maxima
Author: Robert Dodier <robert.dodier@gmail.com>
Website: http://maxima.sourceforge.net
Category: scientific
*/
function maxima(hljs) {
const KEYWORDS =
'if then else elseif for thru do while unless step in and or not';
const LITERALS =
'true false unknown inf minf ind und %e %i %pi %phi %gamma';
const BUILTIN_FUNCTIONS =
' abasep abs absint absolute_real_time acos acosh acot acoth acsc acsch activate'
+ ' addcol add_edge add_edges addmatrices addrow add_vertex add_vertices adjacency_matrix'
+ ' adjoin adjoint af agd airy airy_ai airy_bi airy_dai airy_dbi algsys alg_type'
+ ' alias allroots alphacharp alphanumericp amortization %and annuity_fv'
+ ' annuity_pv antid antidiff AntiDifference append appendfile apply apply1 apply2'
+ ' applyb1 apropos args arit_amortization arithmetic arithsum array arrayapply'
+ ' arrayinfo arraymake arraysetapply ascii asec asech asin asinh askinteger'
+ ' asksign assoc assoc_legendre_p assoc_legendre_q assume assume_external_byte_order'
+ ' asympa at atan atan2 atanh atensimp atom atvalue augcoefmatrix augmented_lagrangian_method'
+ ' av average_degree backtrace bars barsplot barsplot_description base64 base64_decode'
+ ' bashindices batch batchload bc2 bdvac belln benefit_cost bern bernpoly bernstein_approx'
+ ' bernstein_expand bernstein_poly bessel bessel_i bessel_j bessel_k bessel_simplify'
+ ' bessel_y beta beta_incomplete beta_incomplete_generalized beta_incomplete_regularized'
+ ' bezout bfallroots bffac bf_find_root bf_fmin_cobyla bfhzeta bfloat bfloatp'
+ ' bfpsi bfpsi0 bfzeta biconnected_components bimetric binomial bipartition'
+ ' block blockmatrixp bode_gain bode_phase bothcoef box boxplot boxplot_description'
+ ' break bug_report build_info|10 buildq build_sample burn cabs canform canten'
+ ' cardinality carg cartan cartesian_product catch cauchy_matrix cbffac cdf_bernoulli'
+ ' cdf_beta cdf_binomial cdf_cauchy cdf_chi2 cdf_continuous_uniform cdf_discrete_uniform'
+ ' cdf_exp cdf_f cdf_gamma cdf_general_finite_discrete cdf_geometric cdf_gumbel'
+ ' cdf_hypergeometric cdf_laplace cdf_logistic cdf_lognormal cdf_negative_binomial'
+ ' cdf_noncentral_chi2 cdf_noncentral_student_t cdf_normal cdf_pareto cdf_poisson'
+ ' cdf_rank_sum cdf_rayleigh cdf_signed_rank cdf_student_t cdf_weibull cdisplay'
+ ' ceiling central_moment cequal cequalignore cf cfdisrep cfexpand cgeodesic'
+ ' cgreaterp cgreaterpignore changename changevar chaosgame charat charfun charfun2'
+ ' charlist charp charpoly chdir chebyshev_t chebyshev_u checkdiv check_overlaps'
+ ' chinese cholesky christof chromatic_index chromatic_number cint circulant_graph'
+ ' clear_edge_weight clear_rules clear_vertex_label clebsch_gordan clebsch_graph'
+ ' clessp clesspignore close closefile cmetric coeff coefmatrix cograd col collapse'
+ ' collectterms columnop columnspace columnswap columnvector combination combine'
+ ' comp2pui compare compfile compile compile_file complement_graph complete_bipartite_graph'
+ ' complete_graph complex_number_p components compose_functions concan concat'
+ ' conjugate conmetderiv connected_components connect_vertices cons constant'
+ ' constantp constituent constvalue cont2part content continuous_freq contortion'
+ ' contour_plot contract contract_edge contragrad contrib_ode convert coord'
+ ' copy copy_file copy_graph copylist copymatrix cor cos cosh cot coth cov cov1'
+ ' covdiff covect covers crc24sum create_graph create_list csc csch csetup cspline'
+ ' ctaylor ct_coordsys ctransform ctranspose cube_graph cuboctahedron_graph'
+ ' cunlisp cv cycle_digraph cycle_graph cylindrical days360 dblint deactivate'
+ ' declare declare_constvalue declare_dimensions declare_fundamental_dimensions'
+ ' declare_fundamental_units declare_qty declare_translated declare_unit_conversion'
+ ' declare_units declare_weights decsym defcon define define_alt_display define_variable'
+ ' defint defmatch defrule defstruct deftaylor degree_sequence del delete deleten'
+ ' delta demo demoivre denom depends derivdegree derivlist describe desolve'
+ ' determinant dfloat dgauss_a dgauss_b dgeev dgemm dgeqrf dgesv dgesvd diag'
+ ' diagmatrix diag_matrix diagmatrixp diameter diff digitcharp dimacs_export'
+ ' dimacs_import dimension dimensionless dimensions dimensions_as_list direct'
+ ' directory discrete_freq disjoin disjointp disolate disp dispcon dispform'
+ ' dispfun dispJordan display disprule dispterms distrib divide divisors divsum'
+ ' dkummer_m dkummer_u dlange dodecahedron_graph dotproduct dotsimp dpart'
+ ' draw draw2d draw3d drawdf draw_file draw_graph dscalar echelon edge_coloring'
+ ' edge_connectivity edges eigens_by_jacobi eigenvalues eigenvectors eighth'
+ ' einstein eivals eivects elapsed_real_time elapsed_run_time ele2comp ele2polynome'
+ ' ele2pui elem elementp elevation_grid elim elim_allbut eliminate eliminate_using'
+ ' ellipse elliptic_e elliptic_ec elliptic_eu elliptic_f elliptic_kc elliptic_pi'
+ ' ematrix empty_graph emptyp endcons entermatrix entertensor entier equal equalp'
+ ' equiv_classes erf erfc erf_generalized erfi errcatch error errormsg errors'
+ ' euler ev eval_string evenp every evolution evolution2d evundiff example exp'
+ ' expand expandwrt expandwrt_factored expint expintegral_chi expintegral_ci'
+ ' expintegral_e expintegral_e1 expintegral_ei expintegral_e_simplify expintegral_li'
+ ' expintegral_shi expintegral_si explicit explose exponentialize express expt'
+ ' exsec extdiff extract_linear_equations extremal_subset ezgcd %f f90 facsum'
+ ' factcomb factor factorfacsum factorial factorout factorsum facts fast_central_elements'
+ ' fast_linsolve fasttimes featurep fernfale fft fib fibtophi fifth filename_merge'
+ ' file_search file_type fillarray findde find_root find_root_abs find_root_error'
+ ' find_root_rel first fix flatten flength float floatnump floor flower_snark'
+ ' flush flush1deriv flushd flushnd flush_output fmin_cobyla forget fortran'
+ ' fourcos fourexpand fourier fourier_elim fourint fourintcos fourintsin foursimp'
+ ' foursin fourth fposition frame_bracket freeof freshline fresnel_c fresnel_s'
+ ' from_adjacency_matrix frucht_graph full_listify fullmap fullmapl fullratsimp'
+ ' fullratsubst fullsetify funcsolve fundamental_dimensions fundamental_units'
+ ' fundef funmake funp fv g0 g1 gamma gamma_greek gamma_incomplete gamma_incomplete_generalized'
+ ' gamma_incomplete_regularized gauss gauss_a gauss_b gaussprob gcd gcdex gcdivide'
+ ' gcfac gcfactor gd generalized_lambert_w genfact gen_laguerre genmatrix gensym'
+ ' geo_amortization geo_annuity_fv geo_annuity_pv geomap geometric geometric_mean'
+ ' geosum get getcurrentdirectory get_edge_weight getenv get_lu_factors get_output_stream_string'
+ ' get_pixel get_plot_option get_tex_environment get_tex_environment_default'
+ ' get_vertex_label gfactor gfactorsum ggf girth global_variances gn gnuplot_close'
+ ' gnuplot_replot gnuplot_reset gnuplot_restart gnuplot_start go Gosper GosperSum'
+ ' gr2d gr3d gradef gramschmidt graph6_decode graph6_encode graph6_export graph6_import'
+ ' graph_center graph_charpoly graph_eigenvalues graph_flow graph_order graph_periphery'
+ ' graph_product graph_size graph_union great_rhombicosidodecahedron_graph great_rhombicuboctahedron_graph'
+ ' grid_graph grind grobner_basis grotzch_graph hamilton_cycle hamilton_path'
+ ' hankel hankel_1 hankel_2 harmonic harmonic_mean hav heawood_graph hermite'
+ ' hessian hgfred hilbertmap hilbert_matrix hipow histogram histogram_description'
+ ' hodge horner hypergeometric i0 i1 %ibes ic1 ic2 ic_convert ichr1 ichr2 icosahedron_graph'
+ ' icosidodecahedron_graph icurvature ident identfor identity idiff idim idummy'
+ ' ieqn %if ifactors iframes ifs igcdex igeodesic_coords ilt image imagpart'
+ ' imetric implicit implicit_derivative implicit_plot indexed_tensor indices'
+ ' induced_subgraph inferencep inference_result infix info_display init_atensor'
+ ' init_ctensor in_neighbors innerproduct inpart inprod inrt integerp integer_partitions'
+ ' integrate intersect intersection intervalp intopois intosum invariant1 invariant2'
+ ' inverse_fft inverse_jacobi_cd inverse_jacobi_cn inverse_jacobi_cs inverse_jacobi_dc'
+ ' inverse_jacobi_dn inverse_jacobi_ds inverse_jacobi_nc inverse_jacobi_nd inverse_jacobi_ns'
+ ' inverse_jacobi_sc inverse_jacobi_sd inverse_jacobi_sn invert invert_by_adjoint'
+ ' invert_by_lu inv_mod irr is is_biconnected is_bipartite is_connected is_digraph'
+ ' is_edge_in_graph is_graph is_graph_or_digraph ishow is_isomorphic isolate'
+ ' isomorphism is_planar isqrt isreal_p is_sconnected is_tree is_vertex_in_graph'
+ ' items_inference %j j0 j1 jacobi jacobian jacobi_cd jacobi_cn jacobi_cs jacobi_dc'
+ ' jacobi_dn jacobi_ds jacobi_nc jacobi_nd jacobi_ns jacobi_p jacobi_sc jacobi_sd'
+ ' jacobi_sn JF jn join jordan julia julia_set julia_sin %k kdels kdelta kill'
+ ' killcontext kostka kron_delta kronecker_product kummer_m kummer_u kurtosis'
+ ' kurtosis_bernoulli kurtosis_beta kurtosis_binomial kurtosis_chi2 kurtosis_continuous_uniform'
+ ' kurtosis_discrete_uniform kurtosis_exp kurtosis_f kurtosis_gamma kurtosis_general_finite_discrete'
+ ' kurtosis_geometric kurtosis_gumbel kurtosis_hypergeometric kurtosis_laplace'
+ ' kurtosis_logistic kurtosis_lognormal kurtosis_negative_binomial kurtosis_noncentral_chi2'
+ ' kurtosis_noncentral_student_t kurtosis_normal kurtosis_pareto kurtosis_poisson'
+ ' kurtosis_rayleigh kurtosis_student_t kurtosis_weibull label labels lagrange'
+ ' laguerre lambda lambert_w laplace laplacian_matrix last lbfgs lc2kdt lcharp'
+ ' lc_l lcm lc_u ldefint ldisp ldisplay legendre_p legendre_q leinstein length'
+ ' let letrules letsimp levi_civita lfreeof lgtreillis lhs li liediff limit'
+ ' Lindstedt linear linearinterpol linear_program linear_regression line_graph'
+ ' linsolve listarray list_correlations listify list_matrix_entries list_nc_monomials'
+ ' listoftens listofvars listp lmax lmin load loadfile local locate_matrix_entry'
+ ' log logcontract log_gamma lopow lorentz_gauge lowercasep lpart lratsubst'
+ ' lreduce lriemann lsquares_estimates lsquares_estimates_approximate lsquares_estimates_exact'
+ ' lsquares_mse lsquares_residual_mse lsquares_residuals lsum ltreillis lu_backsub'
+ ' lucas lu_factor %m macroexpand macroexpand1 make_array makebox makefact makegamma'
+ ' make_graph make_level_picture makelist makeOrders make_poly_continent make_poly_country'
+ ' make_polygon make_random_state make_rgb_picture makeset make_string_input_stream'
+ ' make_string_output_stream make_transform mandelbrot mandelbrot_set map mapatom'
+ ' maplist matchdeclare matchfix mat_cond mat_fullunblocker mat_function mathml_display'
+ ' mat_norm matrix matrixmap matrixp matrix_size mattrace mat_trace mat_unblocker'
+ ' max max_clique max_degree max_flow maximize_lp max_independent_set max_matching'
+ ' maybe md5sum mean mean_bernoulli mean_beta mean_binomial mean_chi2 mean_continuous_uniform'
+ ' mean_deviation mean_discrete_uniform mean_exp mean_f mean_gamma mean_general_finite_discrete'
+ ' mean_geometric mean_gumbel mean_hypergeometric mean_laplace mean_logistic'
+ ' mean_lognormal mean_negative_binomial mean_noncentral_chi2 mean_noncentral_student_t'
+ ' mean_normal mean_pareto mean_poisson mean_rayleigh mean_student_t mean_weibull'
+ ' median median_deviation member mesh metricexpandall mgf1_sha1 min min_degree'
+ ' min_edge_cut minfactorial minimalPoly minimize_lp minimum_spanning_tree minor'
+ ' minpack_lsquares minpack_solve min_vertex_cover min_vertex_cut mkdir mnewton'
+ ' mod mode_declare mode_identity ModeMatrix moebius mon2schur mono monomial_dimensions'
+ ' multibernstein_poly multi_display_for_texinfo multi_elem multinomial multinomial_coeff'
+ ' multi_orbit multiplot_mode multi_pui multsym multthru mycielski_graph nary'
+ ' natural_unit nc_degree ncexpt ncharpoly negative_picture neighbors new newcontext'
+ ' newdet new_graph newline newton new_variable next_prime nicedummies niceindices'
+ ' ninth nofix nonarray noncentral_moment nonmetricity nonnegintegerp nonscalarp'
+ ' nonzeroandfreeof notequal nounify nptetrad npv nroots nterms ntermst'
+ ' nthroot nullity nullspace num numbered_boundaries numberp number_to_octets'
+ ' num_distinct_partitions numerval numfactor num_partitions nusum nzeta nzetai'
+ ' nzetar octets_to_number octets_to_oid odd_girth oddp ode2 ode_check odelin'
+ ' oid_to_octets op opena opena_binary openr openr_binary openw openw_binary'
+ ' operatorp opsubst optimize %or orbit orbits ordergreat ordergreatp orderless'
+ ' orderlessp orthogonal_complement orthopoly_recur orthopoly_weight outermap'
+ ' out_neighbors outofpois pade parabolic_cylinder_d parametric parametric_surface'
+ ' parg parGosper parse_string parse_timedate part part2cont partfrac partition'
+ ' partition_set partpol path_digraph path_graph pathname_directory pathname_name'
+ ' pathname_type pdf_bernoulli pdf_beta pdf_binomial pdf_cauchy pdf_chi2 pdf_continuous_uniform'
+ ' pdf_discrete_uniform pdf_exp pdf_f pdf_gamma pdf_general_finite_discrete'
+ ' pdf_geometric pdf_gumbel pdf_hypergeometric pdf_laplace pdf_logistic pdf_lognormal'
+ ' pdf_negative_binomial pdf_noncentral_chi2 pdf_noncentral_student_t pdf_normal'
+ ' pdf_pareto pdf_poisson pdf_rank_sum pdf_rayleigh pdf_signed_rank pdf_student_t'
+ ' pdf_weibull pearson_skewness permanent permut permutation permutations petersen_graph'
+ ' petrov pickapart picture_equalp picturep piechart piechart_description planar_embedding'
+ ' playback plog plot2d plot3d plotdf ploteq plsquares pochhammer points poisdiff'
+ ' poisexpt poisint poismap poisplus poissimp poissubst poistimes poistrim polar'
+ ' polarform polartorect polar_to_xy poly_add poly_buchberger poly_buchberger_criterion'
+ ' poly_colon_ideal poly_content polydecomp poly_depends_p poly_elimination_ideal'
+ ' poly_exact_divide poly_expand poly_expt poly_gcd polygon poly_grobner poly_grobner_equal'
+ ' poly_grobner_member poly_grobner_subsetp poly_ideal_intersection poly_ideal_polysaturation'
+ ' poly_ideal_polysaturation1 poly_ideal_saturation poly_ideal_saturation1 poly_lcm'
+ ' poly_minimization polymod poly_multiply polynome2ele polynomialp poly_normal_form'
+ ' poly_normalize poly_normalize_list poly_polysaturation_extension poly_primitive_part'
+ ' poly_pseudo_divide poly_reduced_grobner poly_reduction poly_saturation_extension'
+ ' poly_s_polynomial poly_subtract polytocompanion pop postfix potential power_mod'
+ ' powerseries powerset prefix prev_prime primep primes principal_components'
+ ' print printf printfile print_graph printpois printprops prodrac product properties'
+ ' propvars psi psubst ptriangularize pui pui2comp pui2ele pui2polynome pui_direct'
+ ' puireduc push put pv qput qrange qty quad_control quad_qag quad_qagi quad_qagp'
+ ' quad_qags quad_qawc quad_qawf quad_qawo quad_qaws quadrilateral quantile'
+ ' quantile_bernoulli quantile_beta quantile_binomial quantile_cauchy quantile_chi2'
+ ' quantile_continuous_uniform quantile_discrete_uniform quantile_exp quantile_f'
+ ' quantile_gamma quantile_general_finite_discrete quantile_geometric quantile_gumbel'
+ ' quantile_hypergeometric quantile_laplace quantile_logistic quantile_lognormal'
+ ' quantile_negative_binomial quantile_noncentral_chi2 quantile_noncentral_student_t'
+ ' quantile_normal quantile_pareto quantile_poisson quantile_rayleigh quantile_student_t'
+ ' quantile_weibull quartile_skewness quit qunit quotient racah_v racah_w radcan'
+ ' radius random random_bernoulli random_beta random_binomial random_bipartite_graph'
+ ' random_cauchy random_chi2 random_continuous_uniform random_digraph random_discrete_uniform'
+ ' random_exp random_f random_gamma random_general_finite_discrete random_geometric'
+ ' random_graph random_graph1 random_gumbel random_hypergeometric random_laplace'
+ ' random_logistic random_lognormal random_negative_binomial random_network'
+ ' random_noncentral_chi2 random_noncentral_student_t random_normal random_pareto'
+ ' random_permutation random_poisson random_rayleigh random_regular_graph random_student_t'
+ ' random_tournament random_tree random_weibull range rank rat ratcoef ratdenom'
+ ' ratdiff ratdisrep ratexpand ratinterpol rational rationalize ratnumer ratnump'
+ ' ratp ratsimp ratsubst ratvars ratweight read read_array read_binary_array'
+ ' read_binary_list read_binary_matrix readbyte readchar read_hashed_array readline'
+ ' read_list read_matrix read_nested_list readonly read_xpm real_imagpart_to_conjugate'
+ ' realpart realroots rearray rectangle rectform rectform_log_if_constant recttopolar'
+ ' rediff reduce_consts reduce_order region region_boundaries region_boundaries_plus'
+ ' rem remainder remarray rembox remcomps remcon remcoord remfun remfunction'
+ ' remlet remove remove_constvalue remove_dimensions remove_edge remove_fundamental_dimensions'
+ ' remove_fundamental_units remove_plot_option remove_vertex rempart remrule'
+ ' remsym remvalue rename rename_file reset reset_displays residue resolvante'
+ ' resolvante_alternee1 resolvante_bipartite resolvante_diedrale resolvante_klein'
+ ' resolvante_klein3 resolvante_produit_sym resolvante_unitaire resolvante_vierer'
+ ' rest resultant return reveal reverse revert revert2 rgb2level rhs ricci riemann'
+ ' rinvariant risch rk rmdir rncombine romberg room rootscontract round row'
+ ' rowop rowswap rreduce run_testsuite %s save saving scalarp scaled_bessel_i'
+ ' scaled_bessel_i0 scaled_bessel_i1 scalefactors scanmap scatterplot scatterplot_description'
+ ' scene schur2comp sconcat scopy scsimp scurvature sdowncase sec sech second'
+ ' sequal sequalignore set_alt_display setdifference set_draw_defaults set_edge_weight'
+ ' setelmx setequalp setify setp set_partitions set_plot_option set_prompt set_random_state'
+ ' set_tex_environment set_tex_environment_default setunits setup_autoload set_up_dot_simplifications'
+ ' set_vertex_label seventh sexplode sf sha1sum sha256sum shortest_path shortest_weighted_path'
+ ' show showcomps showratvars sierpinskiale sierpinskimap sign signum similaritytransform'
+ ' simp_inequality simplify_sum simplode simpmetderiv simtran sin sinh sinsert'
+ ' sinvertcase sixth skewness skewness_bernoulli skewness_beta skewness_binomial'
+ ' skewness_chi2 skewness_continuous_uniform skewness_discrete_uniform skewness_exp'
+ ' skewness_f skewness_gamma skewness_general_finite_discrete skewness_geometric'
+ ' skewness_gumbel skewness_hypergeometric skewness_laplace skewness_logistic'
+ ' skewness_lognormal skewness_negative_binomial skewness_noncentral_chi2 skewness_noncentral_student_t'
+ ' skewness_normal skewness_pareto skewness_poisson skewness_rayleigh skewness_student_t'
+ ' skewness_weibull slength smake small_rhombicosidodecahedron_graph small_rhombicuboctahedron_graph'
+ ' smax smin smismatch snowmap snub_cube_graph snub_dodecahedron_graph solve'
+ ' solve_rec solve_rec_rat some somrac sort sparse6_decode sparse6_encode sparse6_export'
+ ' sparse6_import specint spherical spherical_bessel_j spherical_bessel_y spherical_hankel1'
+ ' spherical_hankel2 spherical_harmonic spherical_to_xyz splice split sposition'
+ ' sprint sqfr sqrt sqrtdenest sremove sremovefirst sreverse ssearch ssort sstatus'
+ ' ssubst ssubstfirst staircase standardize standardize_inverse_trig starplot'
+ ' starplot_description status std std1 std_bernoulli std_beta std_binomial'
+ ' std_chi2 std_continuous_uniform std_discrete_uniform std_exp std_f std_gamma'
+ ' std_general_finite_discrete std_geometric std_gumbel std_hypergeometric std_laplace'
+ ' std_logistic std_lognormal std_negative_binomial std_noncentral_chi2 std_noncentral_student_t'
+ ' std_normal std_pareto std_poisson std_rayleigh std_student_t std_weibull'
+ ' stemplot stirling stirling1 stirling2 strim striml strimr string stringout'
+ ' stringp strong_components struve_h struve_l sublis sublist sublist_indices'
+ ' submatrix subsample subset subsetp subst substinpart subst_parallel substpart'
+ ' substring subvar subvarp sum sumcontract summand_to_rec supcase supcontext'
+ ' symbolp symmdifference symmetricp system take_channel take_inference tan'
+ ' tanh taylor taylorinfo taylorp taylor_simplifier taytorat tcl_output tcontract'
+ ' tellrat tellsimp tellsimpafter tentex tenth test_mean test_means_difference'
+ ' test_normality test_proportion test_proportions_difference test_rank_sum'
+ ' test_sign test_signed_rank test_variance test_variance_ratio tex tex1 tex_display'
+ ' texput %th third throw time timedate timer timer_info tldefint tlimit todd_coxeter'
+ ' toeplitz tokens to_lisp topological_sort to_poly to_poly_solve totaldisrep'
+ ' totalfourier totient tpartpol trace tracematrix trace_options transform_sample'
+ ' translate translate_file transpose treefale tree_reduce treillis treinat'
+ ' triangle triangularize trigexpand trigrat trigreduce trigsimp trunc truncate'
+ ' truncated_cube_graph truncated_dodecahedron_graph truncated_icosahedron_graph'
+ ' truncated_tetrahedron_graph tr_warnings_get tube tutte_graph ueivects uforget'
+ ' ultraspherical underlying_graph undiff union unique uniteigenvectors unitp'
+ ' units unit_step unitvector unorder unsum untellrat untimer'
+ ' untrace uppercasep uricci uriemann uvect vandermonde_matrix var var1 var_bernoulli'
+ ' var_beta var_binomial var_chi2 var_continuous_uniform var_discrete_uniform'
+ ' var_exp var_f var_gamma var_general_finite_discrete var_geometric var_gumbel'
+ ' var_hypergeometric var_laplace var_logistic var_lognormal var_negative_binomial'
+ ' var_noncentral_chi2 var_noncentral_student_t var_normal var_pareto var_poisson'
+ ' var_rayleigh var_student_t var_weibull vector vectorpotential vectorsimp'
+ ' verbify vers vertex_coloring vertex_connectivity vertex_degree vertex_distance'
+ ' vertex_eccentricity vertex_in_degree vertex_out_degree vertices vertices_to_cycle'
+ ' vertices_to_path %w weyl wheel_graph wiener_index wigner_3j wigner_6j'
+ ' wigner_9j with_stdout write_binary_data writebyte write_data writefile wronskian'
+ ' xreduce xthru %y Zeilberger zeroequiv zerofor zeromatrix zeromatrixp zeta'
+ ' zgeev zheev zlange zn_add_table zn_carmichael_lambda zn_characteristic_factors'
+ ' zn_determinant zn_factor_generators zn_invert_by_lu zn_log zn_mult_table'
+ ' absboxchar activecontexts adapt_depth additive adim aform algebraic'
+ ' algepsilon algexact aliases allbut all_dotsimp_denoms allocation allsym alphabetic'
+ ' animation antisymmetric arrays askexp assume_pos assume_pos_pred assumescalar'
+ ' asymbol atomgrad atrig1 axes axis_3d axis_bottom axis_left axis_right axis_top'
+ ' azimuth background background_color backsubst berlefact bernstein_explicit'
+ ' besselexpand beta_args_sum_to_integer beta_expand bftorat bftrunc bindtest'
+ ' border boundaries_array box boxchar breakup %c capping cauchysum cbrange'
+ ' cbtics center cflength cframe_flag cnonmet_flag color color_bar color_bar_tics'
+ ' colorbox columns commutative complex cone context contexts contour contour_levels'
+ ' cosnpiflag ctaypov ctaypt ctayswitch ctayvar ct_coords ctorsion_flag ctrgsimp'
+ ' cube current_let_rule_package cylinder data_file_name debugmode decreasing'
+ ' default_let_rule_package delay dependencies derivabbrev derivsubst detout'
+ ' diagmetric diff dim dimensions dispflag display2d|10 display_format_internal'
+ ' distribute_over doallmxops domain domxexpt domxmxops domxnctimes dontfactor'
+ ' doscmxops doscmxplus dot0nscsimp dot0simp dot1simp dotassoc dotconstrules'
+ ' dotdistrib dotexptsimp dotident dotscrules draw_graph_program draw_realpart'
+ ' edge_color edge_coloring edge_partition edge_type edge_width %edispflag'
+ ' elevation %emode endphi endtheta engineering_format_floats enhanced3d %enumer'
+ ' epsilon_lp erfflag erf_representation errormsg error_size error_syms error_type'
+ ' %e_to_numlog eval even evenfun evflag evfun ev_point expandwrt_denom expintexpand'
+ ' expintrep expon expop exptdispflag exptisolate exptsubst facexpand facsum_combine'
+ ' factlim factorflag factorial_expand factors_only fb feature features'
+ ' file_name file_output_append file_search_demo file_search_lisp file_search_maxima|10'
+ ' file_search_tests file_search_usage file_type_lisp file_type_maxima|10 fill_color'
+ ' fill_density filled_func fixed_vertices flipflag float2bf font font_size'
+ ' fortindent fortspaces fpprec fpprintprec functions gamma_expand gammalim'
+ ' gdet genindex gensumnum GGFCFMAX GGFINFINITY globalsolve gnuplot_command'
+ ' gnuplot_curve_styles gnuplot_curve_titles gnuplot_default_term_command gnuplot_dumb_term_command'
+ ' gnuplot_file_args gnuplot_file_name gnuplot_out_file gnuplot_pdf_term_command'
+ ' gnuplot_pm3d gnuplot_png_term_command gnuplot_postamble gnuplot_preamble'
+ ' gnuplot_ps_term_command gnuplot_svg_term_command gnuplot_term gnuplot_view_args'
+ ' Gosper_in_Zeilberger gradefs grid grid2d grind halfangles head_angle head_both'
+ ' head_length head_type height hypergeometric_representation %iargs ibase'
+ ' icc1 icc2 icounter idummyx ieqnprint ifb ifc1 ifc2 ifg ifgi ifr iframe_bracket_form'
+ ' ifri igeowedge_flag ikt1 ikt2 imaginary inchar increasing infeval'
+ ' infinity inflag infolists inm inmc1 inmc2 intanalysis integer integervalued'
+ ' integrate_use_rootsof integration_constant integration_constant_counter interpolate_color'
+ ' intfaclim ip_grid ip_grid_in irrational isolate_wrt_times iterations itr'
+ ' julia_parameter %k1 %k2 keepfloat key key_pos kinvariant kt label label_alignment'
+ ' label_orientation labels lassociative lbfgs_ncorrections lbfgs_nfeval_max'
+ ' leftjust legend letrat let_rule_packages lfg lg lhospitallim limsubst linear'
+ ' linear_solver linechar linel|10 linenum line_type linewidth line_width linsolve_params'
+ ' linsolvewarn lispdisp listarith listconstvars listdummyvars lmxchar load_pathname'
+ ' loadprint logabs logarc logcb logconcoeffp logexpand lognegint logsimp logx'
+ ' logx_secondary logy logy_secondary logz lriem m1pbranch macroexpansion macros'
+ ' mainvar manual_demo maperror mapprint matrix_element_add matrix_element_mult'
+ ' matrix_element_transpose maxapplydepth maxapplyheight maxima_tempdir|10 maxima_userdir|10'
+ ' maxnegex MAX_ORD maxposex maxpsifracdenom maxpsifracnum maxpsinegint maxpsiposint'
+ ' maxtayorder mesh_lines_color method mod_big_prime mode_check_errorp'
+ ' mode_checkp mode_check_warnp mod_test mod_threshold modular_linear_solver'
+ ' modulus multiplicative multiplicities myoptions nary negdistrib negsumdispflag'
+ ' newline newtonepsilon newtonmaxiter nextlayerfactor niceindicespref nm nmc'
+ ' noeval nolabels nonegative_lp noninteger nonscalar noun noundisp nouns np'
+ ' npi nticks ntrig numer numer_pbranch obase odd oddfun opacity opproperties'
+ ' opsubst optimprefix optionset orientation origin orthopoly_returns_intervals'
+ ' outative outchar packagefile palette partswitch pdf_file pfeformat phiresolution'
+ ' %piargs piece pivot_count_sx pivot_max_sx plot_format plot_options plot_realpart'
+ ' png_file pochhammer_max_index points pointsize point_size points_joined point_type'
+ ' poislim poisson poly_coefficient_ring poly_elimination_order polyfactor poly_grobner_algorithm'
+ ' poly_grobner_debug poly_monomial_order poly_primary_elimination_order poly_return_term_list'
+ ' poly_secondary_elimination_order poly_top_reduction_only posfun position'
+ ' powerdisp pred prederror primep_number_of_tests product_use_gamma program'
+ ' programmode promote_float_to_bigfloat prompt proportional_axes props psexpand'
+ ' ps_file radexpand radius radsubstflag rassociative ratalgdenom ratchristof'
+ ' ratdenomdivide rateinstein ratepsilon ratfac rational ratmx ratprint ratriemann'
+ ' ratsimpexpons ratvarswitch ratweights ratweyl ratwtlvl real realonly redraw'
+ ' refcheck resolution restart resultant ric riem rmxchar %rnum_list rombergabs'
+ ' rombergit rombergmin rombergtol rootsconmode rootsepsilon run_viewer same_xy'
+ ' same_xyz savedef savefactors scalar scalarmatrixp scale scale_lp setcheck'
+ ' setcheckbreak setval show_edge_color show_edges show_edge_type show_edge_width'
+ ' show_id show_label showtime show_vertex_color show_vertex_size show_vertex_type'
+ ' show_vertices show_weight simp simplified_output simplify_products simpproduct'
+ ' simpsum sinnpiflag solvedecomposes solveexplicit solvefactors solvenullwarn'
+ ' solveradcan solvetrigwarn space sparse sphere spring_embedding_depth sqrtdispflag'
+ ' stardisp startphi starttheta stats_numer stringdisp structures style sublis_apply_lambda'
+ ' subnumsimp sumexpand sumsplitfact surface surface_hide svg_file symmetric'
+ ' tab taylordepth taylor_logexpand taylor_order_coefficients taylor_truncate_polynomials'
+ ' tensorkill terminal testsuite_files thetaresolution timer_devalue title tlimswitch'
+ ' tr track transcompile transform transform_xy translate_fast_arrays transparent'
+ ' transrun tr_array_as_ref tr_bound_function_applyp tr_file_tty_messagesp tr_float_can_branch_complex'
+ ' tr_function_call_default trigexpandplus trigexpandtimes triginverses trigsign'
+ ' trivial_solutions tr_numer tr_optimize_max_loop tr_semicompile tr_state_vars'
+ ' tr_warn_bad_function_calls tr_warn_fexpr tr_warn_meval tr_warn_mode'
+ ' tr_warn_undeclared tr_warn_undefined_variable tstep ttyoff tube_extremes'
+ ' ufg ug %unitexpand unit_vectors uric uriem use_fast_arrays user_preamble'
+ ' usersetunits values vect_cross verbose vertex_color vertex_coloring vertex_partition'
+ ' vertex_size vertex_type view warnings weyl width windowname windowtitle wired_surface'
+ ' wireframe xaxis xaxis_color xaxis_secondary xaxis_type xaxis_width xlabel'
+ ' xlabel_secondary xlength xrange xrange_secondary xtics xtics_axis xtics_rotate'
+ ' xtics_rotate_secondary xtics_secondary xtics_secondary_axis xu_grid x_voxel'
+ ' xy_file xyplane xy_scale yaxis yaxis_color yaxis_secondary yaxis_type yaxis_width'
+ ' ylabel ylabel_secondary ylength yrange yrange_secondary ytics ytics_axis'
+ ' ytics_rotate ytics_rotate_secondary ytics_secondary ytics_secondary_axis'
+ ' yv_grid y_voxel yx_ratio zaxis zaxis_color zaxis_type zaxis_width zeroa zerob'
+ ' zerobern zeta%pi zlabel zlabel_rotate zlength zmin zn_primroot_limit zn_primroot_pretest';
const SYMBOLS = '_ __ %|0 %%|0';
return {
name: 'Maxima',
keywords: {
$pattern: '[A-Za-z_%][0-9A-Za-z_%]*',
keyword: KEYWORDS,
literal: LITERALS,
built_in: BUILTIN_FUNCTIONS,
symbol: SYMBOLS
},
contains: [
{
className: 'comment',
begin: '/\\*',
end: '\\*/',
contains: [ 'self' ]
},
hljs.QUOTE_STRING_MODE,
{
className: 'number',
relevance: 0,
variants: [
{
// float number w/ exponent
// hmm, I wonder if we ought to include other exponent markers?
begin: '\\b(\\d+|\\d+\\.|\\.\\d+|\\d+\\.\\d+)[Ee][-+]?\\d+\\b' },
{
// bigfloat number
begin: '\\b(\\d+|\\d+\\.|\\.\\d+|\\d+\\.\\d+)[Bb][-+]?\\d+\\b',
relevance: 10
},
{
// float number w/out exponent
// Doesn't seem to recognize floats which start with '.'
begin: '\\b(\\.\\d+|\\d+\\.\\d+)\\b' },
{
// integer in base up to 36
// Doesn't seem to recognize integers which end with '.'
begin: '\\b(\\d+|0[0-9A-Za-z]+)\\.?\\b' }
]
}
],
illegal: /@/
};
}
module.exports = maxima;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/mel" instead of "highlight.js/lib/languages/mel.js"'
);
}
}
emitWarning();
module.exports = require('./mel.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/mipsasm" instead of "highlight.js/lib/languages/mipsasm.js"'
);
}
}
emitWarning();
module.exports = require('./mipsasm.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/mizar" instead of "highlight.js/lib/languages/mizar.js"'
);
}
}
emitWarning();
module.exports = require('./mizar.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/nestedtext" instead of "highlight.js/lib/languages/nestedtext.js"'
);
}
}
emitWarning();
module.exports = require('./nestedtext.js');

View File

@@ -0,0 +1,153 @@
/*
Language: Nginx config
Author: Peter Leonov <gojpeg@yandex.ru>
Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
Category: config, web
Website: https://www.nginx.com
*/
/** @type LanguageFn */
function nginx(hljs) {
const regex = hljs.regex;
const VAR = {
className: 'variable',
variants: [
{ begin: /\$\d+/ },
{ begin: /\$\{\w+\}/ },
{ begin: regex.concat(/[$@]/, hljs.UNDERSCORE_IDENT_RE) }
]
};
const LITERALS = [
"on",
"off",
"yes",
"no",
"true",
"false",
"none",
"blocked",
"debug",
"info",
"notice",
"warn",
"error",
"crit",
"select",
"break",
"last",
"permanent",
"redirect",
"kqueue",
"rtsig",
"epoll",
"poll",
"/dev/poll"
];
const DEFAULT = {
endsWithParent: true,
keywords: {
$pattern: /[a-z_]{2,}|\/dev\/poll/,
literal: LITERALS
},
relevance: 0,
illegal: '=>',
contains: [
hljs.HASH_COMMENT_MODE,
{
className: 'string',
contains: [
hljs.BACKSLASH_ESCAPE,
VAR
],
variants: [
{
begin: /"/,
end: /"/
},
{
begin: /'/,
end: /'/
}
]
},
// this swallows entire URLs to avoid detecting numbers within
{
begin: '([a-z]+):/',
end: '\\s',
endsWithParent: true,
excludeEnd: true,
contains: [ VAR ]
},
{
className: 'regexp',
contains: [
hljs.BACKSLASH_ESCAPE,
VAR
],
variants: [
{
begin: "\\s\\^",
end: "\\s|\\{|;",
returnEnd: true
},
// regexp locations (~, ~*)
{
begin: "~\\*?\\s+",
end: "\\s|\\{|;",
returnEnd: true
},
// *.example.com
{ begin: "\\*(\\.[a-z\\-]+)+" },
// sub.example.*
{ begin: "([a-z\\-]+\\.)+\\*" }
]
},
// IP
{
className: 'number',
begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b'
},
// units
{
className: 'number',
begin: '\\b\\d+[kKmMgGdshdwy]?\\b',
relevance: 0
},
VAR
]
};
return {
name: 'Nginx config',
aliases: [ 'nginxconf' ],
contains: [
hljs.HASH_COMMENT_MODE,
{
beginKeywords: "upstream location",
end: /;|\{/,
contains: DEFAULT.contains,
keywords: { section: "upstream location" }
},
{
className: 'section',
begin: regex.concat(hljs.UNDERSCORE_IDENT_RE + regex.lookahead(/\s+\{/)),
relevance: 0
},
{
begin: regex.lookahead(hljs.UNDERSCORE_IDENT_RE + '\\s'),
end: ';|\\{',
contains: [
{
className: 'attribute',
begin: hljs.UNDERSCORE_IDENT_RE,
starts: DEFAULT
}
],
relevance: 0
}
],
illegal: '[^\\s\\}\\{]'
};
}
module.exports = nginx;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/nginx" instead of "highlight.js/lib/languages/nginx.js"'
);
}
}
emitWarning();
module.exports = require('./nginx.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/nim" instead of "highlight.js/lib/languages/nim.js"'
);
}
}
emitWarning();
module.exports = require('./nim.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/nix" instead of "highlight.js/lib/languages/nix.js"'
);
}
}
emitWarning();
module.exports = require('./nix.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/openscad" instead of "highlight.js/lib/languages/openscad.js"'
);
}
}
emitWarning();
module.exports = require('./openscad.js');

View File

@@ -0,0 +1,87 @@
/*
Language: Oxygene
Author: Carlo Kok <ck@remobjects.com>
Description: Oxygene is built on the foundation of Object Pascal, revamped and extended to be a modern language for the twenty-first century.
Website: https://www.elementscompiler.com/elements/default.aspx
Category: build-system
*/
function oxygene(hljs) {
const 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 '
+ 'final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited '
+ 'inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of '
+ 'old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly '
+ 'record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple '
+ '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'
};
const CURLY_COMMENT = hljs.COMMENT(
/\{/,
/\}/,
{ relevance: 0 }
);
const PAREN_COMMENT = hljs.COMMENT(
'\\(\\*',
'\\*\\)',
{ relevance: 10 }
);
const STRING = {
className: 'string',
begin: '\'',
end: '\'',
contains: [ { begin: '\'\'' } ]
};
const CHAR_STRING = {
className: 'string',
begin: '(#\\d+)+'
};
const FUNCTION = {
beginKeywords: 'function constructor destructor procedure method',
end: '[:;]',
keywords: 'function constructor|10 destructor|10 procedure|10 method|10',
contains: [
hljs.inherit(hljs.TITLE_MODE, { scope: "title.function" }),
{
className: 'params',
begin: '\\(',
end: '\\)',
keywords: OXYGENE_KEYWORDS,
contains: [
STRING,
CHAR_STRING
]
},
CURLY_COMMENT,
PAREN_COMMENT
]
};
const SEMICOLON = {
scope: "punctuation",
match: /;/,
relevance: 0
};
return {
name: 'Oxygene',
case_insensitive: true,
keywords: OXYGENE_KEYWORDS,
illegal: '("|\\$[G-Zg-z]|\\/\\*|</|=>|->)',
contains: [
CURLY_COMMENT,
PAREN_COMMENT,
hljs.C_LINE_COMMENT_MODE,
STRING,
CHAR_STRING,
hljs.NUMBER_MODE,
FUNCTION,
SEMICOLON
]
};
}
module.exports = oxygene;

View File

@@ -0,0 +1,55 @@
/*
Language: Parser3
Requires: xml.js
Author: Oleg Volchkov <oleg@volchkov.net>
Website: https://www.parser.ru/en/
Category: template
*/
function parser3(hljs) {
const CURLY_SUBCOMMENT = hljs.COMMENT(
/\{/,
/\}/,
{ contains: [ 'self' ] }
);
return {
name: 'Parser3',
subLanguage: 'xml',
relevance: 0,
contains: [
hljs.COMMENT('^#', '$'),
hljs.COMMENT(
/\^rem\{/,
/\}/,
{
relevance: 10,
contains: [ CURLY_SUBCOMMENT ]
}
),
{
className: 'meta',
begin: '^@(?:BASE|USE|CLASS|OPTIONS)$',
relevance: 10
},
{
className: 'title',
begin: '@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$'
},
{
className: 'variable',
begin: /\$\{?[\w\-.:]+\}?/
},
{
className: 'keyword',
begin: /\^[\w\-.:]+/
},
{
className: 'number',
begin: '\\^#[0-9a-fA-F]+'
},
hljs.C_NUMBER_MODE
]
};
}
module.exports = parser3;

View File

@@ -0,0 +1,504 @@
/*
Language: Perl
Author: Peter Leonov <gojpeg@yandex.ru>
Website: https://www.perl.org
Category: common
*/
/** @type LanguageFn */
function perl(hljs) {
const regex = hljs.regex;
const KEYWORDS = [
'abs',
'accept',
'alarm',
'and',
'atan2',
'bind',
'binmode',
'bless',
'break',
'caller',
'chdir',
'chmod',
'chomp',
'chop',
'chown',
'chr',
'chroot',
'class',
'close',
'closedir',
'connect',
'continue',
'cos',
'crypt',
'dbmclose',
'dbmopen',
'defined',
'delete',
'die',
'do',
'dump',
'each',
'else',
'elsif',
'endgrent',
'endhostent',
'endnetent',
'endprotoent',
'endpwent',
'endservent',
'eof',
'eval',
'exec',
'exists',
'exit',
'exp',
'fcntl',
'field',
'fileno',
'flock',
'for',
'foreach',
'fork',
'format',
'formline',
'getc',
'getgrent',
'getgrgid',
'getgrnam',
'gethostbyaddr',
'gethostbyname',
'gethostent',
'getlogin',
'getnetbyaddr',
'getnetbyname',
'getnetent',
'getpeername',
'getpgrp',
'getpriority',
'getprotobyname',
'getprotobynumber',
'getprotoent',
'getpwent',
'getpwnam',
'getpwuid',
'getservbyname',
'getservbyport',
'getservent',
'getsockname',
'getsockopt',
'given',
'glob',
'gmtime',
'goto',
'grep',
'gt',
'hex',
'if',
'index',
'int',
'ioctl',
'join',
'keys',
'kill',
'last',
'lc',
'lcfirst',
'length',
'link',
'listen',
'local',
'localtime',
'log',
'lstat',
'lt',
'ma',
'map',
'method',
'mkdir',
'msgctl',
'msgget',
'msgrcv',
'msgsnd',
'my',
'ne',
'next',
'no',
'not',
'oct',
'open',
'opendir',
'or',
'ord',
'our',
'pack',
'package',
'pipe',
'pop',
'pos',
'print',
'printf',
'prototype',
'push',
'q|0',
'qq',
'quotemeta',
'qw',
'qx',
'rand',
'read',
'readdir',
'readline',
'readlink',
'readpipe',
'recv',
'redo',
'ref',
'rename',
'require',
'reset',
'return',
'reverse',
'rewinddir',
'rindex',
'rmdir',
'say',
'scalar',
'seek',
'seekdir',
'select',
'semctl',
'semget',
'semop',
'send',
'setgrent',
'sethostent',
'setnetent',
'setpgrp',
'setpriority',
'setprotoent',
'setpwent',
'setservent',
'setsockopt',
'shift',
'shmctl',
'shmget',
'shmread',
'shmwrite',
'shutdown',
'sin',
'sleep',
'socket',
'socketpair',
'sort',
'splice',
'split',
'sprintf',
'sqrt',
'srand',
'stat',
'state',
'study',
'sub',
'substr',
'symlink',
'syscall',
'sysopen',
'sysread',
'sysseek',
'system',
'syswrite',
'tell',
'telldir',
'tie',
'tied',
'time',
'times',
'tr',
'truncate',
'uc',
'ucfirst',
'umask',
'undef',
'unless',
'unlink',
'unpack',
'unshift',
'untie',
'until',
'use',
'utime',
'values',
'vec',
'wait',
'waitpid',
'wantarray',
'warn',
'when',
'while',
'write',
'x|0',
'xor',
'y|0'
];
// https://perldoc.perl.org/perlre#Modifiers
const REGEX_MODIFIERS = /[dualxmsipngr]{0,12}/; // aa and xx are valid, making max length 12
const PERL_KEYWORDS = {
$pattern: /[\w.]+/,
keyword: KEYWORDS.join(" ")
};
const SUBST = {
className: 'subst',
begin: '[$@]\\{',
end: '\\}',
keywords: PERL_KEYWORDS
};
const METHOD = {
begin: /->\{/,
end: /\}/
// contains defined later
};
const ATTR = {
scope: 'attr',
match: /\s+:\s*\w+(\s*\(.*?\))?/,
};
const VAR = {
scope: 'variable',
variants: [
{ begin: /\$\d/ },
{ begin: regex.concat(
/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,
// negative look-ahead tries to avoid matching patterns that are not
// Perl at all like $ident$, @ident@, etc.
`(?![A-Za-z])(?![@$%])`
)
},
{
// Only $= is a special Perl variable and one can't declare @= or %=.
begin: /[$%@](?!")[^\s\w{=]|\$=/,
relevance: 0
}
],
contains: [ ATTR ],
};
const NUMBER = {
className: 'number',
variants: [
// decimal numbers:
// include the case where a number starts with a dot (eg. .9), and
// the leading 0? avoids mixing the first and second match on 0.x cases
{ match: /0?\.[0-9][0-9_]+\b/ },
// include the special versioned number (eg. v5.38)
{ match: /\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/ },
// non-decimal numbers:
{ match: /\b0[0-7][0-7_]*\b/ },
{ match: /\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/ },
{ match: /\b0b[0-1][0-1_]*\b/ },
],
relevance: 0
};
const STRING_CONTAINS = [
hljs.BACKSLASH_ESCAPE,
SUBST,
VAR
];
const REGEX_DELIMS = [
/!/,
/\//,
/\|/,
/\?/,
/'/,
/"/, // valid but infrequent and weird
/#/ // valid but infrequent and weird
];
/**
* @param {string|RegExp} prefix
* @param {string|RegExp} open
* @param {string|RegExp} close
*/
const PAIRED_DOUBLE_RE = (prefix, open, close = '\\1') => {
const middle = (close === '\\1')
? close
: regex.concat(close, open);
return regex.concat(
regex.concat("(?:", prefix, ")"),
open,
/(?:\\.|[^\\\/])*?/,
middle,
/(?:\\.|[^\\\/])*?/,
close,
REGEX_MODIFIERS
);
};
/**
* @param {string|RegExp} prefix
* @param {string|RegExp} open
* @param {string|RegExp} close
*/
const PAIRED_RE = (prefix, open, close) => {
return regex.concat(
regex.concat("(?:", prefix, ")"),
open,
/(?:\\.|[^\\\/])*?/,
close,
REGEX_MODIFIERS
);
};
const PERL_DEFAULT_CONTAINS = [
VAR,
hljs.HASH_COMMENT_MODE,
hljs.COMMENT(
/^=\w/,
/=cut/,
{ endsWithParent: true }
),
METHOD,
{
className: 'string',
contains: STRING_CONTAINS,
variants: [
{
begin: 'q[qwxr]?\\s*\\(',
end: '\\)',
relevance: 5
},
{
begin: 'q[qwxr]?\\s*\\[',
end: '\\]',
relevance: 5
},
{
begin: 'q[qwxr]?\\s*\\{',
end: '\\}',
relevance: 5
},
{
begin: 'q[qwxr]?\\s*\\|',
end: '\\|',
relevance: 5
},
{
begin: 'q[qwxr]?\\s*<',
end: '>',
relevance: 5
},
{
begin: 'qw\\s+q',
end: 'q',
relevance: 5
},
{
begin: '\'',
end: '\'',
contains: [ hljs.BACKSLASH_ESCAPE ]
},
{
begin: '"',
end: '"'
},
{
begin: '`',
end: '`',
contains: [ hljs.BACKSLASH_ESCAPE ]
},
{
begin: /\{\w+\}/,
relevance: 0
},
{
begin: '-?\\w+\\s*=>',
relevance: 0
}
]
},
NUMBER,
{ // regexp container
begin: '(\\/\\/|' + hljs.RE_STARTERS_RE + '|\\b(split|return|print|reverse|grep)\\b)\\s*',
keywords: 'split return print reverse grep',
relevance: 0,
contains: [
hljs.HASH_COMMENT_MODE,
{
className: 'regexp',
variants: [
// allow matching common delimiters
{ begin: PAIRED_DOUBLE_RE("s|tr|y", regex.either(...REGEX_DELIMS, { capture: true })) },
// and then paired delmis
{ begin: PAIRED_DOUBLE_RE("s|tr|y", "\\(", "\\)") },
{ begin: PAIRED_DOUBLE_RE("s|tr|y", "\\[", "\\]") },
{ begin: PAIRED_DOUBLE_RE("s|tr|y", "\\{", "\\}") }
],
relevance: 2
},
{
className: 'regexp',
variants: [
{
// could be a comment in many languages so do not count
// as relevant
begin: /(m|qr)\/\//,
relevance: 0
},
// prefix is optional with /regex/
{ begin: PAIRED_RE("(?:m|qr)?", /\//, /\//) },
// allow matching common delimiters
{ begin: PAIRED_RE("m|qr", regex.either(...REGEX_DELIMS, { capture: true }), /\1/) },
// allow common paired delmins
{ begin: PAIRED_RE("m|qr", /\(/, /\)/) },
{ begin: PAIRED_RE("m|qr", /\[/, /\]/) },
{ begin: PAIRED_RE("m|qr", /\{/, /\}/) }
]
}
]
},
{
className: 'function',
beginKeywords: 'sub method',
end: '(\\s*\\(.*?\\))?[;{]',
excludeEnd: true,
relevance: 5,
contains: [ hljs.TITLE_MODE, ATTR ]
},
{
className: 'class',
beginKeywords: 'class',
end: '[;{]',
excludeEnd: true,
relevance: 5,
contains: [ hljs.TITLE_MODE, ATTR, NUMBER ]
},
{
begin: '-\\w\\b',
relevance: 0
},
{
begin: "^__DATA__$",
end: "^__END__$",
subLanguage: 'mojolicious',
contains: [
{
begin: "^@@.*",
end: "$",
className: "comment"
}
]
}
];
SUBST.contains = PERL_DEFAULT_CONTAINS;
METHOD.contains = PERL_DEFAULT_CONTAINS;
return {
name: 'Perl',
aliases: [
'pl',
'pm'
],
keywords: PERL_KEYWORDS,
contains: PERL_DEFAULT_CONTAINS
};
}
module.exports = perl;

625
frontend/node_modules/highlight.js/lib/languages/php.js generated vendored Normal file
View File

@@ -0,0 +1,625 @@
/*
Language: PHP
Author: Victor Karamzin <Victor.Karamzin@enterra-inc.com>
Contributors: Evgeny Stepanischev <imbolk@gmail.com>, Ivan Sagalaev <maniac@softwaremaniacs.org>
Website: https://www.php.net
Category: common
*/
/**
* @param {HLJSApi} hljs
* @returns {LanguageDetail}
* */
function php(hljs) {
const regex = hljs.regex;
// negative look-ahead tries to avoid matching patterns that are not
// Perl at all like $ident$, @ident@, etc.
const NOT_PERL_ETC = /(?![A-Za-z0-9])(?![$])/;
const IDENT_RE = regex.concat(
/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,
NOT_PERL_ETC);
// Will not detect camelCase classes
const PASCAL_CASE_CLASS_NAME_RE = regex.concat(
/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,
NOT_PERL_ETC);
const UPCASE_NAME_RE = regex.concat(
/[A-Z]+/,
NOT_PERL_ETC);
const VARIABLE = {
scope: 'variable',
match: '\\$+' + IDENT_RE,
};
const PREPROCESSOR = {
scope: "meta",
variants: [
{ begin: /<\?php/, relevance: 10 }, // boost for obvious PHP
{ begin: /<\?=/ },
// less relevant per PSR-1 which says not to use short-tags
{ begin: /<\?/, relevance: 0.1 },
{ begin: /\?>/ } // end php tag
]
};
const SUBST = {
scope: 'subst',
variants: [
{ begin: /\$\w+/ },
{
begin: /\{\$/,
end: /\}/
}
]
};
const SINGLE_QUOTED = hljs.inherit(hljs.APOS_STRING_MODE, { illegal: null, });
const DOUBLE_QUOTED = hljs.inherit(hljs.QUOTE_STRING_MODE, {
illegal: null,
contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST),
});
const HEREDOC = {
begin: /<<<[ \t]*(?:(\w+)|"(\w+)")\n/,
end: /[ \t]*(\w+)\b/,
contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST),
'on:begin': (m, resp) => { resp.data._beginMatch = m[1] || m[2]; },
'on:end': (m, resp) => { if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); },
};
const NOWDOC = hljs.END_SAME_AS_BEGIN({
begin: /<<<[ \t]*'(\w+)'\n/,
end: /[ \t]*(\w+)\b/,
});
// list of valid whitespaces because non-breaking space might be part of a IDENT_RE
const WHITESPACE = '[ \t\n]';
const STRING = {
scope: 'string',
variants: [
DOUBLE_QUOTED,
SINGLE_QUOTED,
HEREDOC,
NOWDOC
]
};
const NUMBER = {
scope: 'number',
variants: [
{ begin: `\\b0[bB][01]+(?:_[01]+)*\\b` }, // Binary w/ underscore support
{ begin: `\\b0[oO][0-7]+(?:_[0-7]+)*\\b` }, // Octals w/ underscore support
{ begin: `\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b` }, // Hex w/ underscore support
// Decimals w/ underscore support, with optional fragments and scientific exponent (e) suffix.
{ begin: `(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?` }
],
relevance: 0
};
const LITERALS = [
"false",
"null",
"true"
];
const KWS = [
// Magic constants:
// <https://www.php.net/manual/en/language.constants.predefined.php>
"__CLASS__",
"__DIR__",
"__FILE__",
"__FUNCTION__",
"__COMPILER_HALT_OFFSET__",
"__LINE__",
"__METHOD__",
"__NAMESPACE__",
"__TRAIT__",
// Function that look like language construct or language construct that look like function:
// List of keywords that may not require parenthesis
"die",
"echo",
"exit",
"include",
"include_once",
"print",
"require",
"require_once",
// These are not language construct (function) but operate on the currently-executing function and can access the current symbol table
// 'compact extract func_get_arg func_get_args func_num_args get_called_class get_parent_class ' +
// Other keywords:
// <https://www.php.net/manual/en/reserved.php>
// <https://www.php.net/manual/en/language.types.type-juggling.php>
"array",
"abstract",
"and",
"as",
"binary",
"bool",
"boolean",
"break",
"callable",
"case",
"catch",
"class",
"clone",
"const",
"continue",
"declare",
"default",
"do",
"double",
"else",
"elseif",
"empty",
"enddeclare",
"endfor",
"endforeach",
"endif",
"endswitch",
"endwhile",
"enum",
"eval",
"extends",
"final",
"finally",
"float",
"for",
"foreach",
"from",
"global",
"goto",
"if",
"implements",
"instanceof",
"insteadof",
"int",
"integer",
"interface",
"isset",
"iterable",
"list",
"match|0",
"mixed",
"new",
"never",
"object",
"or",
"private",
"protected",
"public",
"readonly",
"real",
"return",
"string",
"switch",
"throw",
"trait",
"try",
"unset",
"use",
"var",
"void",
"while",
"xor",
"yield"
];
const BUILT_INS = [
// Standard PHP library:
// <https://www.php.net/manual/en/book.spl.php>
"Error|0",
"AppendIterator",
"ArgumentCountError",
"ArithmeticError",
"ArrayIterator",
"ArrayObject",
"AssertionError",
"BadFunctionCallException",
"BadMethodCallException",
"CachingIterator",
"CallbackFilterIterator",
"CompileError",
"Countable",
"DirectoryIterator",
"DivisionByZeroError",
"DomainException",
"EmptyIterator",
"ErrorException",
"Exception",
"FilesystemIterator",
"FilterIterator",
"GlobIterator",
"InfiniteIterator",
"InvalidArgumentException",
"IteratorIterator",
"LengthException",
"LimitIterator",
"LogicException",
"MultipleIterator",
"NoRewindIterator",
"OutOfBoundsException",
"OutOfRangeException",
"OuterIterator",
"OverflowException",
"ParentIterator",
"ParseError",
"RangeException",
"RecursiveArrayIterator",
"RecursiveCachingIterator",
"RecursiveCallbackFilterIterator",
"RecursiveDirectoryIterator",
"RecursiveFilterIterator",
"RecursiveIterator",
"RecursiveIteratorIterator",
"RecursiveRegexIterator",
"RecursiveTreeIterator",
"RegexIterator",
"RuntimeException",
"SeekableIterator",
"SplDoublyLinkedList",
"SplFileInfo",
"SplFileObject",
"SplFixedArray",
"SplHeap",
"SplMaxHeap",
"SplMinHeap",
"SplObjectStorage",
"SplObserver",
"SplPriorityQueue",
"SplQueue",
"SplStack",
"SplSubject",
"SplTempFileObject",
"TypeError",
"UnderflowException",
"UnexpectedValueException",
"UnhandledMatchError",
// Reserved interfaces:
// <https://www.php.net/manual/en/reserved.interfaces.php>
"ArrayAccess",
"BackedEnum",
"Closure",
"Fiber",
"Generator",
"Iterator",
"IteratorAggregate",
"Serializable",
"Stringable",
"Throwable",
"Traversable",
"UnitEnum",
"WeakReference",
"WeakMap",
// Reserved classes:
// <https://www.php.net/manual/en/reserved.classes.php>
"Directory",
"__PHP_Incomplete_Class",
"parent",
"php_user_filter",
"self",
"static",
"stdClass"
];
/** Dual-case keywords
*
* ["then","FILE"] =>
* ["then", "THEN", "FILE", "file"]
*
* @param {string[]} items */
const dualCase = (items) => {
/** @type string[] */
const result = [];
items.forEach(item => {
result.push(item);
if (item.toLowerCase() === item) {
result.push(item.toUpperCase());
} else {
result.push(item.toLowerCase());
}
});
return result;
};
const KEYWORDS = {
keyword: KWS,
literal: dualCase(LITERALS),
built_in: BUILT_INS,
};
/**
* @param {string[]} items */
const normalizeKeywords = (items) => {
return items.map(item => {
return item.replace(/\|\d+$/, "");
});
};
const CONSTRUCTOR_CALL = { variants: [
{
match: [
/new/,
regex.concat(WHITESPACE, "+"),
// to prevent built ins from being confused as the class constructor call
regex.concat("(?!", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"),
PASCAL_CASE_CLASS_NAME_RE,
],
scope: {
1: "keyword",
4: "title.class",
},
}
] };
const CONSTANT_REFERENCE = regex.concat(IDENT_RE, "\\b(?!\\()");
const LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON = { variants: [
{
match: [
regex.concat(
/::/,
regex.lookahead(/(?!class\b)/)
),
CONSTANT_REFERENCE,
],
scope: { 2: "variable.constant", },
},
{
match: [
/::/,
/class/,
],
scope: { 2: "variable.language", },
},
{
match: [
PASCAL_CASE_CLASS_NAME_RE,
regex.concat(
/::/,
regex.lookahead(/(?!class\b)/)
),
CONSTANT_REFERENCE,
],
scope: {
1: "title.class",
3: "variable.constant",
},
},
{
match: [
PASCAL_CASE_CLASS_NAME_RE,
regex.concat(
"::",
regex.lookahead(/(?!class\b)/)
),
],
scope: { 1: "title.class", },
},
{
match: [
PASCAL_CASE_CLASS_NAME_RE,
/::/,
/class/,
],
scope: {
1: "title.class",
3: "variable.language",
},
}
] };
const NAMED_ARGUMENT = {
scope: 'attr',
match: regex.concat(IDENT_RE, regex.lookahead(':'), regex.lookahead(/(?!::)/)),
};
const PARAMS_MODE = {
relevance: 0,
begin: /\(/,
end: /\)/,
keywords: KEYWORDS,
contains: [
NAMED_ARGUMENT,
VARIABLE,
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
hljs.C_BLOCK_COMMENT_MODE,
STRING,
NUMBER,
CONSTRUCTOR_CALL,
],
};
const FUNCTION_INVOKE = {
relevance: 0,
match: [
/\b/,
// to prevent keywords from being confused as the function title
regex.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"),
IDENT_RE,
regex.concat(WHITESPACE, "*"),
regex.lookahead(/(?=\()/)
],
scope: { 3: "title.function.invoke", },
contains: [ PARAMS_MODE ]
};
PARAMS_MODE.contains.push(FUNCTION_INVOKE);
const ATTRIBUTE_CONTAINS = [
NAMED_ARGUMENT,
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
hljs.C_BLOCK_COMMENT_MODE,
STRING,
NUMBER,
CONSTRUCTOR_CALL,
];
const ATTRIBUTES = {
begin: regex.concat(/#\[\s*\\?/,
regex.either(
PASCAL_CASE_CLASS_NAME_RE,
UPCASE_NAME_RE
)
),
beginScope: "meta",
end: /]/,
endScope: "meta",
keywords: {
literal: LITERALS,
keyword: [
'new',
'array',
]
},
contains: [
{
begin: /\[/,
end: /]/,
keywords: {
literal: LITERALS,
keyword: [
'new',
'array',
]
},
contains: [
'self',
...ATTRIBUTE_CONTAINS,
]
},
...ATTRIBUTE_CONTAINS,
{
scope: 'meta',
variants: [
{ match: PASCAL_CASE_CLASS_NAME_RE },
{ match: UPCASE_NAME_RE }
]
}
]
};
return {
case_insensitive: false,
keywords: KEYWORDS,
contains: [
ATTRIBUTES,
hljs.HASH_COMMENT_MODE,
hljs.COMMENT('//', '$'),
hljs.COMMENT(
'/\\*',
'\\*/',
{ contains: [
{
scope: 'doctag',
match: '@[A-Za-z]+'
}
] }
),
{
match: /__halt_compiler\(\);/,
keywords: '__halt_compiler',
starts: {
scope: "comment",
end: hljs.MATCH_NOTHING_RE,
contains: [
{
match: /\?>/,
scope: "meta",
endsParent: true
}
]
}
},
PREPROCESSOR,
{
scope: 'variable.language',
match: /\$this\b/
},
VARIABLE,
FUNCTION_INVOKE,
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
{
match: [
/const/,
/\s/,
IDENT_RE,
],
scope: {
1: "keyword",
3: "variable.constant",
},
},
CONSTRUCTOR_CALL,
{
scope: 'function',
relevance: 0,
beginKeywords: 'fn function',
end: /[;{]/,
excludeEnd: true,
illegal: '[$%\\[]',
contains: [
{ beginKeywords: 'use', },
hljs.UNDERSCORE_TITLE_MODE,
{
begin: '=>', // No markup, just a relevance booster
endsParent: true
},
{
scope: 'params',
begin: '\\(',
end: '\\)',
excludeBegin: true,
excludeEnd: true,
keywords: KEYWORDS,
contains: [
'self',
ATTRIBUTES,
VARIABLE,
LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON,
hljs.C_BLOCK_COMMENT_MODE,
STRING,
NUMBER
]
},
]
},
{
scope: 'class',
variants: [
{
beginKeywords: "enum",
illegal: /[($"]/
},
{
beginKeywords: "class interface trait",
illegal: /[:($"]/
}
],
relevance: 0,
end: /\{/,
excludeEnd: true,
contains: [
{ beginKeywords: 'extends implements' },
hljs.UNDERSCORE_TITLE_MODE
]
},
// both use and namespace still use "old style" rules (vs multi-match)
// because the namespace name can include `\` and we still want each
// element to be treated as its own *individual* title
{
beginKeywords: 'namespace',
relevance: 0,
end: ';',
illegal: /[.']/,
contains: [ hljs.inherit(hljs.UNDERSCORE_TITLE_MODE, { scope: "title.class" }) ]
},
{
beginKeywords: 'use',
relevance: 0,
end: ';',
contains: [
// TODO: title.function vs title.class
{
match: /\b(as|const|function)\b/,
scope: "keyword"
},
// TODO: could be title.class or title.function
hljs.UNDERSCORE_TITLE_MODE
]
},
STRING,
NUMBER,
]
};
}
module.exports = php;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/php" instead of "highlight.js/lib/languages/php.js"'
);
}
}
emitWarning();
module.exports = require('./php.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/puppet" instead of "highlight.js/lib/languages/puppet.js"'
);
}
}
emitWarning();
module.exports = require('./puppet.js');

View File

@@ -0,0 +1,32 @@
/*
Language: Python REPL
Requires: python.js
Author: Josh Goebel <hello@joshgoebel.com>
Category: common
*/
function pythonRepl(hljs) {
return {
aliases: [ 'pycon' ],
contains: [
{
className: 'meta.prompt',
starts: {
// a space separates the REPL prefix from the actual code
// this is purely for cleaner HTML output
end: / |$/,
starts: {
end: '$',
subLanguage: 'python'
}
},
variants: [
{ begin: /^>>>(?=[ ]|$)/ },
{ begin: /^\.\.\.(?=[ ]|$)/ }
]
}
]
};
}
module.exports = pythonRepl;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/python" instead of "highlight.js/lib/languages/python.js"'
);
}
}
emitWarning();
module.exports = require('./python.js');

189
frontend/node_modules/highlight.js/lib/languages/qml.js generated vendored Normal file
View File

@@ -0,0 +1,189 @@
/*
Language: QML
Requires: javascript.js, xml.js
Author: John Foster <jfoster@esri.com>
Description: Syntax highlighting for the Qt Quick QML scripting language, based mostly off
the JavaScript parser.
Website: https://doc.qt.io/qt-5/qmlapplications.html
Category: scripting
*/
function qml(hljs) {
const regex = hljs.regex;
const KEYWORDS = {
keyword:
'in of on 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 import',
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 '
+ 'Behavior bool color coordinate date double enumeration font geocircle georectangle '
+ 'geoshape int list matrix4x4 parent point quaternion real rect '
+ 'size string url variant vector2d vector3d vector4d '
+ 'Promise'
};
const QML_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9\\._]*';
// Isolate property statements. Ends at a :, =, ;, ,, a comment or end of line.
// Use property class.
const PROPERTY = {
className: 'keyword',
begin: '\\bproperty\\b',
starts: {
className: 'string',
end: '(:|=|;|,|//|/\\*|$)',
returnEnd: true
}
};
// Isolate signal statements. Ends at a ) a comment or end of line.
// Use property class.
const SIGNAL = {
className: 'keyword',
begin: '\\bsignal\\b',
starts: {
className: 'string',
end: '(\\(|:|=|;|,|//|/\\*|$)',
returnEnd: true
}
};
// id: is special in QML. When we see id: we want to mark the id: as attribute and
// emphasize the token following.
const ID_ID = {
className: 'attribute',
begin: '\\bid\\s*:',
starts: {
className: 'string',
end: QML_IDENT_RE,
returnEnd: false
}
};
// Find QML object attribute. An attribute is a QML identifier followed by :.
// Unfortunately it's hard to know where it ends, as it may contain scalars,
// objects, object definitions, or javascript. The true end is either when the parent
// ends or the next attribute is detected.
const QML_ATTRIBUTE = {
begin: QML_IDENT_RE + '\\s*:',
returnBegin: true,
contains: [
{
className: 'attribute',
begin: QML_IDENT_RE,
end: '\\s*:',
excludeEnd: true,
relevance: 0
}
],
relevance: 0
};
// Find QML object. A QML object is a QML identifier followed by { and ends at the matching }.
// All we really care about is finding IDENT followed by { and just mark up the IDENT and ignore the {.
const QML_OBJECT = {
begin: regex.concat(QML_IDENT_RE, /\s*\{/),
end: /\{/,
returnBegin: true,
relevance: 0,
contains: [ hljs.inherit(hljs.TITLE_MODE, { begin: QML_IDENT_RE }) ]
};
return {
name: 'QML',
aliases: [ 'qt' ],
case_insensitive: false,
keywords: KEYWORDS,
contains: [
{
className: 'meta',
begin: /^\s*['"]use (strict|asm)['"]/
},
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE,
{ // template string
className: 'string',
begin: '`',
end: '`',
contains: [
hljs.BACKSLASH_ESCAPE,
{
className: 'subst',
begin: '\\$\\{',
end: '\\}'
}
]
},
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'number',
variants: [
{ begin: '\\b(0[bB][01]+)' },
{ begin: '\\b(0[oO][0-7]+)' },
{ begin: hljs.C_NUMBER_RE }
],
relevance: 0
},
{ // "value" container
begin: '(' + hljs.RE_STARTERS_RE + '|\\b(case|return|throw)\\b)\\s*',
keywords: 'return throw case',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.REGEXP_MODE,
{ // E4X / JSX
begin: /</,
end: />\s*[);\]]/,
relevance: 0,
subLanguage: 'xml'
}
],
relevance: 0
},
SIGNAL,
PROPERTY,
{
className: 'function',
beginKeywords: 'function',
end: /\{/,
excludeEnd: true,
contains: [
hljs.inherit(hljs.TITLE_MODE, { begin: /[A-Za-z$_][0-9A-Za-z$_]*/ }),
{
className: 'params',
begin: /\(/,
end: /\)/,
excludeBegin: true,
excludeEnd: true,
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
}
],
illegal: /\[|%/
},
{
// hack: prevents detection of keywords after dots
begin: '\\.' + hljs.IDENT_RE,
relevance: 0
},
ID_ID,
QML_ATTRIBUTE,
QML_OBJECT
],
illegal: /#/
};
}
module.exports = qml;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/rib" instead of "highlight.js/lib/languages/rib.js"'
);
}
}
emitWarning();
module.exports = require('./rib.js');

149
frontend/node_modules/highlight.js/lib/languages/rsl.js generated vendored Normal file
View File

@@ -0,0 +1,149 @@
/*
Language: RenderMan RSL
Author: Konstantin Evdokimenko <qewerty@gmail.com>
Contributors: Shuen-Huei Guan <drake.guan@gmail.com>
Website: https://renderman.pixar.com/resources/RenderMan_20/shadingLanguage.html
Category: graphics
*/
function rsl(hljs) {
const BUILT_INS = [
"abs",
"acos",
"ambient",
"area",
"asin",
"atan",
"atmosphere",
"attribute",
"calculatenormal",
"ceil",
"cellnoise",
"clamp",
"comp",
"concat",
"cos",
"degrees",
"depth",
"Deriv",
"diffuse",
"distance",
"Du",
"Dv",
"environment",
"exp",
"faceforward",
"filterstep",
"floor",
"format",
"fresnel",
"incident",
"length",
"lightsource",
"log",
"match",
"max",
"min",
"mod",
"noise",
"normalize",
"ntransform",
"opposite",
"option",
"phong",
"pnoise",
"pow",
"printf",
"ptlined",
"radians",
"random",
"reflect",
"refract",
"renderinfo",
"round",
"setcomp",
"setxcomp",
"setycomp",
"setzcomp",
"shadow",
"sign",
"sin",
"smoothstep",
"specular",
"specularbrdf",
"spline",
"sqrt",
"step",
"tan",
"texture",
"textureinfo",
"trace",
"transform",
"vtransform",
"xcomp",
"ycomp",
"zcomp"
];
const TYPES = [
"matrix",
"float",
"color",
"point",
"normal",
"vector"
];
const KEYWORDS = [
"while",
"for",
"if",
"do",
"return",
"else",
"break",
"extern",
"continue"
];
const CLASS_DEFINITION = {
match: [
/(surface|displacement|light|volume|imager)/,
/\s+/,
hljs.IDENT_RE,
],
scope: {
1: "keyword",
3: "title.class",
}
};
return {
name: 'RenderMan RSL',
keywords: {
keyword: KEYWORDS,
built_in: BUILT_INS,
type: TYPES
},
illegal: '</',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.QUOTE_STRING_MODE,
hljs.APOS_STRING_MODE,
hljs.C_NUMBER_MODE,
{
className: 'meta',
begin: '#',
end: '$'
},
CLASS_DEFINITION,
{
beginKeywords: 'illuminate illuminance gather',
end: '\\('
}
]
};
}
module.exports = rsl;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/ruleslanguage" instead of "highlight.js/lib/languages/ruleslanguage.js"'
);
}
}
emitWarning();
module.exports = require('./ruleslanguage.js');

View File

@@ -0,0 +1,326 @@
/*
Language: Rust
Author: Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com>
Contributors: Roman Shmatov <romanshmatov@gmail.com>, Kasper Andersen <kma_untrusted@protonmail.com>
Website: https://www.rust-lang.org
Category: common, system
*/
/** @type LanguageFn */
function rust(hljs) {
const regex = hljs.regex;
// ============================================
// Added to support the r# keyword, which is a raw identifier in Rust.
const RAW_IDENTIFIER = /(r#)?/;
const UNDERSCORE_IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.UNDERSCORE_IDENT_RE);
const IDENT_RE = regex.concat(RAW_IDENTIFIER, hljs.IDENT_RE);
// ============================================
const FUNCTION_INVOKE = {
className: "title.function.invoke",
relevance: 0,
begin: regex.concat(
/\b/,
/(?!let|for|while|if|else|match\b)/,
IDENT_RE,
regex.lookahead(/\s*\(/))
};
const NUMBER_SUFFIX = '([ui](8|16|32|64|128|size)|f(32|64))\?';
const KEYWORDS = [
"abstract",
"as",
"async",
"await",
"become",
"box",
"break",
"const",
"continue",
"crate",
"do",
"dyn",
"else",
"enum",
"extern",
"false",
"final",
"fn",
"for",
"if",
"impl",
"in",
"let",
"loop",
"macro",
"match",
"mod",
"move",
"mut",
"override",
"priv",
"pub",
"ref",
"return",
"self",
"Self",
"static",
"struct",
"super",
"trait",
"true",
"try",
"type",
"typeof",
"union",
"unsafe",
"unsized",
"use",
"virtual",
"where",
"while",
"yield"
];
const LITERALS = [
"true",
"false",
"Some",
"None",
"Ok",
"Err"
];
const BUILTINS = [
// functions
'drop ',
// traits
"Copy",
"Send",
"Sized",
"Sync",
"Drop",
"Fn",
"FnMut",
"FnOnce",
"ToOwned",
"Clone",
"Debug",
"PartialEq",
"PartialOrd",
"Eq",
"Ord",
"AsRef",
"AsMut",
"Into",
"From",
"Default",
"Iterator",
"Extend",
"IntoIterator",
"DoubleEndedIterator",
"ExactSizeIterator",
"SliceConcatExt",
"ToString",
// macros
"assert!",
"assert_eq!",
"bitflags!",
"bytes!",
"cfg!",
"col!",
"concat!",
"concat_idents!",
"debug_assert!",
"debug_assert_eq!",
"env!",
"eprintln!",
"panic!",
"file!",
"format!",
"format_args!",
"include_bytes!",
"include_str!",
"line!",
"local_data_key!",
"module_path!",
"option_env!",
"print!",
"println!",
"select!",
"stringify!",
"try!",
"unimplemented!",
"unreachable!",
"vec!",
"write!",
"writeln!",
"macro_rules!",
"assert_ne!",
"debug_assert_ne!"
];
const TYPES = [
"i8",
"i16",
"i32",
"i64",
"i128",
"isize",
"u8",
"u16",
"u32",
"u64",
"u128",
"usize",
"f32",
"f64",
"str",
"char",
"bool",
"Box",
"Option",
"Result",
"String",
"Vec"
];
return {
name: 'Rust',
aliases: [ 'rs' ],
keywords: {
$pattern: hljs.IDENT_RE + '!?',
type: TYPES,
keyword: KEYWORDS,
literal: LITERALS,
built_in: BUILTINS
},
illegal: '</',
contains: [
hljs.C_LINE_COMMENT_MODE,
hljs.COMMENT('/\\*', '\\*/', { contains: [ 'self' ] }),
hljs.inherit(hljs.QUOTE_STRING_MODE, {
begin: /b?"/,
illegal: null
}),
{
className: 'symbol',
// negative lookahead to avoid matching `'`
begin: /'[a-zA-Z_][a-zA-Z0-9_]*(?!')/
},
{
scope: 'string',
variants: [
{ begin: /b?r(#*)"(.|\n)*?"\1(?!#)/ },
{
begin: /b?'/,
end: /'/,
contains: [
{
scope: "char.escape",
match: /\\('|\w|x\w{2}|u\w{4}|U\w{8})/
}
]
}
]
},
{
className: 'number',
variants: [
{ begin: '\\b0b([01_]+)' + NUMBER_SUFFIX },
{ begin: '\\b0o([0-7_]+)' + NUMBER_SUFFIX },
{ begin: '\\b0x([A-Fa-f0-9_]+)' + NUMBER_SUFFIX },
{ begin: '\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)'
+ NUMBER_SUFFIX }
],
relevance: 0
},
{
begin: [
/fn/,
/\s+/,
UNDERSCORE_IDENT_RE
],
className: {
1: "keyword",
3: "title.function"
}
},
{
className: 'meta',
begin: '#!?\\[',
end: '\\]',
contains: [
{
className: 'string',
begin: /"/,
end: /"/,
contains: [
hljs.BACKSLASH_ESCAPE
]
}
]
},
{
begin: [
/let/,
/\s+/,
/(?:mut\s+)?/,
UNDERSCORE_IDENT_RE
],
className: {
1: "keyword",
3: "keyword",
4: "variable"
}
},
// must come before impl/for rule later
{
begin: [
/for/,
/\s+/,
UNDERSCORE_IDENT_RE,
/\s+/,
/in/
],
className: {
1: "keyword",
3: "variable",
5: "keyword"
}
},
{
begin: [
/type/,
/\s+/,
UNDERSCORE_IDENT_RE
],
className: {
1: "keyword",
3: "title.class"
}
},
{
begin: [
/(?:trait|enum|struct|union|impl|for)/,
/\s+/,
UNDERSCORE_IDENT_RE
],
className: {
1: "keyword",
3: "title.class"
}
},
{
begin: hljs.IDENT_RE + '::',
keywords: {
keyword: "Self",
built_in: BUILTINS,
type: TYPES
}
},
{
className: "punctuation",
begin: '->'
},
FUNCTION_INVOKE
]
};
}
module.exports = rust;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/smali" instead of "highlight.js/lib/languages/smali.js"'
);
}
}
emitWarning();
module.exports = require('./smali.js');

View File

@@ -0,0 +1,75 @@
/*
Language: SML (Standard ML)
Author: Edwin Dalorzo <edwin@dalorzo.org>
Description: SML language definition.
Website: https://www.smlnj.org
Origin: ocaml.js
Category: functional
*/
function sml(hljs) {
return {
name: 'SML (Standard ML)',
aliases: [ 'ml' ],
keywords: {
$pattern: '[a-z_]\\w*!?',
keyword:
/* according to Definition of Standard ML 97 */
'abstype and andalso as case datatype do else end eqtype '
+ 'exception fn fun functor handle if in include infix infixr '
+ 'let local nonfix of op open orelse raise rec sharing sig '
+ 'signature struct structure then type val with withtype where while',
built_in:
/* built-in types according to basis library */
'array bool char exn int list option order real ref string substring vector unit word',
literal:
'true false NONE SOME LESS EQUAL GREATER nil'
},
illegal: /\/\/|>>/,
contains: [
{
className: 'literal',
begin: /\[(\|\|)?\]|\(\)/,
relevance: 0
},
hljs.COMMENT(
'\\(\\*',
'\\*\\)',
{ contains: [ 'self' ] }
),
{ /* type variable */
className: 'symbol',
begin: '\'[A-Za-z_](?!\')[\\w\']*'
/* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */
},
{ /* polymorphic variant */
className: 'type',
begin: '`[A-Z][\\w\']*'
},
{ /* module or constructor */
className: 'type',
begin: '\\b[A-Z][\\w\']*',
relevance: 0
},
{ /* don't color identifiers, but safely catch all identifiers with ' */
begin: '[a-z_]\\w*\'[\\w\']*' },
hljs.inherit(hljs.APOS_STRING_MODE, {
className: 'string',
relevance: 0
}),
hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }),
{
className: 'number',
begin:
'\\b(0[xX][a-fA-F0-9_]+[Lln]?|'
+ '0[oO][0-7_]+[Lln]?|'
+ '0[bB][01_]+[Lln]?|'
+ '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
relevance: 0
},
{ begin: /[-=]>/ // relevance booster
}
]
};
}
module.exports = sml;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/sql" instead of "highlight.js/lib/languages/sql.js"'
);
}
}
emitWarning();
module.exports = require('./sql.js');

View File

@@ -0,0 +1,521 @@
/*
Language: Stan
Description: The Stan probabilistic programming language
Author: Sean Pinkney <sean.pinkney@gmail.com>
Website: http://mc-stan.org/
Category: scientific
*/
function stan(hljs) {
const regex = hljs.regex;
// variable names cannot conflict with block identifiers
const BLOCKS = [
'functions',
'model',
'data',
'parameters',
'quantities',
'transformed',
'generated'
];
const STATEMENTS = [
'for',
'in',
'if',
'else',
'while',
'break',
'continue',
'return'
];
const TYPES = [
'array',
'tuple',
'complex',
'int',
'real',
'vector',
'complex_vector',
'ordered',
'positive_ordered',
'simplex',
'unit_vector',
'row_vector',
'complex_row_vector',
'matrix',
'complex_matrix',
'cholesky_factor_corr|10',
'cholesky_factor_cov|10',
'corr_matrix|10',
'cov_matrix|10',
'void'
];
// to get the functions list
// clone the [stan-docs repo](https://github.com/stan-dev/docs)
// then cd into it and run this bash script https://gist.github.com/joshgoebel/dcd33f82d4059a907c986049893843cf
//
// the output files are
// distributions_quoted.txt
// functions_quoted.txt
const FUNCTIONS = [
'abs',
'acos',
'acosh',
'add_diag',
'algebra_solver',
'algebra_solver_newton',
'append_array',
'append_col',
'append_row',
'asin',
'asinh',
'atan',
'atan2',
'atanh',
'bessel_first_kind',
'bessel_second_kind',
'binary_log_loss',
'block',
'cbrt',
'ceil',
'chol2inv',
'cholesky_decompose',
'choose',
'col',
'cols',
'columns_dot_product',
'columns_dot_self',
'complex_schur_decompose',
'complex_schur_decompose_t',
'complex_schur_decompose_u',
'conj',
'cos',
'cosh',
'cov_exp_quad',
'crossprod',
'csr_extract',
'csr_extract_u',
'csr_extract_v',
'csr_extract_w',
'csr_matrix_times_vector',
'csr_to_dense_matrix',
'cumulative_sum',
'dae',
'dae_tol',
'determinant',
'diag_matrix',
'diagonal',
'diag_post_multiply',
'diag_pre_multiply',
'digamma',
'dims',
'distance',
'dot_product',
'dot_self',
'eigendecompose',
'eigendecompose_sym',
'eigenvalues',
'eigenvalues_sym',
'eigenvectors',
'eigenvectors_sym',
'erf',
'erfc',
'exp',
'exp2',
'expm1',
'falling_factorial',
'fdim',
'fft',
'fft2',
'floor',
'fma',
'fmax',
'fmin',
'fmod',
'gamma_p',
'gamma_q',
'generalized_inverse',
'get_imag',
'get_real',
'head',
'hmm_hidden_state_prob',
'hmm_marginal',
'hypot',
'identity_matrix',
'inc_beta',
'integrate_1d',
'integrate_ode',
'integrate_ode_adams',
'integrate_ode_bdf',
'integrate_ode_rk45',
'int_step',
'inv',
'inv_cloglog',
'inv_erfc',
'inverse',
'inverse_spd',
'inv_fft',
'inv_fft2',
'inv_inc_beta',
'inv_logit',
'inv_Phi',
'inv_sqrt',
'inv_square',
'is_inf',
'is_nan',
'lambert_w0',
'lambert_wm1',
'lbeta',
'lchoose',
'ldexp',
'lgamma',
'linspaced_array',
'linspaced_int_array',
'linspaced_row_vector',
'linspaced_vector',
'lmgamma',
'lmultiply',
'log',
'log1m',
'log1m_exp',
'log1m_inv_logit',
'log1p',
'log1p_exp',
'log_determinant',
'log_diff_exp',
'log_falling_factorial',
'log_inv_logit',
'log_inv_logit_diff',
'logit',
'log_mix',
'log_modified_bessel_first_kind',
'log_rising_factorial',
'log_softmax',
'log_sum_exp',
'machine_precision',
'map_rect',
'matrix_exp',
'matrix_exp_multiply',
'matrix_power',
'max',
'mdivide_left_spd',
'mdivide_left_tri_low',
'mdivide_right_spd',
'mdivide_right_tri_low',
'mean',
'min',
'modified_bessel_first_kind',
'modified_bessel_second_kind',
'multiply_lower_tri_self_transpose',
'negative_infinity',
'norm',
'norm1',
'norm2',
'not_a_number',
'num_elements',
'ode_adams',
'ode_adams_tol',
'ode_adjoint_tol_ctl',
'ode_bdf',
'ode_bdf_tol',
'ode_ckrk',
'ode_ckrk_tol',
'ode_rk45',
'ode_rk45_tol',
'one_hot_array',
'one_hot_int_array',
'one_hot_row_vector',
'one_hot_vector',
'ones_array',
'ones_int_array',
'ones_row_vector',
'ones_vector',
'owens_t',
'Phi',
'Phi_approx',
'polar',
'positive_infinity',
'pow',
'print',
'prod',
'proj',
'qr',
'qr_Q',
'qr_R',
'qr_thin',
'qr_thin_Q',
'qr_thin_R',
'quad_form',
'quad_form_diag',
'quad_form_sym',
'quantile',
'rank',
'reduce_sum',
'reject',
'rep_array',
'rep_matrix',
'rep_row_vector',
'rep_vector',
'reverse',
'rising_factorial',
'round',
'row',
'rows',
'rows_dot_product',
'rows_dot_self',
'scale_matrix_exp_multiply',
'sd',
'segment',
'sin',
'singular_values',
'sinh',
'size',
'softmax',
'sort_asc',
'sort_desc',
'sort_indices_asc',
'sort_indices_desc',
'sqrt',
'square',
'squared_distance',
'step',
'sub_col',
'sub_row',
'sum',
'svd',
'svd_U',
'svd_V',
'symmetrize_from_lower_tri',
'tail',
'tan',
'tanh',
'target',
'tcrossprod',
'tgamma',
'to_array_1d',
'to_array_2d',
'to_complex',
'to_int',
'to_matrix',
'to_row_vector',
'to_vector',
'trace',
'trace_gen_quad_form',
'trace_quad_form',
'trigamma',
'trunc',
'uniform_simplex',
'variance',
'zeros_array',
'zeros_int_array',
'zeros_row_vector'
];
const DISTRIBUTIONS = [
'bernoulli',
'bernoulli_logit',
'bernoulli_logit_glm',
'beta',
'beta_binomial',
'beta_proportion',
'binomial',
'binomial_logit',
'categorical',
'categorical_logit',
'categorical_logit_glm',
'cauchy',
'chi_square',
'dirichlet',
'discrete_range',
'double_exponential',
'exp_mod_normal',
'exponential',
'frechet',
'gamma',
'gaussian_dlm_obs',
'gumbel',
'hmm_latent',
'hypergeometric',
'inv_chi_square',
'inv_gamma',
'inv_wishart',
'inv_wishart_cholesky',
'lkj_corr',
'lkj_corr_cholesky',
'logistic',
'loglogistic',
'lognormal',
'multi_gp',
'multi_gp_cholesky',
'multinomial',
'multinomial_logit',
'multi_normal',
'multi_normal_cholesky',
'multi_normal_prec',
'multi_student_cholesky_t',
'multi_student_t',
'multi_student_t_cholesky',
'neg_binomial',
'neg_binomial_2',
'neg_binomial_2_log',
'neg_binomial_2_log_glm',
'normal',
'normal_id_glm',
'ordered_logistic',
'ordered_logistic_glm',
'ordered_probit',
'pareto',
'pareto_type_2',
'poisson',
'poisson_log',
'poisson_log_glm',
'rayleigh',
'scaled_inv_chi_square',
'skew_double_exponential',
'skew_normal',
'std_normal',
'std_normal_log',
'student_t',
'uniform',
'von_mises',
'weibull',
'wiener',
'wishart',
'wishart_cholesky'
];
const BLOCK_COMMENT = hljs.COMMENT(
/\/\*/,
/\*\//,
{
relevance: 0,
contains: [
{
scope: 'doctag',
match: /@(return|param)/
}
]
}
);
const INCLUDE = {
scope: 'meta',
begin: /#include\b/,
end: /$/,
contains: [
{
match: /[a-z][a-z-._]+/,
scope: 'string'
},
hljs.C_LINE_COMMENT_MODE
]
};
const RANGE_CONSTRAINTS = [
"lower",
"upper",
"offset",
"multiplier"
];
return {
name: 'Stan',
aliases: [ 'stanfuncs' ],
keywords: {
$pattern: hljs.IDENT_RE,
title: BLOCKS,
type: TYPES,
keyword: STATEMENTS,
built_in: FUNCTIONS
},
contains: [
hljs.C_LINE_COMMENT_MODE,
INCLUDE,
hljs.HASH_COMMENT_MODE,
BLOCK_COMMENT,
{
scope: 'built_in',
match: /\s(pi|e|sqrt2|log2|log10)(?=\()/,
relevance: 0
},
{
match: regex.concat(/[<,]\s*/, regex.either(...RANGE_CONSTRAINTS), /\s*=/),
keywords: RANGE_CONSTRAINTS
},
{
scope: 'keyword',
match: /\btarget(?=\s*\+=)/,
},
{
// highlights the 'T' in T[,] for only Stan language distributrions
match: [
/~\s*/,
regex.either(...DISTRIBUTIONS),
/(?:\(\))/,
/\s*T(?=\s*\[)/
],
scope: {
2: "built_in",
4: "keyword"
}
},
{
// highlights distributions that end with special endings
scope: 'built_in',
keywords: DISTRIBUTIONS,
begin: regex.concat(/\w*/, regex.either(...DISTRIBUTIONS), /(_lpdf|_lupdf|_lpmf|_cdf|_lcdf|_lccdf|_qf)(?=\s*[\(.*\)])/)
},
{
// highlights distributions after ~
begin: [
/~/,
/\s*/,
regex.concat(regex.either(...DISTRIBUTIONS), /(?=\s*[\(.*\)])/)
],
scope: { 3: "built_in" }
},
{
// highlights user defined distributions after ~
begin: [
/~/,
/\s*\w+(?=\s*[\(.*\)])/,
'(?!.*/\b(' + regex.either(...DISTRIBUTIONS) + ')\b)'
],
scope: { 2: "title.function" }
},
{
// highlights user defined distributions with special endings
scope: 'title.function',
begin: /\w*(_lpdf|_lupdf|_lpmf|_cdf|_lcdf|_lccdf|_qf)(?=\s*[\(.*\)])/
},
{
scope: 'number',
match: regex.concat(
// Comes from @RunDevelopment accessed 11/29/2021 at
// https://github.com/PrismJS/prism/blob/c53ad2e65b7193ab4f03a1797506a54bbb33d5a2/components/prism-stan.js#L56
// start of big noncapture group which
// 1. gets numbers that are by themselves
// 2. numbers that are separated by _
// 3. numbers that are separted by .
/(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)/,
// grabs scientific notation
// grabs complex numbers with i
/(?:[eE][+-]?\d+(?:_\d+)*)?i?(?!\w)/
),
relevance: 0
},
{
scope: 'string',
begin: /"/,
end: /"/
}
]
};
}
module.exports = stan;

View File

@@ -0,0 +1,44 @@
/*
Language: SubUnit
Author: Sergey Bronnikov <sergeyb@bronevichok.ru>
Website: https://pypi.org/project/python-subunit/
Category: protocols
*/
function subunit(hljs) {
const DETAILS = {
className: 'string',
begin: '\\[\n(multipart)?',
end: '\\]\n'
};
const TIME = {
className: 'string',
begin: '\\d{4}-\\d{2}-\\d{2}(\\s+)\\d{2}:\\d{2}:\\d{2}\.\\d+Z'
};
const PROGRESSVALUE = {
className: 'string',
begin: '(\\+|-)\\d+'
};
const KEYWORDS = {
className: 'keyword',
relevance: 10,
variants: [
{ begin: '^(test|testing|success|successful|failure|error|skip|xfail|uxsuccess)(:?)\\s+(test)?' },
{ begin: '^progress(:?)(\\s+)?(pop|push)?' },
{ begin: '^tags:' },
{ begin: '^time:' }
]
};
return {
name: 'SubUnit',
case_insensitive: true,
contains: [
DETAILS,
TIME,
PROGRESSVALUE,
KEYWORDS
]
};
}
module.exports = subunit;

View File

@@ -0,0 +1,972 @@
/**
* @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;
}
/**
* @param { Array<string | RegExp | Object> } args
* @returns {object}
*/
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 {};
}
}
/** @typedef { {capture?: boolean} } RegexEitherOptions */
/**
* Any of the passed expresssions may match
*
* Creates a huge this | this | that | that match
* @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args
* @returns {string}
*/
function either(...args) {
/** @type { object & {capture?: boolean} } */
const opts = stripOptionsFromArgs(args);
const joined = '('
+ (opts.capture ? "" : "?:")
+ args.map((x) => source(x)).join("|") + ")";
return joined;
}
const keywordWrapper = keyword => concat(
/\b/,
keyword,
/\w$/.test(keyword) ? /\b/ : /\B/
);
// Keywords that require a leading dot.
const dotKeywords = [
'Protocol', // contextual
'Type' // contextual
].map(keywordWrapper);
// Keywords that may have a leading dot.
const optionalDotKeywords = [
'init',
'self'
].map(keywordWrapper);
// should register as keyword, not type
const keywordTypes = [
'Any',
'Self'
];
// Regular keywords and literals.
const keywords = [
// strings below will be fed into the regular `keywords` engine while regex
// will result in additional modes being created to scan for those keywords to
// avoid conflicts with other rules
'actor',
'any', // contextual
'associatedtype',
'async',
'await',
/as\?/, // operator
/as!/, // operator
'as', // operator
'borrowing', // contextual
'break',
'case',
'catch',
'class',
'consume', // contextual
'consuming', // contextual
'continue',
'convenience', // contextual
'copy', // contextual
'default',
'defer',
'deinit',
'didSet', // contextual
'distributed',
'do',
'dynamic', // contextual
'each',
'else',
'enum',
'extension',
'fallthrough',
/fileprivate\(set\)/,
'fileprivate',
'final', // contextual
'for',
'func',
'get', // contextual
'guard',
'if',
'import',
'indirect', // contextual
'infix', // contextual
/init\?/,
/init!/,
'inout',
/internal\(set\)/,
'internal',
'in',
'is', // operator
'isolated', // contextual
'nonisolated', // contextual
'lazy', // contextual
'let',
'macro',
'mutating', // contextual
'nonmutating', // contextual
/open\(set\)/, // contextual
'open', // contextual
'operator',
'optional', // contextual
'override', // contextual
'package',
'postfix', // contextual
'precedencegroup',
'prefix', // contextual
/private\(set\)/,
'private',
'protocol',
/public\(set\)/,
'public',
'repeat',
'required', // contextual
'rethrows',
'return',
'set', // contextual
'some', // contextual
'static',
'struct',
'subscript',
'super',
'switch',
'throws',
'throw',
/try\?/, // operator
/try!/, // operator
'try', // operator
'typealias',
/unowned\(safe\)/, // contextual
/unowned\(unsafe\)/, // contextual
'unowned', // contextual
'var',
'weak', // contextual
'where',
'while',
'willSet' // contextual
];
// NOTE: Contextual keywords are reserved only in specific contexts.
// Ideally, these should be matched using modes to avoid false positives.
// Literals.
const literals = [
'false',
'nil',
'true'
];
// Keywords used in precedence groups.
const precedencegroupKeywords = [
'assignment',
'associativity',
'higherThan',
'left',
'lowerThan',
'none',
'right'
];
// Keywords that start with a number sign (#).
// #(un)available is handled separately.
const numberSignKeywords = [
'#colorLiteral',
'#column',
'#dsohandle',
'#else',
'#elseif',
'#endif',
'#error',
'#file',
'#fileID',
'#fileLiteral',
'#filePath',
'#function',
'#if',
'#imageLiteral',
'#keyPath',
'#line',
'#selector',
'#sourceLocation',
'#warning'
];
// Global functions in the Standard Library.
const builtIns = [
'abs',
'all',
'any',
'assert',
'assertionFailure',
'debugPrint',
'dump',
'fatalError',
'getVaList',
'isKnownUniquelyReferenced',
'max',
'min',
'numericCast',
'pointwiseMax',
'pointwiseMin',
'precondition',
'preconditionFailure',
'print',
'readLine',
'repeatElement',
'sequence',
'stride',
'swap',
'swift_unboxFromSwiftValueWithType',
'transcode',
'type',
'unsafeBitCast',
'unsafeDowncast',
'withExtendedLifetime',
'withUnsafeMutablePointer',
'withUnsafePointer',
'withVaList',
'withoutActuallyEscaping',
'zip'
];
// Valid first characters for operators.
const operatorHead = either(
/[/=\-+!*%<>&|^~?]/,
/[\u00A1-\u00A7]/,
/[\u00A9\u00AB]/,
/[\u00AC\u00AE]/,
/[\u00B0\u00B1]/,
/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,
/[\u2016-\u2017]/,
/[\u2020-\u2027]/,
/[\u2030-\u203E]/,
/[\u2041-\u2053]/,
/[\u2055-\u205E]/,
/[\u2190-\u23FF]/,
/[\u2500-\u2775]/,
/[\u2794-\u2BFF]/,
/[\u2E00-\u2E7F]/,
/[\u3001-\u3003]/,
/[\u3008-\u3020]/,
/[\u3030]/
);
// Valid characters for operators.
const operatorCharacter = either(
operatorHead,
/[\u0300-\u036F]/,
/[\u1DC0-\u1DFF]/,
/[\u20D0-\u20FF]/,
/[\uFE00-\uFE0F]/,
/[\uFE20-\uFE2F]/
// TODO: The following characters are also allowed, but the regex isn't supported yet.
// /[\u{E0100}-\u{E01EF}]/u
);
// Valid operator.
const operator = concat(operatorHead, operatorCharacter, '*');
// Valid first characters for identifiers.
const identifierHead = either(
/[a-zA-Z_]/,
/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,
/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,
/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,
/[\u1E00-\u1FFF]/,
/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,
/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,
/[\u2C00-\u2DFF\u2E80-\u2FFF]/,
/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,
/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,
/[\uFE47-\uFEFE\uFF00-\uFFFD]/ // Should be /[\uFE47-\uFFFD]/, but we have to exclude FEFF.
// The following characters are also allowed, but the regexes aren't supported yet.
// /[\u{10000}-\u{1FFFD}\u{20000-\u{2FFFD}\u{30000}-\u{3FFFD}\u{40000}-\u{4FFFD}]/u,
// /[\u{50000}-\u{5FFFD}\u{60000-\u{6FFFD}\u{70000}-\u{7FFFD}\u{80000}-\u{8FFFD}]/u,
// /[\u{90000}-\u{9FFFD}\u{A0000-\u{AFFFD}\u{B0000}-\u{BFFFD}\u{C0000}-\u{CFFFD}]/u,
// /[\u{D0000}-\u{DFFFD}\u{E0000-\u{EFFFD}]/u
);
// Valid characters for identifiers.
const identifierCharacter = either(
identifierHead,
/\d/,
/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/
);
// Valid identifier.
const identifier = concat(identifierHead, identifierCharacter, '*');
// Valid type identifier.
const typeIdentifier = concat(/[A-Z]/, identifierCharacter, '*');
// Built-in attributes, which are highlighted as keywords.
// @available is handled separately.
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/attributes
const keywordAttributes = [
'attached',
'autoclosure',
concat(/convention\(/, either('swift', 'block', 'c'), /\)/),
'discardableResult',
'dynamicCallable',
'dynamicMemberLookup',
'escaping',
'freestanding',
'frozen',
'GKInspectable',
'IBAction',
'IBDesignable',
'IBInspectable',
'IBOutlet',
'IBSegueAction',
'inlinable',
'main',
'nonobjc',
'NSApplicationMain',
'NSCopying',
'NSManaged',
concat(/objc\(/, identifier, /\)/),
'objc',
'objcMembers',
'propertyWrapper',
'requires_stored_property_inits',
'resultBuilder',
'Sendable',
'testable',
'UIApplicationMain',
'unchecked',
'unknown',
'usableFromInline',
'warn_unqualified_access'
];
// Contextual keywords used in @available and #(un)available.
const availabilityKeywords = [
'iOS',
'iOSApplicationExtension',
'macOS',
'macOSApplicationExtension',
'macCatalyst',
'macCatalystApplicationExtension',
'watchOS',
'watchOSApplicationExtension',
'tvOS',
'tvOSApplicationExtension',
'swift'
];
/*
Language: Swift
Description: Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.
Author: Steven Van Impe <steven.vanimpe@icloud.com>
Contributors: Chris Eidhof <chris@eidhof.nl>, Nate Cook <natecook@gmail.com>, Alexander Lichter <manniL@gmx.net>, Richard Gibson <gibson042@github>
Website: https://swift.org
Category: common, system
*/
/** @type LanguageFn */
function swift(hljs) {
const WHITESPACE = {
match: /\s+/,
relevance: 0
};
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID411
const BLOCK_COMMENT = hljs.COMMENT(
'/\\*',
'\\*/',
{ contains: [ 'self' ] }
);
const COMMENTS = [
hljs.C_LINE_COMMENT_MODE,
BLOCK_COMMENT
];
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID413
// https://docs.swift.org/swift-book/ReferenceManual/zzSummaryOfTheGrammar.html
const DOT_KEYWORD = {
match: [
/\./,
either(...dotKeywords, ...optionalDotKeywords)
],
className: { 2: "keyword" }
};
const KEYWORD_GUARD = {
// Consume .keyword to prevent highlighting properties and methods as keywords.
match: concat(/\./, either(...keywords)),
relevance: 0
};
const PLAIN_KEYWORDS = keywords
.filter(kw => typeof kw === 'string')
.concat([ "_|0" ]); // seems common, so 0 relevance
const REGEX_KEYWORDS = keywords
.filter(kw => typeof kw !== 'string') // find regex
.concat(keywordTypes)
.map(keywordWrapper);
const KEYWORD = { variants: [
{
className: 'keyword',
match: either(...REGEX_KEYWORDS, ...optionalDotKeywords)
}
] };
// find all the regular keywords
const KEYWORDS = {
$pattern: either(
/\b\w+/, // regular keywords
/#\w+/ // number keywords
),
keyword: PLAIN_KEYWORDS
.concat(numberSignKeywords),
literal: literals
};
const KEYWORD_MODES = [
DOT_KEYWORD,
KEYWORD_GUARD,
KEYWORD
];
// https://github.com/apple/swift/tree/main/stdlib/public/core
const BUILT_IN_GUARD = {
// Consume .built_in to prevent highlighting properties and methods.
match: concat(/\./, either(...builtIns)),
relevance: 0
};
const BUILT_IN = {
className: 'built_in',
match: concat(/\b/, either(...builtIns), /(?=\()/)
};
const BUILT_INS = [
BUILT_IN_GUARD,
BUILT_IN
];
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID418
const OPERATOR_GUARD = {
// Prevent -> from being highlighting as an operator.
match: /->/,
relevance: 0
};
const OPERATOR = {
className: 'operator',
relevance: 0,
variants: [
{ match: operator },
{
// dot-operator: only operators that start with a dot are allowed to use dots as
// characters (..., ...<, .*, etc). So there rule here is: a dot followed by one or more
// characters that may also include dots.
match: `\\.(\\.|${operatorCharacter})+` }
]
};
const OPERATORS = [
OPERATOR_GUARD,
OPERATOR
];
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#grammar_numeric-literal
// TODO: Update for leading `-` after lookbehind is supported everywhere
const decimalDigits = '([0-9]_*)+';
const hexDigits = '([0-9a-fA-F]_*)+';
const NUMBER = {
className: 'number',
relevance: 0,
variants: [
// decimal floating-point-literal (subsumes decimal-literal)
{ match: `\\b(${decimalDigits})(\\.(${decimalDigits}))?` + `([eE][+-]?(${decimalDigits}))?\\b` },
// hexadecimal floating-point-literal (subsumes hexadecimal-literal)
{ match: `\\b0x(${hexDigits})(\\.(${hexDigits}))?` + `([pP][+-]?(${decimalDigits}))?\\b` },
// octal-literal
{ match: /\b0o([0-7]_*)+\b/ },
// binary-literal
{ match: /\b0b([01]_*)+\b/ }
]
};
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#grammar_string-literal
const ESCAPED_CHARACTER = (rawDelimiter = "") => ({
className: 'subst',
variants: [
{ match: concat(/\\/, rawDelimiter, /[0\\tnr"']/) },
{ match: concat(/\\/, rawDelimiter, /u\{[0-9a-fA-F]{1,8}\}/) }
]
});
const ESCAPED_NEWLINE = (rawDelimiter = "") => ({
className: 'subst',
match: concat(/\\/, rawDelimiter, /[\t ]*(?:[\r\n]|\r\n)/)
});
const INTERPOLATION = (rawDelimiter = "") => ({
className: 'subst',
label: "interpol",
begin: concat(/\\/, rawDelimiter, /\(/),
end: /\)/
});
const MULTILINE_STRING = (rawDelimiter = "") => ({
begin: concat(rawDelimiter, /"""/),
end: concat(/"""/, rawDelimiter),
contains: [
ESCAPED_CHARACTER(rawDelimiter),
ESCAPED_NEWLINE(rawDelimiter),
INTERPOLATION(rawDelimiter)
]
});
const SINGLE_LINE_STRING = (rawDelimiter = "") => ({
begin: concat(rawDelimiter, /"/),
end: concat(/"/, rawDelimiter),
contains: [
ESCAPED_CHARACTER(rawDelimiter),
INTERPOLATION(rawDelimiter)
]
});
const STRING = {
className: 'string',
variants: [
MULTILINE_STRING(),
MULTILINE_STRING("#"),
MULTILINE_STRING("##"),
MULTILINE_STRING("###"),
SINGLE_LINE_STRING(),
SINGLE_LINE_STRING("#"),
SINGLE_LINE_STRING("##"),
SINGLE_LINE_STRING("###")
]
};
const REGEXP_CONTENTS = [
hljs.BACKSLASH_ESCAPE,
{
begin: /\[/,
end: /\]/,
relevance: 0,
contains: [ hljs.BACKSLASH_ESCAPE ]
}
];
const BARE_REGEXP_LITERAL = {
begin: /\/[^\s](?=[^/\n]*\/)/,
end: /\//,
contains: REGEXP_CONTENTS
};
const EXTENDED_REGEXP_LITERAL = (rawDelimiter) => {
const begin = concat(rawDelimiter, /\//);
const end = concat(/\//, rawDelimiter);
return {
begin,
end,
contains: [
...REGEXP_CONTENTS,
{
scope: "comment",
begin: `#(?!.*${end})`,
end: /$/,
},
],
};
};
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure/#Regular-Expression-Literals
const REGEXP = {
scope: "regexp",
variants: [
EXTENDED_REGEXP_LITERAL('###'),
EXTENDED_REGEXP_LITERAL('##'),
EXTENDED_REGEXP_LITERAL('#'),
BARE_REGEXP_LITERAL
]
};
// https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID412
const QUOTED_IDENTIFIER = { match: concat(/`/, identifier, /`/) };
const IMPLICIT_PARAMETER = {
className: 'variable',
match: /\$\d+/
};
const PROPERTY_WRAPPER_PROJECTION = {
className: 'variable',
match: `\\$${identifierCharacter}+`
};
const IDENTIFIERS = [
QUOTED_IDENTIFIER,
IMPLICIT_PARAMETER,
PROPERTY_WRAPPER_PROJECTION
];
// https://docs.swift.org/swift-book/ReferenceManual/Attributes.html
const AVAILABLE_ATTRIBUTE = {
match: /(@|#(un)?)available/,
scope: 'keyword',
starts: { contains: [
{
begin: /\(/,
end: /\)/,
keywords: availabilityKeywords,
contains: [
...OPERATORS,
NUMBER,
STRING
]
}
] }
};
const KEYWORD_ATTRIBUTE = {
scope: 'keyword',
match: concat(/@/, either(...keywordAttributes), lookahead(either(/\(/, /\s+/))),
};
const USER_DEFINED_ATTRIBUTE = {
scope: 'meta',
match: concat(/@/, identifier)
};
const ATTRIBUTES = [
AVAILABLE_ATTRIBUTE,
KEYWORD_ATTRIBUTE,
USER_DEFINED_ATTRIBUTE
];
// https://docs.swift.org/swift-book/ReferenceManual/Types.html
const TYPE = {
match: lookahead(/\b[A-Z]/),
relevance: 0,
contains: [
{ // Common Apple frameworks, for relevance boost
className: 'type',
match: concat(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/, identifierCharacter, '+')
},
{ // Type identifier
className: 'type',
match: typeIdentifier,
relevance: 0
},
{ // Optional type
match: /[?!]+/,
relevance: 0
},
{ // Variadic parameter
match: /\.\.\./,
relevance: 0
},
{ // Protocol composition
match: concat(/\s+&\s+/, lookahead(typeIdentifier)),
relevance: 0
}
]
};
const GENERIC_ARGUMENTS = {
begin: /</,
end: />/,
keywords: KEYWORDS,
contains: [
...COMMENTS,
...KEYWORD_MODES,
...ATTRIBUTES,
OPERATOR_GUARD,
TYPE
]
};
TYPE.contains.push(GENERIC_ARGUMENTS);
// https://docs.swift.org/swift-book/ReferenceManual/Expressions.html#ID552
// Prevents element names from being highlighted as keywords.
const TUPLE_ELEMENT_NAME = {
match: concat(identifier, /\s*:/),
keywords: "_|0",
relevance: 0
};
// Matches tuples as well as the parameter list of a function type.
const TUPLE = {
begin: /\(/,
end: /\)/,
relevance: 0,
keywords: KEYWORDS,
contains: [
'self',
TUPLE_ELEMENT_NAME,
...COMMENTS,
REGEXP,
...KEYWORD_MODES,
...BUILT_INS,
...OPERATORS,
NUMBER,
STRING,
...IDENTIFIERS,
...ATTRIBUTES,
TYPE
]
};
const GENERIC_PARAMETERS = {
begin: /</,
end: />/,
keywords: 'repeat each',
contains: [
...COMMENTS,
TYPE
]
};
const FUNCTION_PARAMETER_NAME = {
begin: either(
lookahead(concat(identifier, /\s*:/)),
lookahead(concat(identifier, /\s+/, identifier, /\s*:/))
),
end: /:/,
relevance: 0,
contains: [
{
className: 'keyword',
match: /\b_\b/
},
{
className: 'params',
match: identifier
}
]
};
const FUNCTION_PARAMETERS = {
begin: /\(/,
end: /\)/,
keywords: KEYWORDS,
contains: [
FUNCTION_PARAMETER_NAME,
...COMMENTS,
...KEYWORD_MODES,
...OPERATORS,
NUMBER,
STRING,
...ATTRIBUTES,
TYPE,
TUPLE
],
endsParent: true,
illegal: /["']/
};
// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID362
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/declarations/#Macro-Declaration
const FUNCTION_OR_MACRO = {
match: [
/(func|macro)/,
/\s+/,
either(QUOTED_IDENTIFIER.match, identifier, operator)
],
className: {
1: "keyword",
3: "title.function"
},
contains: [
GENERIC_PARAMETERS,
FUNCTION_PARAMETERS,
WHITESPACE
],
illegal: [
/\[/,
/%/
]
};
// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID375
// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID379
const INIT_SUBSCRIPT = {
match: [
/\b(?:subscript|init[?!]?)/,
/\s*(?=[<(])/,
],
className: { 1: "keyword" },
contains: [
GENERIC_PARAMETERS,
FUNCTION_PARAMETERS,
WHITESPACE
],
illegal: /\[|%/
};
// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID380
const OPERATOR_DECLARATION = {
match: [
/operator/,
/\s+/,
operator
],
className: {
1: "keyword",
3: "title"
}
};
// https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#ID550
const PRECEDENCEGROUP = {
begin: [
/precedencegroup/,
/\s+/,
typeIdentifier
],
className: {
1: "keyword",
3: "title"
},
contains: [ TYPE ],
keywords: [
...precedencegroupKeywords,
...literals
],
end: /}/
};
const CLASS_FUNC_DECLARATION = {
match: [
/class\b/,
/\s+/,
/func\b/,
/\s+/,
/\b[A-Za-z_][A-Za-z0-9_]*\b/
],
scope: {
1: "keyword",
3: "keyword",
5: "title.function"
}
};
const CLASS_VAR_DECLARATION = {
match: [
/class\b/,
/\s+/,
/var\b/,
],
scope: {
1: "keyword",
3: "keyword"
}
};
const TYPE_DECLARATION = {
begin: [
/(struct|protocol|class|extension|enum|actor)/,
/\s+/,
identifier,
/\s*/,
],
beginScope: {
1: "keyword",
3: "title.class"
},
keywords: KEYWORDS,
contains: [
GENERIC_PARAMETERS,
...KEYWORD_MODES,
{
begin: /:/,
end: /\{/,
keywords: KEYWORDS,
contains: [
{
scope: "title.class.inherited",
match: typeIdentifier,
},
...KEYWORD_MODES,
],
relevance: 0,
},
]
};
// Add supported submodes to string interpolation.
for (const variant of STRING.variants) {
const interpolation = variant.contains.find(mode => mode.label === "interpol");
// TODO: Interpolation can contain any expression, so there's room for improvement here.
interpolation.keywords = KEYWORDS;
const submodes = [
...KEYWORD_MODES,
...BUILT_INS,
...OPERATORS,
NUMBER,
STRING,
...IDENTIFIERS
];
interpolation.contains = [
...submodes,
{
begin: /\(/,
end: /\)/,
contains: [
'self',
...submodes
]
}
];
}
return {
name: 'Swift',
keywords: KEYWORDS,
contains: [
...COMMENTS,
FUNCTION_OR_MACRO,
INIT_SUBSCRIPT,
CLASS_FUNC_DECLARATION,
CLASS_VAR_DECLARATION,
TYPE_DECLARATION,
OPERATOR_DECLARATION,
PRECEDENCEGROUP,
{
beginKeywords: 'import',
end: /$/,
contains: [ ...COMMENTS ],
relevance: 0
},
REGEXP,
...KEYWORD_MODES,
...BUILT_INS,
...OPERATORS,
NUMBER,
STRING,
...IDENTIFIERS,
...ATTRIBUTES,
TYPE,
TUPLE
]
};
}
module.exports = swift;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/swift" instead of "highlight.js/lib/languages/swift.js"'
);
}
}
emitWarning();
module.exports = require('./swift.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/tap" instead of "highlight.js/lib/languages/tap.js"'
);
}
}
emitWarning();
module.exports = require('./tap.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/tcl" instead of "highlight.js/lib/languages/tcl.js"'
);
}
}
emitWarning();
module.exports = require('./tcl.js');

View File

@@ -0,0 +1,260 @@
/*
Language: Twig
Requires: xml.js
Author: Luke Holder <lukemh@gmail.com>
Description: Twig is a templating language for PHP
Website: https://twig.symfony.com
Category: template
*/
function twig(hljs) {
const regex = hljs.regex;
const FUNCTION_NAMES = [
"absolute_url",
"asset|0",
"asset_version",
"attribute",
"block",
"constant",
"controller|0",
"country_timezones",
"csrf_token",
"cycle",
"date",
"dump",
"expression",
"form|0",
"form_end",
"form_errors",
"form_help",
"form_label",
"form_rest",
"form_row",
"form_start",
"form_widget",
"html_classes",
"include",
"is_granted",
"logout_path",
"logout_url",
"max",
"min",
"parent",
"path|0",
"random",
"range",
"relative_path",
"render",
"render_esi",
"source",
"template_from_string",
"url|0"
];
const FILTERS = [
"abs",
"abbr_class",
"abbr_method",
"batch",
"capitalize",
"column",
"convert_encoding",
"country_name",
"currency_name",
"currency_symbol",
"data_uri",
"date",
"date_modify",
"default",
"escape",
"file_excerpt",
"file_link",
"file_relative",
"filter",
"first",
"format",
"format_args",
"format_args_as_text",
"format_currency",
"format_date",
"format_datetime",
"format_file",
"format_file_from_text",
"format_number",
"format_time",
"html_to_markdown",
"humanize",
"inky_to_html",
"inline_css",
"join",
"json_encode",
"keys",
"language_name",
"last",
"length",
"locale_name",
"lower",
"map",
"markdown",
"markdown_to_html",
"merge",
"nl2br",
"number_format",
"raw",
"reduce",
"replace",
"reverse",
"round",
"slice",
"slug",
"sort",
"spaceless",
"split",
"striptags",
"timezone_name",
"title",
"trans",
"transchoice",
"trim",
"u|0",
"upper",
"url_encode",
"yaml_dump",
"yaml_encode"
];
let TAG_NAMES = [
"apply",
"autoescape",
"block",
"cache",
"deprecated",
"do",
"embed",
"extends",
"filter",
"flush",
"for",
"form_theme",
"from",
"if",
"import",
"include",
"macro",
"sandbox",
"set",
"stopwatch",
"trans",
"trans_default_domain",
"transchoice",
"use",
"verbatim",
"with"
];
TAG_NAMES = TAG_NAMES.concat(TAG_NAMES.map(t => `end${t}`));
const STRING = {
scope: 'string',
variants: [
{
begin: /'/,
end: /'/
},
{
begin: /"/,
end: /"/
},
]
};
const NUMBER = {
scope: "number",
match: /\d+/
};
const PARAMS = {
begin: /\(/,
end: /\)/,
excludeBegin: true,
excludeEnd: true,
contains: [
STRING,
NUMBER
]
};
const FUNCTIONS = {
beginKeywords: FUNCTION_NAMES.join(" "),
keywords: { name: FUNCTION_NAMES },
relevance: 0,
contains: [ PARAMS ]
};
const FILTER = {
match: /\|(?=[A-Za-z_]+:?)/,
beginScope: "punctuation",
relevance: 0,
contains: [
{
match: /[A-Za-z_]+:?/,
keywords: FILTERS
},
]
};
const tagNamed = (tagnames, { relevance }) => {
return {
beginScope: {
1: 'template-tag',
3: 'name'
},
relevance: relevance || 2,
endScope: 'template-tag',
begin: [
/\{%/,
/\s*/,
regex.either(...tagnames)
],
end: /%\}/,
keywords: "in",
contains: [
FILTER,
FUNCTIONS,
STRING,
NUMBER
]
};
};
const CUSTOM_TAG_RE = /[a-z_]+/;
const TAG = tagNamed(TAG_NAMES, { relevance: 2 });
const CUSTOM_TAG = tagNamed([ CUSTOM_TAG_RE ], { relevance: 1 });
return {
name: 'Twig',
aliases: [ 'craftcms' ],
case_insensitive: true,
subLanguage: 'xml',
contains: [
hljs.COMMENT(/\{#/, /#\}/),
TAG,
CUSTOM_TAG,
{
className: 'template-variable',
begin: /\{\{/,
end: /\}\}/,
contains: [
'self',
FILTER,
FUNCTIONS,
STRING,
NUMBER
]
}
]
};
}
module.exports = twig;

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/twig" instead of "highlight.js/lib/languages/twig.js"'
);
}
}
emitWarning();
module.exports = require('./twig.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/vala" instead of "highlight.js/lib/languages/vala.js"'
);
}
}
emitWarning();
module.exports = require('./vala.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/vbscript-html" instead of "highlight.js/lib/languages/vbscript-html.js"'
);
}
}
emitWarning();
module.exports = require('./vbscript-html.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/vim" instead of "highlight.js/lib/languages/vim.js"'
);
}
}
emitWarning();
module.exports = require('./vim.js');

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/wren" instead of "highlight.js/lib/languages/wren.js"'
);
}
}
emitWarning();
module.exports = require('./wren.js');

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
function emitWarning() {
if (!emitWarning.warned) {
emitWarning.warned = true;
console.log(
'Deprecation (warning): Using file extension in specifier is deprecated, use "highlight.js/lib/languages/xml" instead of "highlight.js/lib/languages/xml.js"'
);
}
}
emitWarning();
module.exports = require('./xml.js');

View File

@@ -0,0 +1,360 @@
/*
Language: XQuery
Author: Dirk Kirsten <dk@basex.org>
Contributor: Duncan Paterson
Description: Supports XQuery 3.1 including XQuery Update 3, so also XPath (as it is a superset)
Refactored to process xml constructor syntax and function-bodies. Added missing data-types, xpath operands, inbuilt functions, and query prologs
Website: https://www.w3.org/XML/Query/
Category: functional
Audit: 2020
*/
/** @type LanguageFn */
function xquery(_hljs) {
// see https://www.w3.org/TR/xquery/#id-terminal-delimitation
const KEYWORDS = [
"module",
"schema",
"namespace",
"boundary-space",
"preserve",
"no-preserve",
"strip",
"default",
"collation",
"base-uri",
"ordering",
"context",
"decimal-format",
"decimal-separator",
"copy-namespaces",
"empty-sequence",
"except",
"exponent-separator",
"external",
"grouping-separator",
"inherit",
"no-inherit",
"lax",
"minus-sign",
"per-mille",
"percent",
"schema-attribute",
"schema-element",
"strict",
"unordered",
"zero-digit",
"declare",
"import",
"option",
"function",
"validate",
"variable",
"for",
"at",
"in",
"let",
"where",
"order",
"group",
"by",
"return",
"if",
"then",
"else",
"tumbling",
"sliding",
"window",
"start",
"when",
"only",
"end",
"previous",
"next",
"stable",
"ascending",
"descending",
"allowing",
"empty",
"greatest",
"least",
"some",
"every",
"satisfies",
"switch",
"case",
"typeswitch",
"try",
"catch",
"and",
"or",
"to",
"union",
"intersect",
"instance",
"of",
"treat",
"as",
"castable",
"cast",
"map",
"array",
"delete",
"insert",
"into",
"replace",
"value",
"rename",
"copy",
"modify",
"update"
];
// Node Types (sorted by inheritance)
// atomic types (sorted by inheritance)
const TYPES = [
"item",
"document-node",
"node",
"attribute",
"document",
"element",
"comment",
"namespace",
"namespace-node",
"processing-instruction",
"text",
"construction",
"xs:anyAtomicType",
"xs:untypedAtomic",
"xs:duration",
"xs:time",
"xs:decimal",
"xs:float",
"xs:double",
"xs:gYearMonth",
"xs:gYear",
"xs:gMonthDay",
"xs:gMonth",
"xs:gDay",
"xs:boolean",
"xs:base64Binary",
"xs:hexBinary",
"xs:anyURI",
"xs:QName",
"xs:NOTATION",
"xs:dateTime",
"xs:dateTimeStamp",
"xs:date",
"xs:string",
"xs:normalizedString",
"xs:token",
"xs:language",
"xs:NMTOKEN",
"xs:Name",
"xs:NCName",
"xs:ID",
"xs:IDREF",
"xs:ENTITY",
"xs:integer",
"xs:nonPositiveInteger",
"xs:negativeInteger",
"xs:long",
"xs:int",
"xs:short",
"xs:byte",
"xs:nonNegativeInteger",
"xs:unisignedLong",
"xs:unsignedInt",
"xs:unsignedShort",
"xs:unsignedByte",
"xs:positiveInteger",
"xs:yearMonthDuration",
"xs:dayTimeDuration"
];
const LITERALS = [
"eq",
"ne",
"lt",
"le",
"gt",
"ge",
"is",
"self::",
"child::",
"descendant::",
"descendant-or-self::",
"attribute::",
"following::",
"following-sibling::",
"parent::",
"ancestor::",
"ancestor-or-self::",
"preceding::",
"preceding-sibling::",
"NaN"
];
// functions (TODO: find regex for op: without breaking build)
const BUILT_IN = {
className: 'built_in',
variants: [
{
begin: /\barray:/,
end: /(?:append|filter|flatten|fold-(?:left|right)|for-each(?:-pair)?|get|head|insert-before|join|put|remove|reverse|size|sort|subarray|tail)\b/
},
{
begin: /\bmap:/,
end: /(?:contains|entry|find|for-each|get|keys|merge|put|remove|size)\b/
},
{
begin: /\bmath:/,
end: /(?:a(?:cos|sin|tan[2]?)|cos|exp(?:10)?|log(?:10)?|pi|pow|sin|sqrt|tan)\b/
},
{
begin: /\bop:/,
end: /\(/,
excludeEnd: true
},
{
begin: /\bfn:/,
end: /\(/,
excludeEnd: true
},
// do not highlight inbuilt strings as variable or xml element names
{ begin: /[^</$:'"-]\b(?:abs|accumulator-(?:after|before)|adjust-(?:date(?:Time)?|time)-to-timezone|analyze-string|apply|available-(?:environment-variables|system-properties)|avg|base-uri|boolean|ceiling|codepoints?-(?:equal|to-string)|collation-key|collection|compare|concat|contains(?:-token)?|copy-of|count|current(?:-)?(?:date(?:Time)?|time|group(?:ing-key)?|output-uri|merge-(?:group|key))?data|dateTime|days?-from-(?:date(?:Time)?|duration)|deep-equal|default-(?:collation|language)|distinct-values|document(?:-uri)?|doc(?:-available)?|element-(?:available|with-id)|empty|encode-for-uri|ends-with|environment-variable|error|escape-html-uri|exactly-one|exists|false|filter|floor|fold-(?:left|right)|for-each(?:-pair)?|format-(?:date(?:Time)?|time|integer|number)|function-(?:arity|available|lookup|name)|generate-id|has-children|head|hours-from-(?:dateTime|duration|time)|id(?:ref)?|implicit-timezone|in-scope-prefixes|index-of|innermost|insert-before|iri-to-uri|json-(?:doc|to-xml)|key|lang|last|load-xquery-module|local-name(?:-from-QName)?|(?:lower|upper)-case|matches|max|minutes-from-(?:dateTime|duration|time)|min|months?-from-(?:date(?:Time)?|duration)|name(?:space-uri-?(?:for-prefix|from-QName)?)?|nilled|node-name|normalize-(?:space|unicode)|not|number|one-or-more|outermost|parse-(?:ietf-date|json)|path|position|(?:prefix-from-)?QName|random-number-generator|regex-group|remove|replace|resolve-(?:QName|uri)|reverse|root|round(?:-half-to-even)?|seconds-from-(?:dateTime|duration|time)|snapshot|sort|starts-with|static-base-uri|stream-available|string-?(?:join|length|to-codepoints)?|subsequence|substring-?(?:after|before)?|sum|system-property|tail|timezone-from-(?:date(?:Time)?|time)|tokenize|trace|trans(?:form|late)|true|type-available|unordered|unparsed-(?:entity|text)?-?(?:public-id|uri|available|lines)?|uri-collection|xml-to-json|years?-from-(?:date(?:Time)?|duration)|zero-or-one)\b/ },
{
begin: /\blocal:/,
end: /\(/,
excludeEnd: true
},
{
begin: /\bzip:/,
end: /(?:zip-file|(?:xml|html|text|binary)-entry| (?:update-)?entries)\b/
},
{
begin: /\b(?:util|db|functx|app|xdmp|xmldb):/,
end: /\(/,
excludeEnd: true
}
]
};
const TITLE = {
className: 'title',
begin: /\bxquery version "[13]\.[01]"\s?(?:encoding ".+")?/,
end: /;/
};
const VAR = {
className: 'variable',
begin: /[$][\w\-:]+/
};
const NUMBER = {
className: 'number',
begin: /(\b0[0-7_]+)|(\b0x[0-9a-fA-F_]+)|(\b[1-9][0-9_]*(\.[0-9_]+)?)|[0_]\b/,
relevance: 0
};
const STRING = {
className: 'string',
variants: [
{
begin: /"/,
end: /"/,
contains: [
{
begin: /""/,
relevance: 0
}
]
},
{
begin: /'/,
end: /'/,
contains: [
{
begin: /''/,
relevance: 0
}
]
}
]
};
const ANNOTATION = {
className: 'meta',
begin: /%[\w\-:]+/
};
const COMMENT = {
className: 'comment',
begin: /\(:/,
end: /:\)/,
relevance: 10,
contains: [
{
className: 'doctag',
begin: /@\w+/
}
]
};
// see https://www.w3.org/TR/xquery/#id-computedConstructors
// mocha: computed_inbuilt
// see https://www.regexpal.com/?fam=99749
const COMPUTED = {
beginKeywords: 'element attribute comment document processing-instruction',
end: /\{/,
excludeEnd: true
};
// mocha: direct_method
const DIRECT = {
begin: /<([\w._:-]+)(\s+\S*=('|").*('|"))?>/,
end: /(\/[\w._:-]+>)/,
subLanguage: 'xml',
contains: [
{
begin: /\{/,
end: /\}/,
subLanguage: 'xquery'
},
'self'
]
};
const CONTAINS = [
VAR,
BUILT_IN,
STRING,
NUMBER,
COMMENT,
ANNOTATION,
TITLE,
COMPUTED,
DIRECT
];
return {
name: 'XQuery',
aliases: [
'xpath',
'xq',
'xqm'
],
case_insensitive: false,
illegal: /(proc)|(abstract)|(extends)|(until)|(#)/,
keywords: {
$pattern: /[a-zA-Z$][a-zA-Z0-9_:-]*/,
keyword: KEYWORDS,
type: TYPES,
literal: LITERALS
},
contains: CONTAINS
};
}
module.exports = xquery;

Some files were not shown because too many files have changed in this diff Show More