parser: accept group inside oneof. - #41
Merged
Merged
Conversation
VeaaC
force-pushed
the
group-in-oneof-2.13
branch
2 times, most recently
from
August 12, 2026 05:01
1802d9b to
b244f21
Compare
VeaaC
force-pushed
the
group-in-oneof-2.13
branch
from
August 12, 2026 16:21
b244f21 to
99536fd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
groupis legal as a oneof member (spec:OneofGroupDecl), but rapidprotoc rejected thewhole schema with
unexpected input. A oneof is not a scope, soparse_oneofnow returns anOneofBundle— mirroring the existingExtendBundle— and the synthesized message hoists tothe enclosing message while the delimited field joins the oneof.
parse_oneofmoved intoparser.cpp's anonymous namespace alongside
parse_extend, which was never public.Aligning the two element lists it touches against
the grammar removed two stray acceptances:
;between oneof members.MessageElementlistsEmptyDecl;OneofElementdoes not.;or anoptionin anextendbody.ExtensionElementis the only element listcarrying neither. That is deliberate:
ExtensionFieldDeclIdentifiersubtracts only thecardinality keywords, not
option— sooptionis a legal extension-field type namethere, and the
OptionDeclbranch was misparsingextend M { option x = 100; }as anoption declaration.
ExtendNode::optionsis removed with it; the only consumer was aresolve_extendcall that could never fire.A labelled oneof member is refused with protoc's own wording, at protoc's exact column
(previously
unexpected input, pointing past the label).oneof p { optional x = 1; }in afile declaring a message named
optionalis now correctly rejected rather than parsed as afield of that type. An empty oneof body stays accepted: the grammar admits it, and the
prose rule requiring one member is a semantic check we don't make.