UNPKG

highlightjs-func

Version:

highlight.js syntax definition for TON's FunC language

21 lines 1.66 kB
/*! `func` grammar compiled for Highlight.js 11.6.0 */ (()=>{var e=(()=>{"use strict" ;const e=/\"[^\n\"]+\"[Hhcusa]?/,n=/(-?(?!_)([\d_]+|0x[\d_a-fA-F]+)|0b[1_0]+)(?<!_)(?=[\s\)\],;])/ ;return t=>({name:"FunC",aliases:["func"],case_insensitive:!1,keywords:{ keyword:["if","ifnot","else","elseif","elseifnot|10","while","do","until","repeat","return","impure","method_id","forall","asm","inline","inline_ref|10","const","global"], literal:["true","false"], type:["var","int","slice","tuple","cell","builder","cont","_"],built_in:[]}, contains:[{scope:"comment",begin:";;",end:/(?=\n)/},{scope:"comment",begin:"{-", end:"-}",contains:["self"]},{scope:"meta",begin:/#pragma/,end:/;/,contains:[{ scope:"keyword",match:/version|not-version/},{scope:"operator", match:t.regex.either(/>=/,/<=/,/=/,/>/,/</,/\^/)},{scope:"number", match:/([0-9]+)(.[0-9]+)?(.[0-9]+)?/}]},{scope:"keyword",begin:/#include/, end:/;/,contains:[{scope:"string",match:e}]},{scope:"number",match:n},{ scope:"string",match:e},{ match:[/\b(const|global)\b/,/\s+/,/\w+/,/\s+/,'(?!")(`([^`]+)`|((?=_)_|(?=\\{)\\{|(?=\\})\\}|(?![_`{}]))([^;,\\[\\]\\(\\)\\s~.]+))'], scope:{1:"keyword",5:"variable.constant"}},{scope:"function", match:/(?!")(`([^`]+)`|((?=_)_|(?=\{)\{|(?=\})\}|(?![_`{}]))([^;,\[\]\(\)\s~.]+))(?=[(])/ },{scope:"operator", match:t.regex.either(/<=>/,/>=/,/<=/,/!=/,/==/,/\^>>/,/~>>/,/>>/,/<</,/\/%/,/\^%/,/~%/,/\^\//,/~\//,/\+=/,/-=/,/\*=/,/\/=/,/~\/=/,/\^\/=/,/%=/,/\^%=/,/<<=/,/>>=/,/~>>=/,/\^>>=/,/&=/,/\^=/,/\|=/,/\^/,/=/,/~/,/\//,/%/,/-/,/\*/,/\+/,/>/,/</,/&/,/\|/,/:/,/\?/) },{scope:"punctuation",match:/[\.;\(\),\[\]~\{\}]/}]})})() ;hljs.registerLanguage("func",e)})();