Repository navigation
feat(format): %<name>/%{name} references at any position in a directive - #6
Merged
Merged
Conversation
…directive
A %<name> reference was only recognised at the very start of a directive,
so MRI-valid forms with the name after flags/width/precision failed with
"malformed format string - %<" — e.g. %+15.5<foo>f and %+15<foo>.5f (only
%<foo>+15.5f and %+<foo>15.5f parsed).
A unified consumeRef(s) now resolves a %<name>/%{name} token wherever it
appears — before or after the flags, between width and precision, and
between precision and the verb — invoked from each of those points in
parseFlagsWidthPrec. %{name} is self-terminating (rendered as the value's
to_s with the parsed flags/width/precision, no conversion letter). Mixing a
named reference with an unnumbered or numbered positional one is MRI's
ArgumentError.
go vet, the full suite and the 100% merged-coverage gate stay green; new
oracle cases lock the name-in-any-position forms.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
A
%<name>reference was only recognised at the very start of a directive, so MRI-valid forms with the name after flags/width/precision failed with "malformed format string - %<" — e.g.%+15.5<foo>fand%+15<foo>.5f(only%<foo>+15.5fand%+<foo>15.5fparsed).Fix
A unified
consumeRef(s)resolves a%<name>/%{name}token wherever it appears — before or after the flags, between width and precision, and between precision and the verb — invoked from each of those points inparseFlagsWidthPrec.%{name}is self-terminating (rendered as the value'sto_swith the parsed flags/width/precision, no conversion letter). Mixing a named reference with an unnumbered or numbered positional one raises MRI'sArgumentError.Downstream, this lets
go-embedded-ruby'score/kernel/sprintf"reference by name" specs (supports flags, width, precision and type,allows to place name in any position) pass.Verification
go vet ./..., the full suite and the 100% merged-coverage gate stay green.🤖 Generated with Claude Code