fix: parse ellipsis '...' as PPI::Token::Ellipsis (#41) - #432
Draft
toddr-bot wants to merge 2 commits into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Perl 5.12 ellipsis statement
...(yada yada) was being parsed asPPI::Token::Operator, but it is semantically a statement, not an operator. This PR introducesPPI::Token::Ellipsisas a new token type and wraps it inPPI::Statement::Break.Fixes #41
Changes
PPI::Token::Ellipsis— inherits fromPPI::Token, represents the...yada yada statementPPI::Token::Operator) — converts...toEllipsisclass during token finalization (similar to how<>becomesQuoteLike::Readline)...in%STATEMENT_CLASSES→PPI::Statement::Break, matching the semantics ofdie/return/gotoPPI::Tokenuse list andPPI.pmclass hierarchy docst/ppi_token_ellipsis.ttest file; existing tests int/ppi_token_operator.t,t/signature_details.t, andt/data/08_regression/35_attr_perlsub.dumpupdatedTest plan
t/ppi_token_ellipsis.tcovers: token type, sub body, significance, Statement::Break wrapping, round-trip safety, coexistence with..and.operators..(range) and.(concat) operators remain unaffectedGenerated 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