Parser rejects whitespace before legacy apostrophe separator in @_ variable

Aberta
#2,161 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
42/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
java, perl
Domínio
compilers

Direção de pesquisa

The failure is in the parser's handling of variable names with the legacy apostrophe separator, reached when whitespace follows the sigil in my @args = @ '_;. Start by reproducing the minimal sub f case on both the JVM and bytecode interpreter backends, then find where the tokenizer or variable-name parser consumes the apostrophe. Done means the snippet parses as @_, a regression test passes on both backends, and PDF::Tiny 0.09 loads.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

area:cpan-port area:parser bug

Summary

PerlOnJava rejects a valid legacy Perl spelling of the argument array when whitespace separates the array sigil from the apostrophe package separator:

my @args = @ '_;

System Perl accepts this and deparses it as my(@args) = @_;. PerlOnJava reports a syntax error at the apostrophe on both the JVM and bytecode interpreter backends.

Reproduction

use strict;
use warnings;
sub f {
    my @args = @ '_;
    return scalar @args;
}
print f(1, 2), "\n";

Results:

  • System Perl 5.34.1: perl -c succeeds; perl -MO=Deparse normalizes the expression to @_.
  • PerlOnJava JVM backend: compile fails at line 4 with syntax error ... near "'_;".
  • PerlOnJava bytecode interpreter: same compile error.

CPAN evidence

PDF::Tiny 0.09 uses the same expression in PDF::Tiny::_flatten_pages:

my ($self, $pages_id, $pages, $pages_array) = @ '_;

In CPAN random run 20261120-195805-13340, PerlOnJava failed to load the module at this line, so t/pdf-tiny.t ran zero subtests. The system Perl oracle for that run passed the complete upstream suite: 1 test file and 26 tests. The module is pure Perl and has no native/XS prerequisite.

Likely area

The parser supports legacy apostrophe package separators while parsing variable names, but appears to reject or mis-tokenize this form when whitespace follows the sigil. The reproducer shows that the whitespace and separator are accepted by standard Perl and that the expression means @_.

Acceptance criteria

  • Parse @ '_ as @_, preserving standard Perl behavior.
  • Add a project-owned regression for the minimal case and validate it with standard Perl first.
  • Pass the regression on both JVM and bytecode interpreter backends.
  • Confirm PDF::Tiny 0.09 loads and its test suite passes under PerlOnJava.
Linguagem predominante
Perl
Estrelas
67
Forks
8
Merge médio
4h 36min
PRs com merge (30d)
123

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de fglock/PerlOnJava

Todas as issues de fglock/PerlOnJava

Issues semelhantes

Mais issues de Perl

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.