feat(pkg): Add capture group syntax#18
Draft
fujidaiti wants to merge 21 commits into
Draft
Conversation
Capture groups cover all practical use cases for $TARGET_DIR. Removing it before 1.0 to keep the API surface minimal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Variables can only appear in the path portion of disallow patterns,
not in the scheme or package name (e.g., package:{name}/** is invalid).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduce {...name} syntax for multi-segment capture groups (labeled **)
alongside existing {name} single-segment capture groups (labeled *).
Document greedy left-to-right matching algorithm, validity tables for
both target and disallow patterns, and updated evaluation rules.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change variable reference syntax in disallow/exclude_disallow patterns
from {name}/{...name} to ${name}. This unifies the reference syntax
regardless of capture group type (single or multi-segment) and visually
distinguishes definitions ({name}, {...name}) from references (${name}).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Since ** and * are effectively anonymous capture groups, they follow the
same greedy left-to-right matching algorithm. A pattern like
lib/**/{dir}/**/src/** is valid — ** acts as an anonymous {...name}.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Clarify that plain wildcards * and ** are treated as anonymous capture groups during the matching phase, following the same greedy left-to-right algorithm as named capture groups but discarding their captured values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a clear pseudo-code description of the greedy left-to-right matching algorithm used for capture groups and wildcards. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Treat anything that is neither a literal nor a capture group as a glob segment. If it happens to be an invalid glob, it simply won't match. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Since ${name} is pure text replacement before glob matching, there is no
reason to restrict where it can appear in disallow patterns. Patterns
like package:${name}/** or ${name}*.dart are valid — if the substituted
result doesn't match anything, that's fine.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…seudocode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate $TARGET_DIR usages to named capture groups, and add concrete per-file substitution examples to each affected case study. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c059d67 to
41d9cad
Compare
…rgets Add rule that all target patterns must define the same set of capture group names, with examples of valid and invalid multi-target patterns. Co-Authored-By: Claude Opus 4.6 <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.
Related to #12.