summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-cil.js
blob: 5e94ac3f387da70889a1a4be6b4252626b8d1909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Prism.languages.cil = {
  comment: /\/\/.*/,

  string: {
    pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
    greedy: true,
  },

  directive: {
    pattern: /(^|\W)\.[a-z]+(?=\s)/,
    lookbehind: true,
    alias: 'class-name',
  },

  // Actually an assembly reference
  variable: /\[[\w\.]+\]/,

  keyword:
    /\b(?:abstract|ansi|assembly|auto|autochar|beforefieldinit|bool|bstr|byvalstr|catch|char|cil|class|currency|date|decimal|default|enum|error|explicit|extends|extern|famandassem|family|famorassem|final(?:ly)?|float32|float64|hidebysig|u?int(?:8|16|32|64)?|iant|idispatch|implements|import|initonly|instance|interface|iunknown|literal|lpstr|lpstruct|lptstr|lpwstr|managed|method|native(?:Type)?|nested|newslot|object(?:ref)?|pinvokeimpl|private|privatescope|public|reqsecobj|rtspecialname|runtime|sealed|sequential|serializable|specialname|static|string|struct|syschar|tbstr|unicode|unmanagedexp|unsigned|value(?:type)?|variant|virtual|void)\b/,

  function:
    /\b(?:(?:constrained|no|readonly|tail|unaligned|volatile)\.)?(?:conv\.(?:[iu][1248]?|ovf\.[iu][1248]?(?:\.un)?|r\.un|r4|r8)|ldc\.(?:i4(?:\.\d+|\.[mM]1|\.s)?|i8|r4|r8)|ldelem(?:\.[iu][1248]?|\.r[48]|\.ref|a)?|ldind\.(?:[iu][1248]?|r[48]|ref)|stelem\.?(?:i[1248]?|r[48]|ref)?|stind\.(?:i[1248]?|r[48]|ref)?|end(?:fault|filter|finally)|ldarg(?:\.[0-3s]|a(?:\.s)?)?|ldloc(?:\.\d+|\.s)?|sub(?:\.ovf(?:\.un)?)?|mul(?:\.ovf(?:\.un)?)?|add(?:\.ovf(?:\.un)?)?|stloc(?:\.[0-3s])?|refany(?:type|val)|blt(?:\.un)?(?:\.s)?|ble(?:\.un)?(?:\.s)?|bgt(?:\.un)?(?:\.s)?|bge(?:\.un)?(?:\.s)?|unbox(?:\.any)?|init(?:blk|obj)|call(?:i|virt)?|brfalse(?:\.s)?|bne\.un(?:\.s)?|ldloca(?:\.s)?|brzero(?:\.s)?|brtrue(?:\.s)?|brnull(?:\.s)?|brinst(?:\.s)?|starg(?:\.s)?|leave(?:\.s)?|shr(?:\.un)?|rem(?:\.un)?|div(?:\.un)?|clt(?:\.un)?|alignment|castclass|ldvirtftn|beq(?:\.s)?|ckfinite|ldsflda|ldtoken|localloc|mkrefany|rethrow|cgt\.un|arglist|switch|stsfld|sizeof|newobj|newarr|ldsfld|ldnull|ldflda|isinst|throw|stobj|stfld|ldstr|ldobj|ldlen|ldftn|ldfld|cpobj|cpblk|break|br\.s|xor|shl|ret|pop|not|nop|neg|jmp|dup|cgt|ceq|box|and|or|br)\b/,

  boolean: /\b(?:false|true)\b/,
  number: /\b-?(?:0x[0-9a-f]+|\d+)(?:\.[0-9a-f]+)?\b/i,

  punctuation: /[{}[\];(),:=]|IL_[0-9A-Za-z]+/,
};
span>/"""[\s\S]*?"""/, greedy: true, alias: 'string', }, // see below 'string-literal': null, // #!/usr/bin/env wren on the first line hashbang: { pattern: /^#!\/.+/, greedy: true, alias: 'comment', }, // Attributes are special keywords to add meta data to classes attribute: { // #! attributes are stored in class properties // #!myvar = true // #attributes are not stored and dismissed at compilation pattern: /#!?[ \t\u3000]*\w+/, alias: 'keyword', }, 'class-name': [ { // class definition // class Meta {} pattern: /(\bclass\s+)\w+/, lookbehind: true, }, // A class must always start with an uppercase. // File.read /\b[A-Z][a-z\d_]*\b/, ], // A constant can be a variable, class, property or method. Just named in all uppercase letters constant: /\b[A-Z][A-Z\d_]*\b/, null: { pattern: /\bnull\b/, alias: 'keyword', }, keyword: /\b(?:as|break|class|construct|continue|else|for|foreign|if|import|in|is|return|static|super|this|var|while)\b/, boolean: /\b(?:false|true)\b/, number: /\b(?:0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b/i, // Functions can be Class.method() function: /\b[a-z_]\w*(?=\s*[({])/i, operator: /<<|>>|[=!<>]=?|&&|\|\||[-+*/%~^&|?:]|\.{2,3}/, punctuation: /[\[\](){}.,;]/, }; Prism.languages.wren['string-literal'] = { // A single quote string is multiline and can have interpolation (similar to JS backticks ``) pattern: /(^|[^\\"])"(?:[^\\"%]|\\[\s\S]|%(?!\()|%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\))*"/, lookbehind: true, greedy: true, inside: { interpolation: { // "%(interpolation)" pattern: /((?:^|[^\\])(?:\\{2})*)%\((?:[^()]|\((?:[^()]|\([^)]*\))*\))*\)/, lookbehind: true, inside: { expression: { pattern: /^(%\()[\s\S]+(?=\)$)/, lookbehind: true, inside: Prism.languages.wren, }, 'interpolation-punctuation': { pattern: /^%\(|\)$/, alias: 'punctuation', }, }, }, string: /[\s\S]+/, }, };