1 | hljs.registerLanguage("nginx",(()=>{"use strict";function e(e){
|
2 | return n("(?=",e,")")}function n(...e){return e.map((e=>{
|
3 | return(n=e)?"string"==typeof n?n:n.source:null;var n})).join("")}return a=>{
|
4 | const s={className:"variable",variants:[{begin:/\$\d+/},{begin:/\$\{\w+\}/},{
|
5 | begin:n(/[$@]/,a.UNDERSCORE_IDENT_RE)}]},i={endsWithParent:!0,keywords:{
|
6 | $pattern:/[a-z_]{2,}|\/dev\/poll/,
|
7 | 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"]
|
8 | },relevance:0,illegal:"=>",contains:[a.HASH_COMMENT_MODE,{className:"string",
|
9 | contains:[a.BACKSLASH_ESCAPE,s],variants:[{begin:/"/,end:/"/},{begin:/'/,end:/'/
|
10 | }]},{begin:"([a-z]+):/",end:"\\s",endsWithParent:!0,excludeEnd:!0,contains:[s]
|
11 | },{className:"regexp",contains:[a.BACKSLASH_ESCAPE,s],variants:[{begin:"\\s\\^",
|
12 | end:"\\s|\\{|;",returnEnd:!0},{begin:"~\\*?\\s+",end:"\\s|\\{|;",returnEnd:!0},{
|
13 | begin:"\\*(\\.[a-z\\-]+)+"},{begin:"([a-z\\-]+\\.)+\\*"}]},{className:"number",
|
14 | begin:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{
|
15 | className:"number",begin:"\\b\\d+[kKmMgGdshdwy]?\\b",relevance:0},s]};return{
|
16 | name:"Nginx config",aliases:["nginxconf"],contains:[a.HASH_COMMENT_MODE,{
|
17 | beginKeywords:"upstream location",end:/;|\{/,contains:i.contains,keywords:{
|
18 | section:"upstream location"}},{className:"section",
|
19 | begin:n(a.UNDERSCORE_IDENT_RE+e(/\s+\{/)),relevance:0},{
|
20 | begin:e(a.UNDERSCORE_IDENT_RE+"\\s"),end:";|\\{",contains:[{
|
21 | className:"attribute",begin:a.UNDERSCORE_IDENT_RE,starts:i}],relevance:0}],
|
22 | illegal:"[^\\s\\}\\{]"}}})()); |
\ | No newline at end of file |