]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/bash.js
1 /*! `bash` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= (function () {
7 Author: vah <vahtenberg@gmail.com>
8 Contributrors: Benjamin Pannell <contact@sierrasoftworks.com>
9 Website: https://www.gnu.org/software/bash/
10 Category: common, scripting
13 /** @type LanguageFn */
15 const regex
= hljs
.regex
;
29 className: 'variable',
31 { begin: regex
.concat(/\$[\w\d#@][\w\d_]*/,
32 // negative look-ahead tries to avoid matching patterns that are not
33 // Perl at all like $ident$, @ident@, etc.
34 `(?![\\w\\d])(?![$])`) },
43 contains: [ hljs
.BACKSLASH_ESCAPE
]
45 const COMMENT
= hljs
.inherit(
58 begin: /<<-?\s*(?=\w+)/,
60 hljs
.END_SAME_AS_BEGIN({
67 const QUOTE_STRING
= {
72 hljs
.BACKSLASH_ESCAPE
,
77 SUBST
.contains
.push(QUOTE_STRING
);
78 const ESCAPED_QUOTE
= {
86 const ESCAPED_APOS
= {
94 begin: /\d+#[0-9a-f]+/,
101 const SH_LIKE_SHELLS
= [
112 const KNOWN_SHEBANG
= hljs
.SHEBANG({
113 binary: `(${SH_LIKE_SHELLS.join("|")})`,
117 className: 'function',
118 begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/,
120 contains: [ hljs
.inherit(hljs
.TITLE_MODE
, { begin: /\w[\w\d_]*/ }) ],
149 // to consume paths to prevent keyword matches inside them
150 const PATH_MODE
= { match: /(\/[a-z._-]+)+/ };
152 // http://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
153 const SHELL_BUILT_INS
= [
174 const BASH_BUILT_INS
= [
199 const ZSH_BUILT_INS
= [
270 const GNU_CORE_UTILS
= [
341 // "false", // keyword literal already
365 // "true", // keyword literal already
383 $pattern: /\b[a-z][a-z0-9._-]+\b/,
397 KNOWN_SHEBANG
, // to catch known shells and boost relevancy
398 hljs
.SHEBANG(), // to catch unknown shells but still highlight the shebang
417 export default hljsGrammar
;