Skip to content

fix(format): execute write argument lines as Perl expressions - #1368

Open
fglock wants to merge 33 commits into
masterfrom
fix/write-t
Open

fix(format): execute write argument lines as Perl expressions#1368
fglock wants to merge 33 commits into
masterfrom
fix/write-t

Conversation

@fglock

@fglock fglock commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Execute write format argument lines as complete Perl expressions in list context.
  • Preserve expression side effects and avoid placeholder values for unsupported AST nodes.
  • Add system-Perl-validated JVM/interpreter regression coverage and update the core-suite tracking document.

Verification

  • perl src/test/resources/unit/format_argument_line_execution.t
  • ./jperl src/test/resources/unit/format_argument_line_execution.t
  • ./jperl --interpreter src/test/resources/unit/format_argument_line_execution.t
  • make
  • make check-links
  • timeout 600 ../../jperl op/write.t from perl5_t/t (273 remaining explicit Not OK records; unchanged because its remaining failures are distinct field-rendering/lifecycle clusters)

fglock and others added 30 commits September 13, 2026 22:10
Evaluate each format argument line in list context when write reaches its
picture, retaining operator evaluation and expression side effects.

Add a system-Perl-validated regression test and update the core-suite design
tracking with the remaining write.t boundary.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Treat @ and ^ as part of the physical format field width and advance through
the template by that complete span. This restores @<< output width and fixes
ten op/write.t assertions.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Recognize 0 numeric picture glyphs and preserve their full physical picture
width when formatting values.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Recognize a bare @ format picture as a one-character text field.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Do not package-qualify an empty active format name before reporting it.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Match Perl formline behavior by consuming one terminal record separator from
an @* value before following literal picture text. Add focused coverage and
record the resulting op/write.t reduction.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Recognize decimal formline pictures, preserve a trailing literal picture dot,
and use number signs for numeric overflow. Cover the Perl-compatible behavior
with a focused formline regression.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Separate the caller-provided format name from its qualified lookup key so
undefined-format errors match Perl for bare and NUL-prefixed names.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Emit the record separator after a declared format's final picture line while
keeping formline accumulation separator-free.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Honor explicitly localized top-format names during write and report missing
top formats with their caller-facing names.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Retain scalar slots across ^ picture lines and ~~ repeats so write consumes
text continuation operands while preserving significant numeric caret padding.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Render signs, zero padding, and decimal pictures within their complete Perl
format field widths.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Carry visible lexical scalar cells through format registration so write uses
the declaration scope rather than empty package globals.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Preserve a hyphen on the current continuation picture line and consume the
following text on the next repeated record.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Do not backtrack to an earlier blank when a continuation field ends directly
before a whitespace boundary.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Treat ellipses following a continuation picture as conditional truncation
markers and keep ordinary text pictures to one physical record.

Add focused coverage for ellipsis consumption, trailing whitespace, and
terminal input newlines.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Wrap braced multiline format arguments in a do block before runtime eval so
they retain format-block list semantics instead of becoming hash constructors.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Bind declaration-scope scalar, array, and hash cells when registering formats
on both execution backends, including interpolated aggregate elements.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Treat a numeric-looking picture interrupted by whitespace as a lone sigil
field followed by literal text, matching Perl format semantics.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Expose repeat-picture write failures in $@ while returning undef from eval
without a deferred interpreter exception. Add a focused dual-backend regression.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Treat a terminal decimal point as part of a numeric picture so overflow spans
the complete Perl field width on both format backends.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Let a repeated format line consume each hash pair until its iterator is empty,
with regression coverage for both execution backends.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Parse asterisk format fields without consuming following literal picture
characters, and render reference values atomically in fill-mode fields.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Render format control markers as picture-position whitespace so formline
matches Perl for mixed continuation and repeat pictures.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Stop format rendering and return false from write when its argument line
executes a bare return, matching Perl control-flow behavior.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Honor a temporary formline picture's final newline while preserving
newline-free picture behavior.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Recognize bare temporary format fields before a tilde control and suppress
their empty picture output and record separator.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Use the fetched tied scalar for formline picture text and taint provenance,
avoiding a second stateful FETCH or overloaded stringification.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Advance the temporary format argument cursor after each picture line so a
multiline formline consumes the operands intended for each line.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Render final literal lines in named formats with their record separator and
discard eval-format declaration whitespace before the first picture.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
fglock and others added 3 commits September 14, 2026 18:16
Emit Perl's redefine-category warning before a defined format is replaced on
the JVM and bytecode backends.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Treat a braced qword list as an anonymous hash when it is used for a direct
hash dereference.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
Treat a trailing picture comment as outside a braced format argument block so
the argument retains code-block semantics.

Generated with [Codex](https://openai.com/codex/)

Co-Authored-By: Codex <codex@openai.com>
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.

1 participant