square/protoparser — pull request #62 by zachmargolis (2014-07-13 16:53:36+00:00)
Title: Parse and preserve parentheses around option names

@JakeWharton
Redo of zachmargolis/protoparser#2

Parentheses around option names are meaningful to the protobuf compiler, they differentiate between custom and built-in options.

From the previous PR:

> If I understand the Google Protobuf Documentation on [Custom Options](https://developers.google.com/protocol-buffers/docs/proto#options), we need to wrap custom options in parens, but leave the built-in ones paren-free.

> > ```protobuf
> > import "google/protobuf/descriptor.proto";
> >
> > extend google.protobuf.MessageOptions {
> > optional string my_option = 51234;
> > }
> >
> > message MyMessage {
> > option (my_option) = "Hello world!";
> > }
> > ```
> > Here we have defined a new message-level option by extending `MessageOptions`. When we then use the option, the option name must be enclosed in parentheses to indicate that it is an extension.