protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Grammar does not allow more than one parenthesized identifier.

Open JakeWharton opened this issue 9 years ago • 9 comments

Defined as

option = "option" optionName  "=" constant ";"
optionName = ( ident | "(" fullIdent ")" ) { "." ident }

with

ident = letter { letter | unicodeDigit | "_" }
fullIdent = ident { "." ident }

yet in unittest_custom_options.proto there's:

message VariousComplexOptions {
  option (.protobuf_unittest.complex_opt1).foo = 42;
  option (protobuf_unittest.complex_opt1).(.protobuf_unittest.quux) = 324;
  option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876;
  option (protobuf_unittest.complex_opt1).foo4 = 99;
  option (protobuf_unittest.complex_opt1).foo4 = 88;
  option (complex_opt2).baz = 987;
  option (complex_opt2).(grault) = 654;
  option (complex_opt2).bar.foo = 743;
  option (complex_opt2).bar.(quux) = 1999;
  option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008;
  option (complex_opt2).(garply).foo = 741;
  option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998;
  option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121;
  option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971;
  option (complex_opt2).fred.waldo = 321;
  option (complex_opt2).barney = { waldo: 101 };
  option (complex_opt2).barney = { waldo: 212 };
  option (protobuf_unittest.complex_opt3).qux = 9;
  option (complex_opt3).complexoptiontype5.plugh = 22;
  option (complexopt6).xyzzy = 24;
}

half of which have multiple parenthesized identifiers.

JakeWharton avatar Jan 28 '16 02:01 JakeWharton

@LisaFC looks like this is worth investigating.

By the way, @JakeWharton do you have your own .proto file parser? Would be curious to know the use case for that.

haberman avatar Feb 10 '16 22:02 haberman

We have systems which need to parse, read, and write protos dynamically at runtime in Java. We also ship our own "compiler" and Java runtime which generates files that are much more terse than protoc's Java format but not as crazy as the choices made by JavaNano. The latter is targeted at Android.

JakeWharton avatar Feb 10 '16 22:02 JakeWharton

How about optionName = ( ident | bracedFullIdent ) { "." ( ident | bracedFullIdent ) } bracedFullIdent = "(" ["."] fullIdent ")"

anandolee avatar Jan 08 '18 22:01 anandolee

correct spec

elharo avatar Oct 01 '21 20:10 elharo

I'm working on correcting the spec based on the suggestion from @anandolee and the updates already made to the proto3 spec.

Logofile avatar Jan 04 '24 21:01 Logofile

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Jun 23 '24 10:06 github-actions[bot]

@Logofile what's the status on this? Issue should remain open until fixed. (and that bot really needs to be turned off. It's actively rude to volunteer contributors.)

elharo avatar Jun 23 '24 12:06 elharo

I've sent a change to @anandolee to review.

Logofile avatar Jun 23 '24 16:06 Logofile

The change has been committed internally. We push internal change to the external site about once a week.

Logofile avatar Jun 24 '24 12:06 Logofile

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.

github-actions[bot] avatar Sep 23 '24 10:09 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Oct 08 '24 10:10 github-actions[bot]