UNPKG

1.35 kBJavaScriptView Raw
1Prism.languages.bro = {
2
3 'comment': {
4 pattern: /(^|[^\\$])#.*/,
5 lookbehind: true,
6 inside: {
7 'italic': /\b(?:TODO|FIXME|XXX)\b/
8 }
9 },
10
11 'string': {
12 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
13 greedy: true
14 },
15
16 'boolean': /\b[TF]\b/,
17
18 'function': {
19 pattern: /(?:function|hook|event) \w+(?:::\w+)?/,
20 inside: {
21 keyword: /^(?:function|hook|event)/
22 }
23 },
24
25 'variable': {
26 pattern: /(?:global|local) \w+/i,
27 inside: {
28 keyword: /(?:global|local)/
29 }
30 },
31
32 'builtin': /(?:@(?:load(?:-(?:sigs|plugin))?|unload|prefixes|ifn?def|else|(?:end)?if|DIR|FILENAME))|(?:&?(?:redef|priority|log|optional|default|add_func|delete_func|expire_func|read_expire|write_expire|create_expire|synchronized|persistent|rotate_interval|rotate_size|encrypt|raw_output|mergeable|group|error_handler|type_column))/,
33
34 'constant': {
35 pattern: /const \w+/i,
36 inside: {
37 keyword: /const/
38 }
39 },
40
41 'keyword': /\b(?:break|next|continue|alarm|using|of|add|delete|export|print|return|schedule|when|timeout|addr|any|bool|count|double|enum|file|int|interval|pattern|opaque|port|record|set|string|subnet|table|time|vector|for|if|else|in|module|function)\b/,
42
43 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&|\|\|?|\?|\*|\/|~|\^|%/,
44
45 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
46
47 'punctuation': /[{}[\];(),.:]/
48};