aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-pascaligo.min.js
blob: b7d55dbba922d12d65a9a69623bde14f32f172f9 (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
!(function (e) {
  var n = '(?:\\b\\w+(?:<braces>)?|<braces>)'.replace(/<braces>/g, function () {
      return '\\((?:[^()]|\\((?:[^()]|\\([^()]*\\))*\\))*\\)';
    }),
    t = (e.languages.pascaligo = {
      comment: /\(\*[\s\S]+?\*\)|\/\/.*/,
      string: {
        pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1|\^[a-z]/i,
        greedy: !0,
      },
      'class-name': [
        {
          pattern: RegExp(
            '(\\btype\\s+\\w+\\s+is\\s+)<type>'.replace(/<type>/g, function () {
              return n;
            }),
            'i'
          ),
          lookbehind: !0,
          inside: null,
        },
        {
          pattern: RegExp(
            '<type>(?=\\s+is\\b)'.replace(/<type>/g, function () {
              return n;
            }),
            'i'
          ),
          inside: null,
        },
        {
          pattern: RegExp(
            '(:\\s*)<type>'.replace(/<type>/g, function () {
              return n;
            })
          ),
          lookbehind: !0,
          inside: null,
        },
      ],
      keyword: {
        pattern:
          /(^|[^&])\b(?:begin|block|case|const|else|end|fail|for|from|function|if|is|nil|of|remove|return|skip|then|type|var|while|with)\b/i,
        lookbehind: !0,
      },
      boolean: { pattern: /(^|[^&])\b(?:False|True)\b/i, lookbehind: !0 },
      builtin: {
        pattern: /(^|[^&])\b(?:bool|int|list|map|nat|record|string|unit)\b/i,
        lookbehind: !0,
      },
      function: /\b\w+(?=\s*\()/,
      number: [
        /%[01]+|&[0-7]+|\$[a-f\d]+/i,
        /\b\d+(?:\.\d+)?(?:e[+-]?\d+)?(?:mtz|n)?/i,
      ],
      operator:
        /->|=\/=|\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=|]|\b(?:and|mod|or)\b/,
      punctuation: /\(\.|\.\)|[()\[\]:;,.{}]/,
    }),
    i = ['comment', 'keyword', 'builtin', 'operator', 'punctuation'].reduce(
      function (e, n) {
        return (e[n] = t[n]), e;
      },
      {}
    );
  t['class-name'].forEach(function (e) {
    e.inside = i;
  });
})(Prism);