github.com/hoveychen/protoreflect@v1.4.7-0.20221103114119-0b4b3385ec76/desc/protoprint/testfiles/test-non-files-full.txt (about) 1 -------- desc_test_comments.proto (*desc.FileDescriptor) -------- 2 // This is the first detached comment for the syntax. 3 4 // This is a second detached comment. 5 6 // This is a third. 7 8 // Syntax comment... 9 syntax = "proto2"; // Syntax trailer. 10 11 // And now the package declaration 12 package foo.bar; 13 14 // option comments FTW!!! 15 option go_package = "github.com/hoveychen/protoreflect/internal/testprotos"; 16 17 import "google/protobuf/empty.proto"; 18 19 import "desc_test_options.proto"; 20 21 // Multiple white space lines (like above) cannot 22 // be preserved... 23 24 // We need a request for our RPC service below. 25 message /* detached message name */ /* request with a capital R */ Request /* trailer */ { 26 option deprecated = true; // deprecated! 27 28 // A field comment 29 repeated int32 ids = /* detached tag */ /* tag numero uno */ 1 /* 30 * tag trailer 31 * that spans multiple lines... 32 * more than two. 33 */ [packed = true /* packed! */, json_name = "|foo|" /* custom JSON! */, (testprotos.ffubar) = "abc", (testprotos.ffubarb) = "xyz"]; // field trailer #1... 34 35 // lead mfubar 36 option (testprotos.mfubar) = true; // trailing mfubar 37 38 // some detached comments 39 40 // some detached comments 41 42 // Another field comment 43 44 // label comment 45 optional /* type comment */ string /* name comment */ name = 2 [/* default lead */ default = "fubar" /* default trail */]; 46 47 extensions 100 to 200; 48 49 extensions 201 to 250 [(testprotos.exfubarb) = "\000\001\002\003\004\005\006\007", (testprotos.exfubar) = "splat!"]; 50 51 reserved 10 to 20, 30 to 50; 52 53 reserved "foo", "bar", "baz"; 54 55 // Group comment 56 optional group Extras = 3 { 57 // this is a custom option 58 option (testprotos.mfubar) = false; 59 60 optional double dbl = 1; 61 62 optional float flt = 2; 63 64 option no_standard_descriptor_accessor = false; 65 66 // Leading comment... 67 optional string str = 3; // Trailing comment... 68 } 69 70 enum MarioCharacters /* "super"! */ { 71 // allow_alias comments! 72 option allow_alias = true; 73 74 MARIO = 1 [(testprotos.evfubars) = -314, (testprotos.evfubar) = 278]; 75 76 LUIGI = 2 [(testprotos.evfubaruf) = 100, (testprotos.evfubaru) = 200]; 77 78 PEACH = 3; 79 80 BOWSER = 4; 81 82 option (testprotos.efubars) = -321; 83 84 WARIO = 5; 85 86 WALUIGI = 6; 87 88 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 89 90 HEY_HO = 7; 91 92 MAGIKOOPA = 8; 93 94 KAMEK = 8; 95 96 SNIFIT = -101; 97 98 option (testprotos.efubar) = 123; 99 } 100 101 // can be this or that 102 oneof abc { 103 string this = 4; 104 105 int32 that = 5; 106 } 107 108 109 // can be these or those 110 oneof xyz { 111 string these = 6; 112 113 int32 those = 7; 114 } 115 116 117 // map field 118 map<string, string> things = 8; 119 } 120 // And next we'll need some extensions... 121 122 extend /* extendee comment */ Request /* extendee trailer */ { 123 // comment for guid1 124 optional uint64 guid1 = 123; 125 126 // ... and a comment for guid2 127 optional uint64 guid2 = 124; 128 } 129 // extend trailer... 130 131 message /* name leading comment */ AnEmptyMessage /* name trailing comment */ { 132 } 133 134 // Service comment 135 service /* service name */ RpcService { 136 // option that sets field 137 option (testprotos.sfubar) = { id:100 name:"bob" }; 138 139 option deprecated = false; // DEPRECATED! 140 141 option (testprotos.sfubare) = VALUE; 142 143 // Method comment 144 rpc /* rpc name */ StreamingRpc /* comment A */ ( /* comment C */ stream Request ) returns ( /*comment E */ Request ); 145 146 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 147 option deprecated = true; 148 149 option (testprotos.mtfubar) = 12.340000; 150 151 option (testprotos.mtfubard) = 123.456000; 152 } 153 } 154 // service trailer 155 -------- foo.bar.Request (*desc.MessageDescriptor) -------- 156 // Multiple white space lines (like above) cannot 157 // be preserved... 158 159 // We need a request for our RPC service below. 160 message /* detached message name */ /* request with a capital R */ Request /* trailer */ { 161 option deprecated = true; // deprecated! 162 163 // A field comment 164 repeated int32 ids = /* detached tag */ /* tag numero uno */ 1 /* 165 * tag trailer 166 * that spans multiple lines... 167 * more than two. 168 */ [packed = true /* packed! */, json_name = "|foo|" /* custom JSON! */, (testprotos.ffubar) = "abc", (testprotos.ffubarb) = "xyz"]; // field trailer #1... 169 170 // lead mfubar 171 option (testprotos.mfubar) = true; // trailing mfubar 172 173 // some detached comments 174 175 // some detached comments 176 177 // Another field comment 178 179 // label comment 180 optional /* type comment */ string /* name comment */ name = 2 [/* default lead */ default = "fubar" /* default trail */]; 181 182 extensions 100 to 200; 183 184 extensions 201 to 250 [(testprotos.exfubarb) = "\000\001\002\003\004\005\006\007", (testprotos.exfubar) = "splat!"]; 185 186 reserved 10 to 20, 30 to 50; 187 188 reserved "foo", "bar", "baz"; 189 190 // Group comment 191 optional group Extras = 3 { 192 // this is a custom option 193 option (testprotos.mfubar) = false; 194 195 optional double dbl = 1; 196 197 optional float flt = 2; 198 199 option no_standard_descriptor_accessor = false; 200 201 // Leading comment... 202 optional string str = 3; // Trailing comment... 203 } 204 205 enum MarioCharacters /* "super"! */ { 206 // allow_alias comments! 207 option allow_alias = true; 208 209 MARIO = 1 [(testprotos.evfubars) = -314, (testprotos.evfubar) = 278]; 210 211 LUIGI = 2 [(testprotos.evfubaruf) = 100, (testprotos.evfubaru) = 200]; 212 213 PEACH = 3; 214 215 BOWSER = 4; 216 217 option (testprotos.efubars) = -321; 218 219 WARIO = 5; 220 221 WALUIGI = 6; 222 223 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 224 225 HEY_HO = 7; 226 227 MAGIKOOPA = 8; 228 229 KAMEK = 8; 230 231 SNIFIT = -101; 232 233 option (testprotos.efubar) = 123; 234 } 235 236 // can be this or that 237 oneof abc { 238 string this = 4; 239 240 int32 that = 5; 241 } 242 243 244 // can be these or those 245 oneof xyz { 246 string these = 6; 247 248 int32 those = 7; 249 } 250 251 252 // map field 253 map<string, string> things = 8; 254 } 255 // And next we'll need some extensions... 256 -------- foo.bar.Request.ids (*desc.FieldDescriptor) -------- 257 // A field comment 258 repeated int32 ids = /* detached tag */ /* tag numero uno */ 1 /* 259 * tag trailer 260 * that spans multiple lines... 261 * more than two. 262 */ [packed = true /* packed! */, json_name = "|foo|" /* custom JSON! */, (testprotos.ffubar) = "abc", (testprotos.ffubarb) = "xyz"]; // field trailer #1... 263 -------- foo.bar.Request.name (*desc.FieldDescriptor) -------- 264 // some detached comments 265 266 // some detached comments 267 268 // Another field comment 269 270 // label comment 271 optional /* type comment */ string /* name comment */ name = 2 [/* default lead */ default = "fubar" /* default trail */]; 272 -------- foo.bar.Request.extras (*desc.FieldDescriptor) -------- 273 // Group comment 274 optional group Extras = 3 { 275 // this is a custom option 276 option (testprotos.mfubar) = false; 277 278 optional double dbl = 1; 279 280 optional float flt = 2; 281 282 option no_standard_descriptor_accessor = false; 283 284 // Leading comment... 285 optional string str = 3; // Trailing comment... 286 } 287 -------- foo.bar.Request.this (*desc.FieldDescriptor) -------- 288 string this = 4; 289 -------- foo.bar.Request.that (*desc.FieldDescriptor) -------- 290 int32 that = 5; 291 -------- foo.bar.Request.these (*desc.FieldDescriptor) -------- 292 string these = 6; 293 -------- foo.bar.Request.those (*desc.FieldDescriptor) -------- 294 int32 those = 7; 295 -------- foo.bar.Request.things (*desc.FieldDescriptor) -------- 296 // map field 297 map<string, string> things = 8; 298 -------- foo.bar.Request.abc (*desc.OneOfDescriptor) -------- 299 oneof abc { 300 string this = 4; 301 302 int32 that = 5; 303 } 304 -------- foo.bar.Request.xyz (*desc.OneOfDescriptor) -------- 305 oneof xyz { 306 string these = 6; 307 308 int32 those = 7; 309 } 310 -------- foo.bar.Request.Extras (*desc.MessageDescriptor) -------- 311 // Group comment 312 message /* group name */ Extras { 313 // this is a custom option 314 option (testprotos.mfubar) = false; 315 316 optional double dbl = 1; 317 318 optional float flt = 2; 319 320 option no_standard_descriptor_accessor = false; 321 322 // Leading comment... 323 optional string str = 3; // Trailing comment... 324 } 325 -------- foo.bar.Request.Extras.dbl (*desc.FieldDescriptor) -------- 326 optional double dbl = 1; 327 -------- foo.bar.Request.Extras.flt (*desc.FieldDescriptor) -------- 328 optional float flt = 2; 329 -------- foo.bar.Request.Extras.str (*desc.FieldDescriptor) -------- 330 // Leading comment... 331 optional string str = 3; // Trailing comment... 332 -------- foo.bar.Request.ThingsEntry (*desc.MessageDescriptor) -------- 333 message ThingsEntry { 334 option map_entry = true; 335 336 optional string key = 1; 337 338 optional string value = 2; 339 } 340 -------- foo.bar.Request.ThingsEntry.key (*desc.FieldDescriptor) -------- 341 optional string key = 1; 342 -------- foo.bar.Request.ThingsEntry.value (*desc.FieldDescriptor) -------- 343 optional string value = 2; 344 -------- foo.bar.Request.MarioCharacters (*desc.EnumDescriptor) -------- 345 enum MarioCharacters /* "super"! */ { 346 // allow_alias comments! 347 option allow_alias = true; 348 349 MARIO = 1 [(testprotos.evfubars) = -314, (testprotos.evfubar) = 278]; 350 351 LUIGI = 2 [(testprotos.evfubaruf) = 100, (testprotos.evfubaru) = 200]; 352 353 PEACH = 3; 354 355 BOWSER = 4; 356 357 option (testprotos.efubars) = -321; 358 359 WARIO = 5; 360 361 WALUIGI = 6; 362 363 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 364 365 HEY_HO = 7; 366 367 MAGIKOOPA = 8; 368 369 KAMEK = 8; 370 371 SNIFIT = -101; 372 373 option (testprotos.efubar) = 123; 374 } 375 -------- foo.bar.Request.MarioCharacters.MARIO (*desc.EnumValueDescriptor) -------- 376 MARIO = 1 [(testprotos.evfubars) = -314, (testprotos.evfubar) = 278]; 377 -------- foo.bar.Request.MarioCharacters.LUIGI (*desc.EnumValueDescriptor) -------- 378 LUIGI = 2 [(testprotos.evfubaruf) = 100, (testprotos.evfubaru) = 200]; 379 -------- foo.bar.Request.MarioCharacters.PEACH (*desc.EnumValueDescriptor) -------- 380 PEACH = 3; 381 -------- foo.bar.Request.MarioCharacters.BOWSER (*desc.EnumValueDescriptor) -------- 382 BOWSER = 4; 383 -------- foo.bar.Request.MarioCharacters.WARIO (*desc.EnumValueDescriptor) -------- 384 WARIO = 5; 385 -------- foo.bar.Request.MarioCharacters.WALUIGI (*desc.EnumValueDescriptor) -------- 386 WALUIGI = 6; 387 -------- foo.bar.Request.MarioCharacters.SHY_GUY (*desc.EnumValueDescriptor) -------- 388 SHY_GUY = 7 [(testprotos.evfubarsf) = 10101]; 389 -------- foo.bar.Request.MarioCharacters.HEY_HO (*desc.EnumValueDescriptor) -------- 390 HEY_HO = 7; 391 -------- foo.bar.Request.MarioCharacters.MAGIKOOPA (*desc.EnumValueDescriptor) -------- 392 MAGIKOOPA = 8; 393 -------- foo.bar.Request.MarioCharacters.KAMEK (*desc.EnumValueDescriptor) -------- 394 KAMEK = 8; 395 -------- foo.bar.Request.MarioCharacters.SNIFIT (*desc.EnumValueDescriptor) -------- 396 SNIFIT = -101; 397 -------- foo.bar.AnEmptyMessage (*desc.MessageDescriptor) -------- 398 message /* name leading comment */ AnEmptyMessage /* name trailing comment */ { 399 } 400 -------- foo.bar.guid1 (*desc.FieldDescriptor) -------- 401 extend /* extendee comment */ Request /* extendee trailer */ { 402 // comment for guid1 403 optional uint64 guid1 = 123; 404 } 405 -------- foo.bar.guid2 (*desc.FieldDescriptor) -------- 406 extend Request { 407 // ... and a comment for guid2 408 optional uint64 guid2 = 124; 409 } 410 -------- foo.bar.RpcService (*desc.ServiceDescriptor) -------- 411 // Service comment 412 service /* service name */ RpcService { 413 // option that sets field 414 option (testprotos.sfubar) = { id:100 name:"bob" }; 415 416 option deprecated = false; // DEPRECATED! 417 418 option (testprotos.sfubare) = VALUE; 419 420 // Method comment 421 rpc /* rpc name */ StreamingRpc /* comment A */ ( /* comment C */ stream Request ) returns ( /*comment E */ Request ); 422 423 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 424 option deprecated = true; 425 426 option (testprotos.mtfubar) = 12.340000; 427 428 option (testprotos.mtfubard) = 123.456000; 429 } 430 } 431 // service trailer 432 -------- foo.bar.RpcService.StreamingRpc (*desc.MethodDescriptor) -------- 433 // Method comment 434 rpc /* rpc name */ StreamingRpc /* comment A */ ( /* comment C */ stream Request ) returns ( /*comment E */ Request ); 435 -------- foo.bar.RpcService.UnaryRpc (*desc.MethodDescriptor) -------- 436 rpc UnaryRpc ( Request ) returns ( google.protobuf.Empty ) { 437 option deprecated = true; 438 439 option (testprotos.mtfubar) = 12.340000; 440 441 option (testprotos.mtfubard) = 123.456000; 442 }