feat: recognize brace expansion patterns in Word.parts#18
Merged
Conversation
Add post-hoc brace expansion detection so downstream consumers
(e.g. security tools) can identify {a,b,c} and {1..10} patterns
in Word.parts without changing s-expression output.
- Add WordSpanKind::BraceExpansion and detect_brace_expansions()
- Add NodeKind::BraceExpansion { content } to AST
- Add WordSegment::BraceExpansion and wire through segment pipeline
- Extract span_to_segment() helper, collapse duplicate match arms
- 15 new unit tests covering comma, range, nested, edge cases
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mpecan
added a commit
that referenced
this pull request
Apr 7, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.10](rable-v0.1.9...rable-v0.1.10) (2026-04-07) ### Features * recognize brace expansion patterns in Word.parts ([fef69dc](fef69dc)) * recognize brace expansion patterns in Word.parts ([#18](#18)) ([c9fd580](c9fd580)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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.
Summary
{a,b,c},{1..10},{a..z}) to the lexer's span tracking systemBraceExpansionnodes inWord.partsdecomposition so downstream consumers (e.g. security tools) can detect brace expansion without runtime evaluationChanges
src/lexer/brace_expansion.rs— scans completed words for brace expansion patterns, skipping quoted/escaped/parameter-expansion regions via existing spansWordSpanKind::BraceExpansion— new span kind inword_builder.rsNodeKind::BraceExpansion { content }— new AST node inast.rsWordSegment::BraceExpansion— new segment variant, wired throughis_decomposable()(notis_sexp_relevant)span_to_segment()helper insexp/word.rs— reducesbuild_segmentslength, collapses three duplicate match armsTest plan
brace_expansion.rs(comma, range, mid-word, nested, empty, single element, trailing/leading comma, param expansion exclusion, adjacent, alpha range, range with step)word_parts.rs(comma form, range form, mid-word split)echo {a,b,c}→(word "{a,b,c}")s-exp regression)cargo clippy --all-targets -- -D warningsclean🤖 Generated with Claude Code