fix nested syntax in custom options - #3673
Merged
Merged
Conversation
An option name component followed by a parenthesized extension failed to parse,
as in protovalidate's:
[(buf.validate.field).string.(buf.validate.predefined) = true]
readWord() absorbed the dots in a name, so the component before
"(buf.validate.predefined)" was read as "string." and the parser then failed
with "expected '=' in option".
The dots in an option name are separators between its components, so consume
them in OptionReader.readOption(), which already loops over them, rather than
letting the word absorb them. Because the reader skips whitespace and comments
between any two tokens, this also accepts the equivalent spellings that protoc
accepts and that a lookahead on the character after the dot would not:
[(foo.field).string . (foo.datetime) = true]
[(foo.field).string./* comment */(foo.datetime) = true]
A component is now also kept whole when it is bracketed, instead of being split
on the dots inside its brackets, which produced the unresolvable names "[foo"
and "datetime]".
See square#3672
Member
|
Thank you @tmanninger I've added a commit as well. Can you sign our CLA so that I can merge this PR? |
Contributor
Author
done. |
oldergod
approved these changes
Aug 14, 2026
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.
This Pull requests fix the following issue: #3672