UNPKG

1.27 kBJavaScriptView Raw
1// GitHub: https://github.com/apache/avro
2// Docs: https://avro.apache.org/docs/current/idl.html
3
4Prism.languages['avro-idl'] = {
5 'comment': {
6 pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
7 greedy: true
8 },
9 'string': {
10 pattern: /(^|[^\\])"(?:[^\r\n"\\]|\\.)*"/,
11 lookbehind: true,
12 greedy: true
13 },
14
15 'annotation': {
16 pattern: /@(?:[$\w.-]|`[^\r\n`]+`)+/,
17 greedy: true,
18 alias: 'function'
19 },
20 'function-identifier': {
21 pattern: /`[^\r\n`]+`(?=\s*\()/,
22 greedy: true,
23 alias: 'function'
24 },
25 'identifier': {
26 pattern: /`[^\r\n`]+`/,
27 greedy: true
28 },
29
30 'class-name': {
31 pattern: /(\b(?:enum|error|protocol|record|throws)\b\s+)[$\w]+/,
32 lookbehind: true,
33 greedy: true
34 },
35 'keyword': /\b(?:array|boolean|bytes|date|decimal|double|enum|error|false|fixed|float|idl|import|int|local_timestamp_ms|long|map|null|oneway|protocol|record|schema|string|throws|time_ms|timestamp_ms|true|union|uuid|void)\b/,
36 'function': /\b[a-z_]\w*(?=\s*\()/i,
37
38 'number': [
39 {
40 pattern: /(^|[^\w.])-?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|0x(?:[a-f0-9]+(?:\.[a-f0-9]*)?|\.[a-f0-9]+)(?:p[+-]?\d+)?)[dfl]?(?![\w.])/i,
41 lookbehind: true
42 },
43 /-?\b(?:Infinity|NaN)\b/
44 ],
45
46 'operator': /=/,
47 'punctuation': /[()\[\]{}<>.:,;-]/
48};
49
50Prism.languages.avdl = Prism.languages['avro-idl'];