source: node_modules/refractor/lang/avro-idl.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1'use strict'
2
3module.exports = avroIdl
4avroIdl.displayName = 'avroIdl'
5avroIdl.aliases = []
6function avroIdl(Prism) {
7 // GitHub: https://github.com/apache/avro
8 // Docs: https://avro.apache.org/docs/current/idl.html
9 Prism.languages['avro-idl'] = {
10 comment: {
11 pattern: /\/\/.*|\/\*[\s\S]*?\*\//,
12 greedy: true
13 },
14 string: {
15 pattern: /(^|[^\\])"(?:[^\r\n"\\]|\\.)*"/,
16 lookbehind: true,
17 greedy: true
18 },
19 annotation: {
20 pattern: /@(?:[$\w.-]|`[^\r\n`]+`)+/,
21 greedy: true,
22 alias: 'function'
23 },
24 'function-identifier': {
25 pattern: /`[^\r\n`]+`(?=\s*\()/,
26 greedy: true,
27 alias: 'function'
28 },
29 identifier: {
30 pattern: /`[^\r\n`]+`/,
31 greedy: true
32 },
33 'class-name': {
34 pattern: /(\b(?:enum|error|protocol|record|throws)\b\s+)[$\w]+/,
35 lookbehind: true,
36 greedy: true
37 },
38 keyword:
39 /\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/,
40 function: /\b[a-z_]\w*(?=\s*\()/i,
41 number: [
42 {
43 pattern:
44 /(^|[^\w.])-?(?:(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|0x(?:[a-f0-9]+(?:\.[a-f0-9]*)?|\.[a-f0-9]+)(?:p[+-]?\d+)?)[dfl]?(?![\w.])/i,
45 lookbehind: true
46 },
47 /-?\b(?:Infinity|NaN)\b/
48 ],
49 operator: /=/,
50 punctuation: /[()\[\]{}<>.:,;-]/
51 }
52 Prism.languages.avdl = Prism.languages['avro-idl']
53}
Note: See TracBrowser for help on using the repository browser.