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.2 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | (function (Prism) {
|
---|
| 2 |
|
---|
| 3 | var builtinTypes = /\b(?:bool|bytes|double|s?fixed(?:32|64)|float|[su]?int(?:32|64)|string)\b/;
|
---|
| 4 |
|
---|
| 5 | Prism.languages.protobuf = Prism.languages.extend('clike', {
|
---|
| 6 | 'class-name': [
|
---|
| 7 | {
|
---|
| 8 | pattern: /(\b(?:enum|extend|message|service)\s+)[A-Za-z_]\w*(?=\s*\{)/,
|
---|
| 9 | lookbehind: true
|
---|
| 10 | },
|
---|
| 11 | {
|
---|
| 12 | pattern: /(\b(?:rpc\s+\w+|returns)\s*\(\s*(?:stream\s+)?)\.?[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*(?=\s*\))/,
|
---|
| 13 | lookbehind: true
|
---|
| 14 | }
|
---|
| 15 | ],
|
---|
| 16 | 'keyword': /\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)/,
|
---|
| 17 | 'function': /\b[a-z_]\w*(?=\s*\()/i
|
---|
| 18 | });
|
---|
| 19 |
|
---|
| 20 | Prism.languages.insertBefore('protobuf', 'operator', {
|
---|
| 21 | 'map': {
|
---|
| 22 | pattern: /\bmap<\s*[\w.]+\s*,\s*[\w.]+\s*>(?=\s+[a-z_]\w*\s*[=;])/i,
|
---|
| 23 | alias: 'class-name',
|
---|
| 24 | inside: {
|
---|
| 25 | 'punctuation': /[<>.,]/,
|
---|
| 26 | 'builtin': builtinTypes
|
---|
| 27 | }
|
---|
| 28 | },
|
---|
| 29 | 'builtin': builtinTypes,
|
---|
| 30 | 'positional-class-name': {
|
---|
| 31 | pattern: /(?:\b|\B\.)[a-z_]\w*(?:\.[a-z_]\w*)*(?=\s+[a-z_]\w*\s*[=;])/i,
|
---|
| 32 | alias: 'class-name',
|
---|
| 33 | inside: {
|
---|
| 34 | 'punctuation': /\./
|
---|
| 35 | }
|
---|
| 36 | },
|
---|
| 37 | 'annotation': {
|
---|
| 38 | pattern: /(\[\s*)[a-z_]\w*(?=\s*=)/i,
|
---|
| 39 | lookbehind: true
|
---|
| 40 | }
|
---|
| 41 | });
|
---|
| 42 |
|
---|
| 43 | }(Prism));
|
---|
Note:
See
TracBrowser
for help on using the repository browser.