Skip to content

feat(pkg): Add capture group syntax#18

Draft
fujidaiti wants to merge 21 commits into
mainfrom
capture-group-tests
Draft

feat(pkg): Add capture group syntax#18
fujidaiti wants to merge 21 commits into
mainfrom
capture-group-tests

Conversation

@fujidaiti

@fujidaiti fujidaiti commented Feb 16, 2026

Copy link
Copy Markdown
Owner

Related to #12.

@fujidaiti fujidaiti self-assigned this Feb 16, 2026
fujidaiti and others added 18 commits March 7, 2026 02:49
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>
@fujidaiti fujidaiti force-pushed the capture-group-tests branch from c059d67 to 41d9cad Compare March 7, 2026 14:44
fujidaiti and others added 2 commits March 8, 2026 17:36
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant