Skip to content

fix(parser): numeric filehandle diamond \<N\> (Acme::Buffy, open 0)#734

Merged
fglock merged 1 commit into
masterfrom
fix/parser-numeric-filehandle-diamond
May 15, 2026
Merged

fix(parser): numeric filehandle diamond \<N\> (Acme::Buffy, open 0)#734
fglock merged 1 commit into
masterfrom
fix/parser-numeric-filehandle-diamond

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented May 15, 2026

Summary

  • Parse <digits> in the diamond / readline position as readline on the numeric typeglob (*0, *1, …), not as a quote-like string. The lexer emits NUMBER for 0, so <0> previously fell through to parseRawString and became the one-character string "0", which broke any open 0; ... <0> pattern (notably Acme::Buffy).

  • In parseBarewordHandle, treat all-digit glob names (e.g. main::0) as valid bareword handles so <0> matches Perl’s open 0 / $0 script-read idiom without requiring a prior existsGlobalIO entry.

Test plan

  • make (unit tests)
  • timeout 600 ./jcpan -t Acme::Buffy — passes (t/buffy.t)
  • Ad hoc: jperl -e 'open 0; print length join "", <0>' on a script file matches reading full source length

Made with Cursor

Perl lexes `<0>` as NUMBER not IDENTIFIER, so the diamond parser fell
through to quote-like parsing and produced the string "0". That broke
Acme::Buffy (and any `open 0; ... <0>` idiom): the script body was never
read.

Treat all-digit glob names (e.g. main::0) as bareword handles and handle
`<digits>` in parseDiamondOperator.

Generated with [Cursor](https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@fglock fglock merged commit ff858ec into master May 15, 2026
2 checks passed
@fglock fglock deleted the fix/parser-numeric-filehandle-diamond branch May 15, 2026 09:04
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