discourse/vendor/assets/javascripts/highlightjs/languages/powershell.min.js
Joffrey JAFFEUX f3dee5863f
FIX: pins down highlight.js to the last commit of the v9 tree (#9921)
The 10+ version has actually a bug with bash. We will wait a little bit before upgrading to 10, we should also make sure any of the breaking changes listed here https://github.com/highlightjs/highlight.js/blob/master/VERSION_10_BREAKING_CHANGES.md are not impacting us.
2020-05-29 10:21:21 +02:00

1 line
3.0 KiB
JavaScript

hljs.registerLanguage("powershell",function(e){var t={keyword:"if else foreach return do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch hidden static parameter"},n={b:"`[\\s\\S]",relevance:0},c={cN:"variable",v:[{b:/\$\B/},{cN:"keyword",b:/\$this/},{b:/\$[\w\d][\w\d_:]*/}]},i={cN:"string",v:[{b:/"/,e:/"/},{b:/@"/,e:/^"@/}],c:[n,c,{cN:"variable",b:/\$[A-z]/,e:/[^A-z]/}]},a={cN:"string",v:[{b:/'/,e:/'/},{b:/@'/,e:/^'@/}]},r=e.inherit(e.C(null,null),{v:[{b:/#/,e:/$/},{b:/<#/,e:/#>/}],c:[{cN:"doctag",v:[{b:/\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/},{b:/\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/}]}]}),o={cN:"built_in",v:[{b:"(".concat("Add|Clear|Close|Copy|Enter|Exit|Find|Format|Get|Hide|Join|Lock|Move|New|Open|Optimize|Pop|Push|Redo|Remove|Rename|Reset|Resize|Search|Select|Set|Show|Skip|Split|Step|Switch|Undo|Unlock|Watch|Backup|Checkpoint|Compare|Compress|Convert|ConvertFrom|ConvertTo|Dismount|Edit|Expand|Export|Group|Import|Initialize|Limit|Merge|New|Out|Publish|Restore|Save|Sync|Unpublish|Update|Approve|Assert|Complete|Confirm|Deny|Disable|Enable|Install|Invoke|Register|Request|Restart|Resume|Start|Stop|Submit|Suspend|Uninstall|Unregister|Wait|Debug|Measure|Ping|Repair|Resolve|Test|Trace|Connect|Disconnect|Read|Receive|Send|Write|Block|Grant|Protect|Revoke|Unblock|Unprotect|Use|ForEach|Sort|Tee|Where",")+(-)[\\w\\d]+")}]},l={cN:"class",bK:"class enum",e:/\s*[{]/,eE:!0,relevance:0,c:[e.TM]},s={cN:"function",b:/function\s+/,e:/\s*\{|$/,eE:!0,rB:!0,relevance:0,c:[{b:"function",relevance:0,cN:"keyword"},{cN:"title",b:/\w[\w\d]*((-)[\w\d]+)*/,relevance:0},{b:/\(/,e:/\)/,cN:"params",relevance:0,c:[c]}]},p={b:/using\s/,e:/$/,rB:!0,c:[i,a,{cN:"keyword",b:/(using|assembly|command|module|namespace|type)/}]},b={v:[{cN:"operator",b:"(".concat("-and|-as|-band|-bnot|-bor|-bxor|-casesensitive|-ccontains|-ceq|-cge|-cgt|-cle|-clike|-clt|-cmatch|-cne|-cnotcontains|-cnotlike|-cnotmatch|-contains|-creplace|-csplit|-eq|-exact|-f|-file|-ge|-gt|-icontains|-ieq|-ige|-igt|-ile|-ilike|-ilt|-imatch|-in|-ine|-inotcontains|-inotlike|-inotmatch|-ireplace|-is|-isnot|-isplit|-join|-le|-like|-lt|-match|-ne|-not|-notcontains|-notin|-notlike|-notmatch|-or|-regex|-replace|-shl|-shr|-split|-wildcard|-xor",")\\b")},{cN:"literal",b:/(-)[\w\d]+/,relevance:0}]},d={cN:"function",b:/\[.*\]\s*[\w]+[ ]??\(/,e:/$/,rB:!0,relevance:0,c:[{cN:"keyword",b:"(".concat(t.keyword.toString().replace(/\s/g,"|"),")\\b"),endsParent:!0,relevance:0},e.inherit(e.TM,{endsParent:!0})]},u=[d,r,n,e.NM,i,a,o,c,{cN:"literal",b:/\$(null|true|false)\b/},{cN:"selector-tag",b:/\@\B/,relevance:0}],m={b:/\[/,e:/\]/,eB:!0,eE:!0,relevance:0,c:[].concat("self",u,{b:"("+["string","char","byte","int","long","bool","decimal","single","double","DateTime","xml","array","hashtable","void"].join("|")+")",cN:"built_in",relevance:0},{cN:"type",b:/[\.\w\d]+/,relevance:0})};return d.c.unshift(m),{aliases:["ps","ps1"],l:/-?[A-z\.\-]+/,cI:!0,k:t,c:u.concat(l,s,p,b,m)}});