Skip to content

fix: recognize keywords across long line continuations - #23

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

webpro merged 5 commits into
webpro-nl:mainfrom
everton-dgn:fix/recognize-keywords-across-long-line-continuations

Conversation

@everton-dgn

Copy link
Copy Markdown
Contributor

A reserved word split by enough escaped newlines can exceed the lexer's physical length cutoff. For example, if with eight continuations is parsed as a command instead of an if statement.

Remove that cutoff when materializing an eligible non-raw word. The logical keyword length check and the guards for quoting and expansions remain in place. The new cases cover the old boundary, longer continuations, offsets and non-keyword controls, with Bash checking syntax and execution before and after printing.

Validation: all 2,075 tests passed on Node 24, and the 16 focused tests passed as compiled JavaScript on Node 20. Build, type checks, lint, formatting and the Node 24 runtime smoke passed. The Node 14 smoke could not run locally because the available binary is x86_64 and this host is arm64; that CI check remains outstanding.

A reserved word split by enough escaped newlines can exceed the lexer's physical length cutoff. For example, `if` with eight continuations is parsed as a command instead of an if statement.

Remove that cutoff when materializing an eligible non-raw word. The logical keyword length check and the guards for quoting and expansions remain in place. The new cases cover the old boundary, longer continuations, offsets and non-keyword controls, with Bash checking syntax and execution before and after printing.

Validation: all 2,075 tests passed on Node 24, and the 16 focused tests passed as compiled JavaScript on Node 20. Build, type checks, lint, formatting and the Node 24 runtime smoke passed. The Node 14 smoke could not run locally because the available binary is x86_64 and this host is arm64; that CI check remains outstanding.
@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 6e7e355

@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 if across eight line continuations and preserves its source offsets. I trimmed the regression tests so they run without Bash on PATH. Looks good to merge.

@webpro
webpro merged commit 0901e01 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