main
Last change
on this file 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 |
|
---|
3 | module.exports = protobuf
|
---|
4 | protobuf.displayName = 'protobuf'
|
---|
5 | protobuf.aliases = []
|
---|
6 | function protobuf(Prism) {
|
---|
7 | ;(function (Prism) {
|
---|
8 | var builtinTypes =
|
---|
9 | /\b(?:bool|bytes|double|s?fixed(?:32|64)|float|[su]?int(?:32|64)|string)\b/
|
---|
10 | Prism.languages.protobuf = Prism.languages.extend('clike', {
|
---|
11 | 'class-name': [
|
---|
12 | {
|
---|
13 | pattern:
|
---|
14 | /(\b(?:enum|extend|message|service)\s+)[A-Za-z_]\w*(?=\s*\{)/,
|
---|
15 | lookbehind: true
|
---|
16 | },
|
---|
17 | {
|
---|
18 | pattern:
|
---|
19 | /(\b(?:rpc\s+\w+|returns)\s*\(\s*(?:stream\s+)?)\.?[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*(?=\s*\))/,
|
---|
20 | lookbehind: true
|
---|
21 | }
|
---|
22 | ],
|
---|
23 | keyword:
|
---|
24 | /\b(?:enum|extend|extensions|import|message|oneof|option|optional|package|public|repeated|required|reserved|returns|rpc(?=\s+\w)|service|stream|syntax|to)\b(?!\s*=\s*\d)/,
|
---|
25 | function: /\b[a-z_]\w*(?=\s*\()/i
|
---|
26 | })
|
---|
27 | Prism.languages.insertBefore('protobuf', 'operator', {
|
---|
28 | map: {
|
---|
29 | pattern: /\bmap<\s*[\w.]+\s*,\s*[\w.]+\s*>(?=\s+[a-z_]\w*\s*[=;])/i,
|
---|
30 | alias: 'class-name',
|
---|
31 | inside: {
|
---|
32 | punctuation: /[<>.,]/,
|
---|
33 | builtin: builtinTypes
|
---|
34 | }
|
---|
35 | },
|
---|
36 | builtin: builtinTypes,
|
---|
37 | 'positional-class-name': {
|
---|
38 | pattern: /(?:\b|\B\.)[a-z_]\w*(?:\.[a-z_]\w*)*(?=\s+[a-z_]\w*\s*[=;])/i,
|
---|
39 | alias: 'class-name',
|
---|
40 | inside: {
|
---|
41 | punctuation: /\./
|
---|
42 | }
|
---|
43 | },
|
---|
44 | annotation: {
|
---|
45 | pattern: /(\[\s*)[a-z_]\w*(?=\s*=)/i,
|
---|
46 | lookbehind: true
|
---|
47 | }
|
---|
48 | })
|
---|
49 | })(Prism)
|
---|
50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.