]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/nginx.js
1 /*! `nginx` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
8 Author: Peter Leonov <gojpeg@yandex.ru>
9 Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
11 Website: https://www.nginx.com
14 /** @type LanguageFn */
15 function nginx(hljs
) {
16 const regex
= hljs
.regex
;
18 className: 'variable',
21 { begin: /\$\{\w+\}/ },
22 { begin: regex
.concat(/[$@]/, hljs
.UNDERSCORE_IDENT_RE
) }
54 $pattern: /[a-z_]{2,}|\/dev\/poll/,
60 hljs
.HASH_COMMENT_MODE
,
64 hljs
.BACKSLASH_ESCAPE
,
78 // this swallows entire URLs to avoid detecting numbers within
89 hljs
.BACKSLASH_ESCAPE
,
98 // regexp locations (~, ~*)
105 { begin: "\\*(\\.[a-z\\-]+)+" },
107 { begin: "([a-z\\-]+\\.)+\\*" }
113 begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b'
118 begin: '\\b\\d+[kKmMgGdshdwy]?\\b',
126 name: 'Nginx config',
127 aliases: [ 'nginxconf' ],
129 hljs
.HASH_COMMENT_MODE
,
131 beginKeywords: "upstream location",
133 contains: DEFAULT
.contains
,
134 keywords: { section: "upstream location" }
137 className: 'section',
138 begin: regex
.concat(hljs
.UNDERSCORE_IDENT_RE
+ regex
.lookahead(/\s+\{/)),
142 begin: regex
.lookahead(hljs
.UNDERSCORE_IDENT_RE
+ '\\s'),
146 className: 'attribute',
147 begin: hljs
.UNDERSCORE_IDENT_RE
,
154 illegal: '[^\\s\\}\\{]'
162 hljs
.registerLanguage('nginx', hljsGrammar
);