Skip to content

fix(printer): preserve continued esac case patterns - #26

Merged
webpro merged 1 commit into
webpro-nl:mainfrom
everton-dgn:fix/preserve-continued-esac-pattern
Nov 7, 2026
Merged

webpro merged 1 commit into
webpro-nl:mainfrom
everton-dgn:fix/preserve-continued-esac-pattern

Conversation

@everton-dgn

Copy link
Copy Markdown
Contributor

Keep the opening parenthesis when the first case pattern becomes esac after removing line continuations. Preserve the original pattern text and cover parse/print stability.

Validated with 2,060 tests, lint, types and the local runtime smoke check. Node 14 compatibility remains for CI.

Keep the opening parenthesis when the first case pattern becomes esac after removing line continuations. Preserve the original pattern text and cover parse/print stability.

Validated with 2,060 tests, lint, types and the local runtime smoke check. Node 14 compatibility remains for CI.

@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! Confirmed: main prints case x in (es\<newline>ac) ... without the parenthesis, Bash then reads the continued esac as the keyword and rejects the printed script with a syntax error, while the original runs. Nobody writes a pattern like that, but the printer's output has to stay valid Bash, and the fix is a one-line normalization in the comparison that already keeps the parenthesis for a plain (esac). Quoted and escaped spellings ('esac', es\ac) are not the keyword and correctly keep printing without it. It merges cleanly with main and the full suite passes on the merged tree.

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