UNPKG

@highlightjs/cdn-assets

Version:

Syntax highlighting with language autodetection. (pre-compiled CDN assets)

49 lines 4.16 kB
/*! `csharp` grammar compiled for Highlight.js 11.12.0 */ var hljsGrammar=(()=>{"use strict";return e=>{const n={ keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"]), built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"], literal:["default","false","null","true"]},a=e.inherit(e.TITLE_MODE,{ begin:"[a-zA-Z](\\.?\\w)*"}),i="\\d(_*\\d)*",s="([uU][lL]?|[lL][uU]?)?",r={ className:"number",variants:[{begin:"\\b0[bB]_*[01](_*[01])*"+s},{ begin:"(-?)\\b0[xX]_*[a-fA-F0-9](_*[a-fA-F0-9])*"+s},{ begin:"(-?)(\\b"+i+"(\\.("+i+")?)?|\\."+i+")([eE][-+]?"+i+")?([fFdDmM]|[uU][lL]?|[lL][uU]?)?" }],relevance:0},t={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}] },l=e.inherit(t,{illegal:/\n/}),c={className:"subst",begin:/\{/,end:/\}/, keywords:n},o=e.inherit(c,{illegal:/\n/}),d={className:"string",begin:/\$"/, end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/ },e.BACKSLASH_ESCAPE,o]},g={className:"string",begin:/\$@"/,end:'"',contains:[{ begin:/\{\{/},{begin:/\}\}/},{begin:'""'},c]},_=e.inherit(g,{illegal:/\n/, contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},o]}) ;c.contains=[g,d,t,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,e.C_BLOCK_COMMENT_MODE], o.contains=[_,d,l,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,r,e.inherit(e.C_BLOCK_COMMENT_MODE,{ illegal:/\n/})];const E={variants:[{className:"string", begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1 },g,d,t,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},b={begin:"<",end:">", contains:[{beginKeywords:"in out"},a] },u=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",M={ begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"], keywords:n,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0, contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{ begin:"\x3c!--|--\x3e"},{begin:"</?",end:">"}]}] }),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#", end:"$",keywords:{ keyword:"if else elif endif define undef warning error line region endregion pragma checksum" }},E,r,{beginKeywords:"class interface",relevance:0,end:/[{;=]/, illegal:/[^\s:,]/,contains:[{beginKeywords:"where class" },a,b,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace", relevance:0,end:/[{;=]/,illegal:/[^\s:]/, contains:[a,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/, contains:[a,b,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta", begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{ className:"string",begin:/"/,end:/"/}]},{ beginKeywords:"new return throw await else",relevance:0},{className:"function", begin:"("+u+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0, end:/\s*[{;=]/,excludeEnd:!0,keywords:n,contains:[{ beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial", relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0, contains:[e.TITLE_MODE,b],relevance:0},{match:/\(\)/},{className:"params", begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:n,relevance:0, contains:[E,r,e.C_BLOCK_COMMENT_MODE] },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},M]}}})() ;export default hljsGrammar;