-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[protobuf2] Fix blockLit to allow trailing comma #4632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Apparently the trailing comma is optional in blockLit, see https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto#L1026 for example. There are other examples in that file that use trailing commas as list delimiters. I think this change is probably also required by antlr#4631 to be fully correct, but it is somewhat independent of that issue.
Duplicates one of the changes from antlr#4632
|
In this PR title, you specified the grammar as In addition, this PR has a grammar change without a single example added. |
|
Is it my fault that the current grammar is broken without any supporting examples? I think you need to be a bit kinder to people who spend their time fixing your code. An apology will be acceptable. |
Sorry, it is not your fault. The person who did the original PR had just one test case. e33d351 However, you need to add one or more examples that test the specific rules that you changed in the grammar. |
|
I added an example supporting this change. The protobuf3 examples are a mess though - hardly any of them actually are parseable, and the tests don't seem to care (the |
I entered the tests carefully taking into consideration whether they are really protobuf3 input. They ones that I test are defined by the desc.xml: All the other files parse: It looks like the pom.xml does not have any tests. I'll fix that right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine. @teverett Please start the workflows for this PR. Ty.
09/26-08:11:36 ~/issues/g4-4632/protobuf/protobuf2
$ bash ../../_scripts/test.sh
Adding protobuf/protobuf2
Number of grammars before sorting and making unique: 1
Number of grammars after sorting and making unique: 1
Grammars to do are: protobuf/protobuf2
grammars = protobuf/protobuf2
targets = Antlr4ng CSharp Cpp Dart Go Java JavaScript Python3 TypeScript
order = grammars
filter = all
Tests now protobuf/protobuf2,Antlr4ng protobuf/protobuf2,CSharp protobuf/protobuf2,Cpp protobuf/protobuf2,Dart protobuf/protobuf2,Go protobuf/protobuf2,Java protobuf/protobuf2,JavaScript protobuf/protobuf2,Python3 protobuf/protobuf2,TypeScript
protobuf/protobuf2,Antlr4ng:
Build 00:00:15
Test 00:00:03
Succeeded.
protobuf/protobuf2,CSharp:
Build 00:00:07
Test 00:00:03
Succeeded.
protobuf/protobuf2,Cpp:
Build 00:00:27
Test 00:00:02
Succeeded.
protobuf/protobuf2,Dart:
Build 00:00:14
Test 00:00:02
Succeeded.
protobuf/protobuf2,Go:
Build 00:00:19
Test 00:00:02
Succeeded.
protobuf/protobuf2,Java:
Build 00:00:06
Test 00:00:02
Succeeded.
protobuf/protobuf2,JavaScript:
Build 00:00:04
Test 00:00:02
Succeeded.
protobuf/protobuf2,Python3:
Build 00:00:06
Test 00:00:04
Succeeded.
protobuf/protobuf2,TypeScript:
Build 00:00:10
Test 00:00:04
Succeeded.
09/26-08:14:22 ~/issues/g4-4632/protobuf/protobuf2
$
|
@dsyer thanks |
Duplicates one of the changes from antlr#4632
Apparently the trailing comma is optional in blockLit, see
https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto#L1026
for example. There are other examples in that file that use trailing commas
as list delimiters.
I haven't seen this comma in the wild in any proto3 files, but that doesn't mean it's not legal I suppose (I haven't changed that grammar for now).
I think this change is probably also required by #4631 to be fully correct,
but it is somewhat independent of that issue.