Repository navigation
Conversation
The group types and the whole-match type now come from the capture shape analysis the parser computes beside the patterns it reads, and only the topology - which group sits in which branch of which alternation, under which optional quantifier - is walked here. An optional quantifier marks the one node it wraps the way the matcher reads it, a capturing parent carries its optionality to its children, and a group a (?(DEFINE)...) block defines stays optional forever. The subject narrows on its own channel: $matches[0] is the match the engine wrote, constants included, while the subject contains the match and narrows to the accessories the match leaves open - never to the match's constants or digits, and $ admits one final newline. The fixtures re-pin what the sharper shapes read: constants for literals and alternations, numeric-string for digit runs, non-falsy-string for values a mandatory neighbour pins off zero.
…olicy, the packaging residue The conditional branches run one at a time and are read as exclusive as an alternation's; a lookaround condition counts its groups before them, and a group a (?(DEFINE)...) block defines holds the empty string alone — what preg_match writes is pinned in PHPRegexBackendParityTest, compared against the engine itself. The judged engine now follows the pin then the witness: a named engine is a statement honoured in both directions, and the running engine speaks for the analysed PHP when the two share a minor, so a patch release carries the engine it was cut with instead of its minor's first. A release candidate reads as its release, and a broken pin or platform value fails the boot naming the knob to fix. The shapes cache on the judged engine, the ignored-error validator reads its patterns with their modifiers, and the packaging no longer carries what the Hoa retreat left: the autoload fix in bin/phpstan and the scoper stubs and exclusions.
Member
Author
|
Folded into #1: the stack now travels as one pull request while the series is being built. The branch content is unchanged — read-regex-shapes-through-phpregex points at the same commits. |
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.
Stacked on #3.
What
The capturing groups and the whole match now take their types from the capture shape analysis the parser computes beside the patterns it reads. Only the topology stays in
RegexGroupParser: which group sits in which branch of which alternation, under which optional quantifier.Topology rules that mirror what the matcher folds:
(?(DEFINE)...)block defines holds the empty string alone: it is numbered, it is optional, and nothing more is true of it;The subject narrows on its own channel.
$matches[0]is the match the engine wrote, constants included; the subject merely contains the match, so it narrows to the accessories the match leaves open — never to the match's constants or digits, and$admits one final newline ("a\n"matches/^(a|b|c)$/).Against the engine
PHPRegexBackendParityTestmatches every pattern family for real and checks whatpreg_match()writes into$matchesagainst the shape: the group count, the values, the optionality of what the engine leaves unset. About 200 assertions across 17nsrtfixtures re-pin what the sharper shapes read:'a'|'b'|'c','foobar'|'foobarbaz');numeric-stringfor digit runs,'0'|'1'|…|'9'for single digits;non-falsy-stringwhere a mandatory neighbour pins the value off zero (3(/.*)?,(c(\d+)?)?,(\w+)z);(^|foo)reads'').NodeScopeResolverTest: 1879/1879. Static analysis of the repository: 0 errors. Known imprecision, documented here rather than hidden: a lone(?(DEFINE)...)group renders as a union of the empty match and the match with the defined group at''— both arms true, the second never taken by the engine.Packaging
The Hoa retreat's residue leaves with this pull request too: the autoload fix in
bin/phpstan, the scoper stub and theHoaprefix exclusion. The shapes cache on the judged engine, and the ignored-error validator reads its patterns with their modifiers, so/xpatterns inignoreErrorsno longer read as if their blanks were literal.