Skip to content

Fix vertical alignment after empty string literals - #423

Open
dajiaohuang wants to merge 1 commit into
darold:masterfrom
dajiaohuang:repostew/fix-empty-string-alignment-20261016
Open

dajiaohuang wants to merge 1 commit into
darold:masterfrom
dajiaohuang:repostew/fix-empty-string-alignment-20261016

Conversation

@dajiaohuang

Copy link
Copy Markdown

Problem

Fixes #412.

With --vertical-align, a supported CHECK (description <> '') expression prevents alignment of that table and subsequent tables. The tokenizer's single-quoted-string alternative requires at least one character, so the fallback token consumes '' together with following closing parentheses. The alignment pass then loses track of the table body's depth.

Change

Allow an empty single-quoted token using the existing string-token rule. Add a public Beautify API regression for the affected table and an independent following table, also checking preservation of the literal.

Validation

  • New regression: fails 2 of 3 assertions at master 57cd377321c8474a17ae59a139efa9c4019f21bd, passes all 3 with this change (Ubuntu 24.04, Perl 5.38.2).
  • Synthetic CLI CHECK example now aligns both tables and remains idempotent.
  • Bounded synthetic CLI checks for stdin/files/output/inplace, config precedence/discovery, case/indent/comments/functions and selected options; public Perl API and DESTDIR installation/installed CLI smoke test passed.
  • git diff --check passed.

Only synthetic SQL was formatted; no SQL was executed. Full upstream SQL regression corpus and Perl-version CI matrix were not run locally. CGI runtime was not tested because CGI.pm is absent in the local Perl environment.

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.

vertical-align may stop working with certain CHECK constraint expressions

1 participant