Accept escaped literals in Unicode transliteration replacement lists

Open
#1,476 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
67/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
perl
Domain
compilers

Research direction

Start in the transliteration parsing and compilation code, focusing on bracket-delimited replacement operands and escaped metacharacters. Run the supplied Perl reproducer on both the JVM and interpreter backends, then run the Lingua::JA::Numbers test files under t/ to verify that escaped hyphen and asterisk literals compile and the upstream suite passes.

Written by the indexing model from the issue text.

Description

area:cpan-port area:parser area:unicode bug

Summary

PerlOnJava rejects valid transliteration syntax used by Lingua::JA::Numbers 0.05. The transliteration parser incorrectly interprets escaped replacement characters as an invalid +-* range.

Reproduction

The failure was found in CPAN random run 20260921-124328-13959, with regression baseline 0f5febaa8, while testing Lingua::JA::Numbers 0.05.

The smallest reproducer is:

my $x = '';
$x =~ tr[()+−×÷][\(\)\+\-\*\/];

The distribution contains the equivalent operation in Lingua::JA::Numbers::ja2num, converting full-width Japanese punctuation and arithmetic symbols to ASCII punctuation.

Under PerlOnJava, both the JVM backend and interpreter backend fail with:

Invalid range "+-*" in transliteration operator

Under standard Perl 5.42.2, the same reproducer succeeds.

CPAN evidence

The standard-Perl oracle passes the complete upstream suite:

All tests successful.
Files=6, Tests=289
Result: PASS

PerlOnJava fails all six test programs because the module cannot be compiled:

t/00-Use.t       failed during use
t/01-RoundTrip.t compilation failed
t/02-Manman.t    compilation failed
t/03-OO.t        compilation failed
t/04-LJN.t       compilation failed during import
t/05-KANJI.t     compilation failed
Files=6, Tests=4
Failed 6/6 test programs

The later to_string and import failures in t/04-LJN.t are cascading errors after the module failed to load; they are not separate defects.

Expected behavior

PerlOnJava should accept the transliteration operator with bracket delimiters and escaped replacement characters exactly as standard Perl does. The hyphen and asterisk in the replacement list are escaped literal characters, not a character range.

Suspected area

The defect is in transliteration parsing/compilation, specifically handling escaped metacharacters in the replacement operand when the operator uses bracket delimiters and Unicode source text. The parser should preserve \- and \* as literals instead of constructing an invalid +-* range.

Environment and scope

  • Distribution: Lingua::JA::Numbers 0.05
  • PerlOnJava backends: JVM and interpreter
  • Standard Perl oracle: Perl 5.42.2 on macOS
  • Native/XS code: none
  • Reverse-dependency analysis: not applicable; this is a pure-Perl distribution

This is a reproducible PerlOnJava parser defect, not a timeout, missing dependency, native-library problem, or platform prerequisite.

Dominant language
Perl
Stars
64
Forks
6
Avg merge
5h 18m
Merged PRs (30d)
162

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fglock/PerlOnJava

All issues in fglock/PerlOnJava

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.