File: highlight.proto.html

package info (click to toggle)
kf6-syntax-highlighting 6.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 49,060 kB
  • sloc: xml: 203,100; cpp: 12,878; python: 3,055; sh: 965; perl: 814; ruby: 494; pascal: 393; javascript: 161; php: 150; jsp: 132; lisp: 131; haskell: 124; ada: 119; ansic: 107; makefile: 96; f90: 94; ml: 85; cobol: 81; yacc: 71; csh: 62; exp: 61; erlang: 54; sql: 51; java: 47; sed: 45; objc: 37; tcl: 36; awk: 31; asm: 30; fortran: 18; cs: 10
file content (119 lines) | stat: -rw-r--r-- 12,781 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight.proto</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Protobuf) - Theme (Breeze Light)"/>
</head><body style="background-color:#ffffff;color:#1f1c1b"><pre>
syntax <span style="color:#ca60ca">=</span> <span style="color:#bf0303">"proto2"</span><span style="font-weight:bold">;</span>

<span style="font-weight:bold">package</span> example<span style="font-weight:bold">;</span>

<span style="font-weight:bold">message</span> Object <span style="font-weight:bold">{</span>
  <span style="font-weight:bold">required</span> <span style="color:#0057ae">string</span> name <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span><span style="font-weight:bold">;</span>
  <span style="font-weight:bold">required</span> <span style="color:#0057ae">int32</span> identifier <span style="color:#ca60ca">=</span> <span style="color:#b08000">2</span><span style="font-weight:bold">;</span>
  <span style="font-weight:bold">optional</span> <span style="color:#0057ae">string</span> address <span style="color:#ca60ca">=</span> <span style="color:#b08000">3</span><span style="font-weight:bold">;</span>

  <span style="font-weight:bold">enum</span> ObjectType <span style="font-weight:bold">{</span>
    LOCAL <span style="color:#ca60ca">=</span> <span style="color:#b08000">0</span><span style="font-weight:bold">;</span>
    REMOTE <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span><span style="font-weight:bold">;</span>
    NEITHER <span style="color:#ca60ca">=</span> <span style="color:#b08000">2</span><span style="font-weight:bold">;</span>
    <span style="font-weight:bold">default</span> <span style="color:#ca60ca">=</span> <span style="color:#b08000">3</span><span style="font-weight:bold">;</span> <span style="color:#898887">// no keyword</span>
  <span style="font-weight:bold">}</span>

  <span style="font-weight:bold">message</span> ObjectData <span style="font-weight:bold">{</span>
    <span style="font-weight:bold">required</span> <span style="color:#0057ae">string</span> number <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span><span style="font-weight:bold">;</span>
    <span style="font-weight:bold">optional</span> ObjectType type <span style="color:#ca60ca">=</span> <span style="color:#b08000">2</span> <span style="font-weight:bold">[</span><span style="font-weight:bold">default</span> <span style="color:#ca60ca">=</span> NEITHER<span style="font-weight:bold">]</span><span style="font-weight:bold">;</span>
    <span style="font-weight:bold">optional</span> ObjectType other <span style="color:#ca60ca">=</span> <span style="color:#b08000">3</span> <span style="font-weight:bold">[</span><span style="font-weight:bold">default</span> <span style="color:#ca60ca">=</span> <span style="font-weight:bold">default</span><span style="font-weight:bold">]</span><span style="font-weight:bold">;</span>
    <span style="color:#898887">//                                       ^ no keyword</span>
  <span style="font-weight:bold">}</span>

  <span style="font-weight:bold">repeated</span> ObjectData dataList <span style="color:#ca60ca">=</span> <span style="color:#b08000">4</span><span style="font-weight:bold">;</span>

  <span style="color:#0057ae">string</span> <span style="color:#0057ae">string</span> <span style="color:#ca60ca">=</span> <span style="color:#b08000">5</span><span style="font-weight:bold">;</span>
  <span style="color:#898887">//     ^ no data type</span>
  <span style="color:#0057ae">string</span> <span style="font-weight:bold">default</span> <span style="color:#ca60ca">=</span> <span style="color:#b08000">5</span><span style="font-weight:bold">;</span>
  <span style="color:#898887">//     ^ no keyword</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">message</span> ObjectList <span style="font-weight:bold">{</span>
  <span style="font-weight:bold">repeated</span> Object object <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span><span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">enum</span> EnumAllowingAlias <span style="font-weight:bold">{</span>
  <span style="font-weight:bold">option</span> allow_alias <span style="color:#ca60ca">=</span> <span style="font-weight:bold">true</span><span style="font-weight:bold">;</span>
  EAA_UNSPECIFIED <span style="color:#ca60ca">=</span> <span style="color:#b08000">0</span><span style="font-weight:bold">;</span>
  EAA_STARTED <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span><span style="font-weight:bold">;</span>
  EAA_RUNNING <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span><span style="font-weight:bold">;</span>
  EAA_FINISHED <span style="color:#ca60ca">=</span> <span style="color:#b08000">2</span><span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">message</span> SomeOtherMessage <span style="font-weight:bold">{</span>
  SearchResponse.Result result <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span><span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">package</span> media<span style="font-weight:bold">;</span>

<span style="color:#898887">// A container message to hold stuff that a user has created.</span>
<span style="font-weight:bold">message</span> UserContent <span style="font-weight:bold">{</span>
  <span style="color:#898887">// Set verification to `DECLARATION` to enforce extension declarations for all</span>
  <span style="color:#898887">// extensions in this range.</span>
  <span style="font-weight:bold">extensions</span> <span style="color:#b08000">100</span> to <span style="color:#b08000">199</span> <span style="font-weight:bold">[</span>verification <span style="color:#ca60ca">=</span> DECLARATION<span style="font-weight:bold">]</span><span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>

<span style="color:#898887">// A container message to hold stuff that a user has created.</span>
<span style="font-weight:bold">message</span> UserContent <span style="font-weight:bold">{</span>
  <span style="font-weight:bold">extensions</span> <span style="color:#b08000">100</span> to <span style="color:#b08000">199</span> <span style="font-weight:bold">[</span>
    declaration <span style="color:#ca60ca">=</span> <span style="font-weight:bold">{</span>
      number<span style="color:#ca60ca">:</span> <span style="color:#b08000">126</span><span style="font-weight:bold">,</span>
      full_name<span style="color:#ca60ca">:</span> <span style="color:#bf0303">".kittens.kitten_videos"</span><span style="font-weight:bold">,</span>
      type<span style="color:#ca60ca">:</span> <span style="color:#bf0303">".kittens.Video"</span><span style="font-weight:bold">,</span>
      <span style="font-weight:bold">repeated</span><span style="color:#ca60ca">:</span> <span style="font-weight:bold">true</span>
    <span style="font-weight:bold">}</span><span style="font-weight:bold">,</span>
    <span style="color:#898887">// Ensures all field numbers in this extension range are declarations.</span>
    verification <span style="color:#ca60ca">=</span> DECLARATION
  <span style="font-weight:bold">]</span><span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">service</span> SearchService <span style="font-weight:bold">{</span>
  <span style="font-weight:bold">rpc</span> Search(SearchRequest) <span style="font-weight:bold">returns</span> (SearchResponse)<span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">message</span> RequestType <span style="font-weight:bold">{}</span>
<span style="font-weight:bold">message</span> ResponseType <span style="font-weight:bold">{}</span>

<span style="font-weight:bold">service</span> MyService <span style="font-weight:bold">{</span>
  <span style="font-weight:bold">option</span> (my_service_option) <span style="color:#ca60ca">=</span> FOO<span style="font-weight:bold">;</span>

  <span style="font-weight:bold">rpc</span> MyMethod(RequestType) <span style="font-weight:bold">returns</span>(ResponseType) <span style="font-weight:bold">{</span>
    <span style="color:#898887">// Note:  my_method_option has type MyMessage.  We can set each field</span>
    <span style="color:#898887">//   within it using a separate "option" line.</span>
    <span style="font-weight:bold">option</span> (my_method_option).foo <span style="color:#ca60ca">=</span> <span style="color:#b08000">567</span><span style="font-weight:bold">;</span>
    <span style="font-weight:bold">option</span> (my_method_option).bar <span style="color:#ca60ca">=</span> <span style="color:#bf0303">"Some string"</span><span style="font-weight:bold">;</span>
  <span style="font-weight:bold">}</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">import</span> <span style="color:#bf0303">"google/protobuf/descriptor.proto"</span><span style="font-weight:bold">;</span>

<span style="font-weight:bold">extend</span> google.protobuf.EnumValueOptions <span style="font-weight:bold">{</span>
  <span style="color:#0057ae">string</span> string_name <span style="color:#ca60ca">=</span> <span style="color:#b08000">123456789</span><span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">enum</span> Data <span style="font-weight:bold">{</span>
  DATA_UNSPECIFIED <span style="color:#ca60ca">=</span> <span style="color:#b08000">0</span><span style="font-weight:bold">;</span>
  DATA_SEARCH <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span> <span style="font-weight:bold">[</span>deprecated <span style="color:#ca60ca">=</span> <span style="font-weight:bold">true</span><span style="font-weight:bold">]</span><span style="font-weight:bold">;</span>
  DATA_DISPLAY <span style="color:#ca60ca">=</span> <span style="color:#b08000">2</span> <span style="font-weight:bold">[</span>
    (string_name) <span style="color:#ca60ca">=</span> <span style="color:#bf0303">"x</span><span style="color:#924c9d">\uafe2</span><span style="color:#bf0303">3</span><span style="color:#924c9d">\U00012345</span><span style="color:#bf0303">6</span><span style="color:#924c9d">\n</span><span style="color:#bf0303">x</span><span style="color:#924c9d">\x43</span><span style="color:#bf0303">3</span><span style="color:#924c9d">\xa</span><span style="color:#bf0303">g</span><span style="color:#924c9d">\012</span><span style="color:#bf0303">3</span><span style="color:#bf0303;text-decoration:underline">\u1</span><span style="color:#bf0303">xx</span><span style="color:#bf0303;text-decoration:underline">\</span><span style="color:#bf0303">p</span><span style="color:#bf0303;text-decoration:underline">\U0010a</span><span style="color:#bf0303">i"</span>
  <span style="font-weight:bold">]</span><span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>

<span style="font-weight:bold">message</span> Outer <span style="font-weight:bold">{</span>
  <span style="font-weight:bold">option</span> (my_option).a <span style="color:#ca60ca">=</span> <span style="font-weight:bold">true</span><span style="font-weight:bold">;</span>
  <span style="font-weight:bold">message</span> Inner <span style="font-weight:bold">{</span>   <span style="color:#898887">// Level 2</span>
    <span style="font-weight:bold">required</span> <span style="color:#0057ae">int64</span> ival <span style="color:#ca60ca">=</span> <span style="color:#b08000">1</span><span style="font-weight:bold">;</span>
  <span style="font-weight:bold">}</span>
  map<span style="font-weight:bold">&lt;</span><span style="color:#0057ae">int32</span><span style="font-weight:bold">,</span> <span style="color:#0057ae">string</span><span style="font-weight:bold">></span> my_map <span style="color:#ca60ca">=</span> <span style="color:#b08000">2</span><span style="font-weight:bold">;</span>
  <span style="font-weight:bold">extensions</span> <span style="color:#b08000">20</span> to <span style="color:#b08000">30</span><span style="font-weight:bold">;</span>
  <span style="color:#0057ae">float</span> n <span style="color:#ca60ca">=</span> .<span style="color:#b08000">2</span><span style="font-weight:bold">;</span>
  <span style="color:#0057ae">float</span> n <span style="color:#ca60ca">=</span> <span style="color:#b08000">inf</span><span style="font-weight:bold">;</span>
<span style="font-weight:bold">}</span>
</pre></body></html>