Skip to content

fix: parse ellipsis '...' as PPI::Token::Ellipsis (#41) - #432

Draft
toddr-bot wants to merge 2 commits into
masterfrom
koan.toddr.bot/fix-issue-41
Draft

fix: parse ellipsis '...' as PPI::Token::Ellipsis (#41)#432
toddr-bot wants to merge 2 commits into
masterfrom
koan.toddr.bot/fix-issue-41

Conversation

@toddr-bot

@toddr-bot toddr-bot commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

The Perl 5.12 ellipsis statement ... (yada yada) was being parsed as PPI::Token::Operator, but it is semantically a statement, not an operator. This PR introduces PPI::Token::Ellipsis as a new token type and wraps it in PPI::Statement::Break.

Fixes #41

Changes

  • New PPI::Token::Ellipsis — inherits from PPI::Token, represents the ... yada yada statement
  • Tokenizer (PPI::Token::Operator) — converts ... to Ellipsis class during token finalization (similar to how <> becomes QuoteLike::Readline)
  • Lexer — registers ... in %STATEMENT_CLASSESPPI::Statement::Break, matching the semantics of die/return/goto
  • Class registration — added to PPI::Token use list and PPI.pm class hierarchy docs
  • Tests updated — new t/ppi_token_ellipsis.t test file; existing tests in t/ppi_token_operator.t, t/signature_details.t, and t/data/08_regression/35_attr_perlsub.dump updated

Test plan

  • New test file t/ppi_token_ellipsis.t covers: token type, sub body, significance, Statement::Break wrapping, round-trip safety, coexistence with .. and . operators
  • Full test suite passes (70 files, 53155 tests)
  • .. (range) and . (concat) operators remain unaffected

Generated by Kōan /fix


Quality Report

Changes: 9 files changed, 172 insertions(+), 11 deletions(-)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

toddr-bot and others added 2 commits April 27, 2026 08:26
The Perl 5.12 ellipsis statement '...' (yada yada) currently parses as
PPI::Token::Operator. Add $TODO-marked tests that verify it should
become PPI::Token::Ellipsis and its containing statement should be
PPI::Statement::Break.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Perl 5.12 ellipsis statement '...' (yada yada) is a statement,
not an operator. Create PPI::Token::Ellipsis token type and make
the Lexer wrap it in PPI::Statement::Break (like die/return/goto).

- Add lib/PPI/Token/Ellipsis.pm inheriting from PPI::Token
- Convert '...' from Operator to Ellipsis during tokenizer finalization
- Register '...' in Lexer's %STATEMENT_CLASSES as Statement::Break
- Update class hierarchy docs in PPI.pm and Token.pm
- Update existing tests to expect new token/statement types
- Remove $TODO markers from ellipsis tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: ellipsis "..." statement parses as operator. What types would be better?

2 participants