highlight-ts
Version:
Highlight.JS in TypeScript (and ES6).
99 lines • 2.9 kB
JavaScript
;
/*
Language: Nginx
Author: Peter Leonov <gojpeg@yandex.ru>
Contributors: Ivan Sagalaev <maniac@softwaremaniacs.org>
Category: common, config
*/
Object.defineProperty(exports, "__esModule", { value: true });
var common_1 = require("../common");
var VAR = {
className: 'variable',
variants: [
{ begin: /\$\d+/ },
{ begin: /\$\{/, end: /}/ },
{ begin: '[\\$\\@]' + common_1.UNDERSCORE_IDENT_RE }
]
};
var DEFAULT = {
endsWithParent: true,
lexemes: '[a-z/_]+',
keywords: {
literal: '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'
},
relevance: 0,
illegal: '=>',
contains: [
common_1.HASH_COMMENT_MODE,
{
className: 'string',
contains: [common_1.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: [common_1.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
]
};
exports.Nginx = {
name: 'nginx',
aliases: ['nginxconf'],
contains: [
common_1.HASH_COMMENT_MODE,
{
begin: common_1.UNDERSCORE_IDENT_RE + '\\s+{', returnBegin: true,
end: '{',
contains: [
{
className: 'section',
begin: common_1.UNDERSCORE_IDENT_RE
}
],
relevance: 0
},
{
begin: common_1.UNDERSCORE_IDENT_RE + '\\s', end: ';|{', returnBegin: true,
contains: [
{
className: 'attribute',
begin: common_1.UNDERSCORE_IDENT_RE,
starts: DEFAULT
}
],
relevance: 0
}
],
illegal: '[^\\s\\}]'
};
//# sourceMappingURL=nginx.js.map