Skip to content

fix: recognize operators across line continuations - #25

Merged
webpro merged 6 commits into
webpro-nl:mainfrom
everton-dgn:fix/recognize-operators-across-line-continuations
Nov 19, 2026
Merged

webpro merged 6 commits into
webpro-nl:mainfrom
everton-dgn:fix/recognize-operators-across-line-continuations

Conversation

@everton-dgn

Copy link
Copy Markdown
Contributor

Bash removes backslash-newline pairs before recognizing operators. Splitting an operator across lines could make unbash read it as separate tokens or a different redirection.

Skip continuations while looking ahead for control and redirection operators, preserving physical source offsets. The regression cases check token spans, parsing and printing, with Bash as a syntax and behavior oracle.

The Node 24 suite passed 2,204 tests with 14 cases skipped because the host has Bash 3.2. The focused suite passed on Node 24 and compiled Node 20. A separate Bash 5.1.4 run covered 52 variants with 312 passing checks. Build, typecheck, lint and formatting passed; Node 14 was not run.

Bash removes backslash-newline pairs before recognizing operators. Splitting an operator across lines could make unbash read it as separate tokens or a different redirection.

Skip continuations while looking ahead for control and redirection operators, preserving physical source offsets. The regression cases check token spans, parsing and printing, with Bash as a syntax and behavior oracle.

The Node 24 suite passed 2,204 tests with 14 cases skipped because the host has Bash 3.2. The focused suite passed on Node 24 and compiled Node 20. A separate Bash 5.1.4 run covered 52 variants with 312 passing checks. Build, typecheck, lint and formatting passed; Node 14 was not run.
@pkg-pr-new

pkg-pr-new Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/unbash@25

commit: af0f3ae

@webpro webpro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Éverton! The lexer now recognizes split operators like && and <<< and preserves their source offsets. I fixed the nested here-document case and switched the regression tests to direct assertions so they run without Bash on PATH. Looks good to merge.

@webpro
webpro merged commit 67f6b5f into webpro-nl:main Nov 19, 2026
3 checks passed
@webpro

webpro commented Nov 22, 2026

Copy link
Copy Markdown
Member

🚀 This pull request is included in v6.0.5. See Release 6.0.5 for release notes.

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.

2 participants