Prism.languages.nim = { comment: { pattern: /#.*/, greedy: !0 }, string: { pattern: /(?:\b(?!\d)(?:\w|\\x[89a-fA-F][0-9a-fA-F])+)?(?:"""[\s\S]*?"""(?!")|"(?:\\[\s\S]|""|[^"\\])*")/, greedy: !0, }, char: { pattern: /'(?:\\(?:\d+|x[\da-fA-F]{0,2}|.)|[^'])'/, greedy: !0 }, function: { pattern: /(?:(?!\d)(?:\w|\\x[89a-fA-F][0-9a-fA-F])+|`[^`\r\n]+`)\*?(?:\[[^\]]+\])?(?=\s*\()/, greedy: !0, inside: { operator: /\*$/ }, }, identifier: { pattern: /`[^`\r\n]+`/, greedy: !0, inside: { punctuation: /`/ }, }, number: /\b(?:0[xXoObB][\da-fA-F_]+|\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:[eE][+-]?\d[\d_]*)?)(?:'?[iuf]\d*)?/, keyword: /\b(?:addr|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|include|interface|iterator|let|macro|method|mixin|nil|object|out|proc|ptr|raise|ref|return|static|template|try|tuple|type|using|var|when|while|with|without|yield)\b/, operator: { pattern: /(^|[({\[](?=\.\.)|(?![({\[]\.).)(?:(?:[=+\-*\/<>@$~&%|!?^:\\]|\.\.|\.(?![)}\]]))+|\b(?:and|div|in|is|isnot|mod|not|notin|of|or|shl|shr|xor)\b)/m, lookbehind: !0, }, punctuation: /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/, }; ef='/www.armandphilippot.com/?h=v1.1.0'>summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-pascaligo.js
blob: 337ddef8b128d9a5e922bd81a885b87414f80b34 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/a>
// Test files for the parser itself:
// https://github.com/JesusFreke/smali/tree/master/smali/src/test/resources/LexerTest

Prism.languages.smali = {
  comment: /#.*/,
  string: {
    pattern: /"(?:[^\r\n\\"]|\\.)*"|'(?:[^\r\n\\']|\\(?:.|u[\da-fA-F]{4}))'/,
    greedy: true,
  },

  'class-name': {
    pattern:
      /(^|[^L])L(?:(?:\w+|`[^`\r\n]*`)\/)*(?:[\w$]+|`[^`\r\n]*`)(?=\s*;)/,
    lookbehind: true,
    inside: {
      'class-name': {
        pattern: /(^L|\/)(?:[\w$]+|`[^`\r\n]*`)$/,
        lookbehind: true,
      },
      namespace: {
        pattern: /^(L)(?:(?:\w+|`[^`\r\n]*`)\/)+/,
        lookbehind: true,
        inside: {
          punctuation: /\//,
        },
      },
      builtin: /^L/,
    },
  },
  builtin: [
    {
      // Reference: https://github.com/JesusFreke/smali/wiki/TypesMethodsAndFields#types
      pattern: /([();\[])[BCDFIJSVZ]+/,
      lookbehind: true,
    },
    {
      // e.g. .field mWifiOnUid:I
      pattern: /([\w$>]:)[BCDFIJSVZ]/,
      lookbehind: true,
    },
  ],
  keyword: [
    {
      pattern: /(\.end\s+)[\w-]+/,
      lookbehind: true,
    },
    {
      pattern: /(^|[^\w.-])\.(?!\d)[\w-]+/,
      lookbehind: true,
    },
    {
      pattern:
        /(^|[^\w.-])(?:abstract|annotation|bridge|constructor|enum|final|interface|private|protected|public|runtime|static|synthetic|system|transient)(?![\w.-])/,
      lookbehind: true,
    },
  ],
  function: {
    pattern: /(^|[^\w.-])(?:\w+|<[\w$-]+>)(?=\()/,
    lookbehind: true,
  },

  field: {
    pattern: /[\w$]+(?=:)/,
    alias: 'variable',
  },
  register: {
    pattern: /(^|[^\w.-])[vp]\d(?![\w.-])/,
    lookbehind: true,
    alias: 'variable',
  },

  boolean: {
    pattern: /(^|[^\w.-])(?:false|true)(?![\w.-])/,
    lookbehind: true,
  },
  number: {
    pattern:
      /(^|[^/\w.-])-?(?:NAN|INFINITY|0x(?:[\dA-F]+(?:\.[\dA-F]*)?|\.[\dA-F]+)(?:p[+-]?[\dA-F]+)?|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)[dflst]?(?![\w.-])/i,
    lookbehind: true,
  },

  label: {
    pattern: /(:)\w+/,
    lookbehind: true,
    alias: 'property',
  },

  operator: /->|\.\.|[\[=]/,
  punctuation: /[{}(),;:]/,
};