Repository navigation
fix(parser): case inside $( ) and [[ == [[:class:]] ]] patterns - #2578
Merged
Merged
Conversation
The $( ) end scanner follows case patterns, so a pattern `)` no longer closes the substitution. `[[` is a keyword only before a word break, so `[[:digit:]]*` lexes as a pattern word. Command substitutions no longer stream compound-command output to the output callback. Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | a8fd20f | Commit Preview URL Branch Preview URL |
Oct 07 2026, 05:20 PM |
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.
Requested by Михайло · project thread
What changed
caseworks inside$( ), backticks and"$( )": the$( )end scanner follows case syntax (subject,in, patterns, bodies,;;/;&/;;&), so a pattern's)no longer closes the substitution. Nested and multi-line forms work;echo case)still closes normally.[[ $z == [[:digit:]]* ]]and[[ a1 == [[:alpha:]][[:digit:]] ]]work:[[is the keyword only before a word break, otherwise it starts a bracket-expression word.case,if,{ }) inside a command substitution no longer leak their output to the streaming output callback (the CLI printed it twice).Why
Items from the pseudo-linus oracle gap list (
casein$( ), POSIX class patterns in[[ ]]).Before / After
echo "$(case b in a) echo A;; b) echo B;; esac)"), parse errorBz=5a; [[ $z == [[:digit:]]* ]] && echo digitdigitcase 5 in [[:digit:]]) echo d;; esacdNew spec
case-in-cmdsub.test.sh(7 cases, all verified against bash 5.2), scanner unit tests, and a streaming testcommand_substitution_output_is_not_streamed(failed before the fix).Risk
Low. The scanner only changes depth tracking for unquoted
casekeywords in command position; all spec, integration and bash comparison tests pass.Checklist
cargo fmt,cargo clippy -D warningshttps://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code