Skip to content

Conversation

@iabyn
Copy link
Contributor

@iabyn iabyn commented Nov 4, 2025

Some of the names of parser (perly.y) tokens have a common prefix, such as

PERLY_SEMICOLON
PERLY_AMPERSAND
KW_PACKAGE
KW_CLASS

Perl's -Dpv switch produces debugging output that also displays the top few items on the parse stack. The token names are truncated for compactness' sake. This currently leads to a display where its mostly just the token name's prefix that is displayed, e.g.

$ perl -Dpv -e'package Foo'

...

index: 1 2 3 4 5 6 7 8
state: 1 9 17 149 91 263 412 503
token: GRAMPROG @1 remember stmtseq KW_PACKA BAREWORD BAREWORD PERLY_SE
value: 0 0 63 (Nullop) 0 (Nullop) const 735909768

After this commit, PERLY_, KW_ etc prefixes are stripped, allowing more of the actual token name is displayed:

index: 1 2 3 4 5 6 7 8
state: 1 9 17 149 91 263 412 503
token: GRAMPROG @1 remember stmtseq PACKAGE BAREWORD BAREWORD SEMICOLO
value: 0 0 63 (Nullop) 0 (Nullop) const 227539304

  • This set of changes does not require a perldelta entry.

Some of the names of parser (perly.y) tokens have a common prefix, such
as

    PERLY_SEMICOLON
    PERLY_AMPERSAND
    KW_PACKAGE
    KW_CLASS

Perl's -Dpv switch produces debugging output that also displays the top
few items on the parse stack. The token names are truncated for
compactness' sake. This currently leads to a display where its mostly
just the token name's prefix that is displayed, e.g.

$ perl -Dpv -e'package Foo'

...

index:        1        2        3        4        5        6        7        8
state:        1        9       17      149       91      263      412      503
token: GRAMPROG       @1 remember  stmtseq KW_PACKA BAREWORD BAREWORD PERLY_SE
value:        0        0       63 (Nullop)        0 (Nullop)    const 735909768

After this commit, PERLY_, KW_ etc prefixes are stripped, allowing more
of the actual token name is displayed:

index:        1        2        3        4        5        6        7        8
state:        1        9       17      149       91      263      412      503
token: GRAMPROG       @1 remember  stmtseq  PACKAGE BAREWORD BAREWORD SEMICOLO
value:        0        0       63 (Nullop)        0 (Nullop)    const 227539304
@iabyn iabyn merged commit f49cfe1 into blead Nov 6, 2025
68 checks passed
@iabyn iabyn deleted the davem/Dp branch November 6, 2025 11:25
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.

3 participants