Skip to content

Commit

Permalink
Merge branch 'main' into multi_class_highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Apr 4, 2021
2 parents 9a9bbb6 + 396e6db commit 384132a
Show file tree
Hide file tree
Showing 59 changed files with 7,059 additions and 1,005 deletions.
13 changes: 12 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,30 @@ Parser:

Grammars:

- chore(properties) disable auto-detection #3102 [Josh Goebel][]
- fix(properties) fix incorrect handling of non-alphanumeric keys #3102 [Egor Rogov][]
- enh(shell) add alias ShellSession [Ryan Mulligan][]
- enh(shell) consider one space after prompt as part of prompt [Ryan Mulligan][]
- fix(nginx) fix bug with $ and @ variables [Josh Goebel][]
- enh(nginx) improving highlighting of some sections [Josh Goebel][]
- fix(vim) variable names may not be zero length [Josh Goebel][]
- enh(sqf) Updated keywords to Arma 3 v2.02 (#3084) [R3voA3][]
- enh(nim) highlight types properly (not as built-ins) [Josh Goebel][]
- (chore) throttle deprecation messages (#3092) [Mihkel Eidast][]
- enh(c) Update keyword list for C11/C18 (#3010) [Josh Goebel][]

New Languages:

- Added 3rd party Splunk search processing language grammar to SUPPORTED_LANGUAGES (#3090) [Wei Su][]

Theme Improvements:

- chore(theme) Update GitHub theme css to match GitHub's current styling (#1616) [Jan Pilzer][]

[Josh Goebel]: https://github.com/joshgoebel
[Ryan Mulligan]: https://github.com/ryantm

[R3voA3]: https://github.com/R3voA3
[Wei Su]: https://github.com/swsoyee

## Version 10.7.1

Expand Down
1 change: 1 addition & 0 deletions SUPPORTED_LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Languages that listed a **Package** below are 3rd party languages and are not bu
| Smalltalk | smalltalk, st | |
| SML | sml, ml | |
| Solidity | solidity, sol | [highlightjs-solidity](https://github.com/highlightjs/highlightjs-solidity) |
| Splunk SPL | spl | [highlightjs-spl](https://github.com/swsoyee/highlightjs-spl) |
| Stan | stan, stanfuncs | |
| Stata | stata | |
| Structured Text | iecst, scl, stl, structured-text | [highlightjs-structured-text](https://github.com/highlightjs/highlightjs-structured-text) |
Expand Down
51 changes: 27 additions & 24 deletions src/languages/abnf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ import * as regex from '../lib/regex.js';

/** @type LanguageFn */
export default function(hljs) {
const regexes = {
ruleDeclaration: /^[a-zA-Z][a-zA-Z0-9-]*/,
unexpectedChars: /[!@#$^&',?+~`|:]/
};
const IDENT = /^[a-zA-Z][a-zA-Z0-9-]*/;

const keywords = [
const KEYWORDS = [
"ALPHA",
"BIT",
"CHAR",
Expand All @@ -33,44 +30,50 @@ export default function(hljs) {
"WSP"
];

const commentMode = hljs.COMMENT(/;/, /$/);
const COMMENT = hljs.COMMENT(/;/, /$/);

const terminalBinaryMode = {
const TERMINAL_BINARY = {
className: "symbol",
begin: /%b[0-1]+(-[0-1]+|(\.[0-1]+)+){0,1}/
match: /%b[0-1]+(-[0-1]+|(\.[0-1]+)+)?/
};

const terminalDecimalMode = {
const TERMINAL_DECIMAL = {
className: "symbol",
begin: /%d[0-9]+(-[0-9]+|(\.[0-9]+)+){0,1}/
match: /%d[0-9]+(-[0-9]+|(\.[0-9]+)+)?/
};

const terminalHexadecimalMode = {
const TERMINAL_HEXADECIMAL = {
className: "symbol",
begin: /%x[0-9A-F]+(-[0-9A-F]+|(\.[0-9A-F]+)+){0,1}/
match: /%x[0-9A-F]+(-[0-9A-F]+|(\.[0-9A-F]+)+)?/
};

const caseSensitivityIndicatorMode = {
const CASE_SENSITIVITY = {
className: "symbol",
begin: /%[si]/
match: /%[si](?=".*")/
};

const ruleDeclarationMode = {
const RULE_DECLARATION = {
className: "attribute",
begin: regex.concat(regexes.ruleDeclaration, /(?=\s*=)/)
match: regex.concat(IDENT, /(?=\s*=)/)
};

const ASSIGNMENT = {
className: "operator",
match: /=\/?/
};

return {
name: 'Augmented Backus-Naur Form',
illegal: regexes.unexpectedChars,
keywords: keywords,
illegal: /[!@#$^&',?+~`|:]/,
keywords: KEYWORDS,
contains: [
ruleDeclarationMode,
commentMode,
terminalBinaryMode,
terminalDecimalMode,
terminalHexadecimalMode,
caseSensitivityIndicatorMode,
ASSIGNMENT,
RULE_DECLARATION,
COMMENT,
TERMINAL_BINARY,
TERMINAL_DECIMAL,
TERMINAL_HEXADECIMAL,
CASE_SENSITIVITY,
hljs.QUOTE_STRING_MODE,
hljs.NUMBER_MODE
]
Expand Down
67 changes: 61 additions & 6 deletions src/languages/actionscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,71 @@ export default function(hljs) {
relevance: 10
};

const KEYWORDS = [
"as",
"break",
"case",
"catch",
"class",
"const",
"continue",
"default",
"delete",
"do",
"dynamic",
"each",
"else",
"extends",
"final",
"finally",
"for",
"function",
"get",
"if",
"implements",
"import",
"in",
"include",
"instanceof",
"interface",
"internal",
"is",
"namespace",
"native",
"new",
"override",
"package",
"private",
"protected",
"public",
"return",
"set",
"static",
"super",
"switch",
"this",
"throw",
"try",
"typeof",
"use",
"var",
"void",
"while",
"with"
];
const LITERALS = [
"true",
"false",
"null",
"undefined"
];

return {
name: 'ActionScript',
aliases: [ 'as' ],
keywords: {
keyword: 'as break case catch class const continue default delete do dynamic each ' +
'else extends final finally for function get if implements import in include ' +
'instanceof interface internal is namespace native new override package private ' +
'protected public return set static super switch this throw try typeof use var void ' +
'while with',
literal: 'true false null undefined'
keyword: KEYWORDS,
literal: LITERALS
},
contains: [
hljs.APOS_STRING_MODE,
Expand Down
89 changes: 79 additions & 10 deletions src/languages/ada.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,89 @@ export default function(hljs) {
]
};

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:
'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',
literal:
'True False'
keyword: KEYWORDS,
literal: [
"True",
"False"
]
},
contains: [
COMMENTS,
Expand Down
55 changes: 50 additions & 5 deletions src/languages/angelscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,60 @@ export default function(hljs) {
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:
'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',
keywords: KEYWORDS,

// avoid close detection with C# and JS
illegal: '(^using\\s+[A-Za-z0-9_\\.]+;$|\\bfunction\\s*[^\\(])',
Expand Down
22 changes: 18 additions & 4 deletions src/languages/apache.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,24 @@ export default function(hljs) {
// keywords aren’t needed for highlighting per se, they only boost relevance
// for a very generally defined mode (starts with a word, ends with line-end
keywords: {
nomarkup:
'order deny allow setenv rewriterule rewriteengine rewritecond documentroot ' +
'sethandler errordocument loadmodule options header listen serverroot ' +
'servername'
_: [
"order",
"deny",
"allow",
"setenv",
"rewriterule",
"rewriteengine",
"rewritecond",
"documentroot",
"sethandler",
"errordocument",
"loadmodule",
"options",
"header",
"listen",
"serverroot",
"servername"
]
},
starts: {
end: /$/,
Expand Down

0 comments on commit 384132a

Please sign in to comment.