Skip to content

Bash-compatible parsing (PR #24) + 0.4.0 docs and coverage - #28

Merged
Cellule merged 4 commits into
masterfrom
review/pr24-bash-parity-0.4.0
Sep 29, 2026
Merged

Cellule merged 4 commits into
masterfrom
review/pr24-bash-parity-0.4.0

Conversation

@Cellule

@Cellule Cellule commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Builds on #24 (this branch is based on TooTallNate:fix/inner-word-quotes, so its two commits are included in the diff below) and adds the release/docs/test follow-up needed to merge it.

Parser change (from #24, by @TooTallNate)

Rewrites the parser as a character-by-character state machine instead of regex, so adjacent quoted and unquoted segments form a single argument and quote characters are stripped everywhere, matching bash word-splitting:

Verified against real bash (5.3): new output matches bash for all of the above. Remaining divergences are pre-existing and unchanged: backslash escapes are not processed, $variables/globs stay literal, unclosed quotes consume the rest of the input instead of erroring.

Follow-up in this PR

  • test: 12 new active specs covering the merged-quotation behavior (incl. the exact separates unquoted tail of argument starting with quotes #23 case, empty-quote edge cases ""foo/foo""/foo""bar, the parens variant, whitespace/tab robustness) plus 1 pending xit TODO for backslash escapes.
  • docs: README output block fixed for quote-stripping, new "Parsing behavior" section, CHANGELOG 0.4.0 entry (also documents everything since 0.3.1: 0.3.2 bump, TS 5.0.4, CI, minimatch/brace-expansion security bumps), package.json/package-lock.json bumped to 0.4.0.

Test plan

npm test (build + jasmine): 33 specs, 0 failures, 1 pending (the backslash TODO).

TooTallNate and others added 4 commits December 16, 2025 00:58
Rewrote the parser to use a character-by-character state machine
instead of complex regex. This properly handles adjacent quoted
and unquoted segments as a single argument, matching Bash behavior.

Examples of now-correct parsing:
- `--foo="bar"'baz'` → `--foo=barbaz`
- `a" b"` → `a b`
- `run:silent["echo 1"]["echo 2"]` → `run:silent[echo 1][echo 2]`

Also fixed existing test cases that had incorrect expectations
and added new test cases for combined quotation segments.
@Cellule
Cellule merged commit 9a46cc1 into master Sep 29, 2026
3 checks passed
@Cellule
Cellule deleted the review/pr24-bash-parity-0.4.0 branch September 29, 2026 01:08
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.

separates unquoted tail of argument starting with quotes doesn't strip word-internal quotes

2 participants