summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-brightscript.js
blob: 724837408e0b5b015666e44163a55a8355ec1f50 (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
Prism.languages.brightscript = {
  comment: /(?:\brem|').*/i,
  'directive-statement': {
    pattern: /(^[\t ]*)#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if).*/im,
    lookbehind: true,
    alias: 'property',
    inside: {
      'error-message': {
        pattern: /(^#error).+/,
        lookbehind: true,
      },
      directive: {
        pattern: /^#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if)/,
        alias: 'keyword',
      },
      expression: {
        pattern: /[\s\S]+/,
        inside: null, // see below
      },
    },
  },
  property: {
    pattern: /([\r\n{,][\t ]*)(?:(?!\d)\w+|"(?:[^"\r\n]|"")*"(?!"))(?=[ \t]*:)/,
    lookbehind: true,
    greedy: true,
  },
  string: {
    pattern: /"(?:[^"\r\n]|"")*"(?!")/,
    greedy: true,
  },
  'class-name': {
    pattern: /(\bAs[\t ]+)\w+/i,
    lookbehind: true,
  },
  keyword:
    /\b(?:As|Dim|Each|Else|Elseif|End|Exit|For|Function|Goto|If|In|Print|Return|Step|Stop|Sub|Then|To|While)\b/i,
  boolean: /\b(?:false|true)\b/i,
  function: /\b(?!\d)\w+(?=[\t ]*\()/,
  number: /(?:\b\d+(?:\.\d+)?(?:[ed][+-]\d+)?|&h[a-f\d]+)\b[%&!#]?/i,
  operator: /--|\+\+|>>=?|<<=?|<>|[-+*/\\<>]=?|[:^=?]|\b(?:and|mod|not|or)\b/i,
  punctuation: /[.,;()[\]{}]/,
  constant: /\b(?:LINE_NUM)\b/i,
};

Prism.languages.brightscript['directive-statement'].inside.expression.inside =
  Prism.languages.brightscript;
ass="w"> /(\bdef\s+)[a-z_]\w+/i, lookbehind: true, }, variable: /\B\$\w+/, 'property-literal': { pattern: /\b[a-z_]\w*(?=\s*:(?!:))/i, alias: 'property', }, keyword: /\b(?:as|break|catch|def|elif|else|end|foreach|if|import|include|label|module|modulemeta|null|reduce|then|try|while)\b/, boolean: /\b(?:false|true)\b/, number: /(?:\b\d+\.|\B\.)?\b\d+(?:[eE][+-]?\d+)?\b/, operator: [ { pattern: /\|=?/, alias: 'pipe', }, /\.\.|[!=<>]?=|\?\/\/|\/\/=?|[-+*/%]=?|[<>?]|\b(?:and|not|or)\b/, ], 'c-style-function': { pattern: /\b[a-z_]\w*(?=\s*\()/i, alias: 'function', }, punctuation: /::|[()\[\]{},:;]|\.(?=\s*[\[\w$])/, dot: { pattern: /\./, alias: 'important', }, }); stringInterpolation.interpolation.inside.content.inside = jq; })(Prism);