//% descriptor: true
//% source_code_info: true
edition = "2023";

// This is a leading comment for the package.
package buf.test;
// This is still a trailing comment for the package.

// This is a leading comment for the java_package option source code info, but not the
// top-level option source code info.
option java_package = "build.buf.protocompile"; // Similarly, this is a trailing comment.
option java_multiple_files = true;

// This is a leading comment for the import source code info, but not for the corresponding
// public import source code info.
import public "google/protobuf/descriptor.proto"; // Same with this trailing comment.

// This, as expected, is a leading comment for Foo.
message /*this is thrown away*/ Foo {
  // This is the TRAILING comment for Foo. (It is NOT
  // a detached comment for baz.)

  // Leading comment for message option
  option (a) = 10;
  option (a) = 20; // Trailing comment for the second message option

  // This is a leading comment for baz.
  string /*this is also thrown away*/ baz = 1;
  // This is a trailing comment for baz.

  // This is a leading comment for the reserved range.
  reserved 2, 3 to 4,/*comments between expressions are dropped*/ 5 to 10; // This is a trailing comment for the reserved range.

  // This is a leading comment for the reserved names declaration.
  reserved foo, /*this gets dropped*/ bar; // This is a trailing comment for the reserved range.

  repeated int32 options = 11 /* This is dropped. */ [
    // Comments for option messages are dropped.
    features.repeated_field_encoding = PACKED, // This is also dropped
    (c) = 15,
    (c) = 16
  ];

  // This is also thrown away.
}
// This is NOT a trailing comment. It's also not considered
// a detached comment for Bar. It is discarded.

// This IS a detached comment for Bar.

// This is also a detached comment for Bar.




/*
 * A leading block comment for Bar.
 */
message Bar {
  /*
   *
   * handle edge-cases for block comments*/
  string bar = 1;
  /* start and end block comment on the same line */
  string barbar = 2;
}

// This is the leading comment for enum Baz.
enum Baz { // This is a trailing comment for enum Baz.
  BAZ_ONE = 0;
} // This is NOT a trailing comment for Baz. It is discarded.

/*
  A block comment

  with new lines preserved.
*/
message Qux {}

// This is the leading comment for service FooService.
service FooService { // This is a trailing comment for service FooService.
  // Leading comment for method FooForBar.
  rpc FooForBar(Bar) returns (Foo); // Trailing comment for FooForBar.

  // Leading comment for method BarForBar.
  rpc BarForBar(Bar) returns (Bar) /* This is thrown away */ { // Trailing comment for BarForBar.
  }; // This is NOT a trailing comment for BarForBar. It is discarded.
} // This is NOT a trailing comment for FooService. It is discarded.

extend google.protobuf.FieldOptions {
  repeated int32 c = 1000;
}

extend google.protobuf.MessageOptions {
  repeated int32 a = 1000;
}
