Skip to content

Commit 30ce422

Browse files
fix: resolve regressions in op/anonsub.t, comp/parser_run.t, re/pat_advanced.t
- B.pm: wrap require Sub::Util in eval in _introspect() so that Sub::Util loading failures (due to @inc reordering) fall back to __ANON__ defaults instead of dying (fixes op/anonsub.t test 9) - IdentifierParser: format non-ASCII bytes as \xNN (uppercase, no braces) inside ${...} contexts to match Perl diagnostic format (fixes comp/parser_run.t test 66) - re/pat_advanced.t: no longer crashes - the unicodeSetToJavaPattern() fix from previous commit properly handles supplementary characters Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 1f364d1 commit 30ce422

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/main/java/org/perlonjava/core/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public final class Configuration {
3333
* Automatically populated by Gradle/Maven during build.
3434
* DO NOT EDIT MANUALLY - this value is replaced at build time.
3535
*/
36-
public static final String gitCommitId = "412bbcd58";
36+
public static final String gitCommitId = "1f364d13f";
3737

3838
/**
3939
* Git commit date of the build (ISO format: YYYY-MM-DD).

src/main/java/org/perlonjava/frontend/parser/IdentifierParser.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,12 @@ public static String parseComplexIdentifierInner(Parser parser, boolean insideBr
286286
hex = "\\x{" + Integer.toHexString(cp) + "}";
287287
}
288288
} else if (cp <= 255) {
289-
// Perl tends to report non-ASCII bytes as \x{..} in these contexts
290-
hex = "\\x{" + Integer.toHexString(cp) + "}";
289+
if (insideBraces) {
290+
// Inside ${...}, Perl formats non-ASCII bytes as \xNN (uppercase, no braces)
291+
hex = String.format("\\x%02X", cp);
292+
} else {
293+
hex = "\\x{" + Integer.toHexString(cp) + "}";
294+
}
291295
} else {
292296
hex = "\\x{" + Integer.toHexString(cp) + "}";
293297
}

src/main/perl/lib/B.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ package B::CV {
127127
$self->{_pkg_name} = 'main';
128128
$self->{_is_anon} = 1;
129129
if ($self->{ref} && ref($self->{ref}) eq 'CODE') {
130-
require Sub::Util;
130+
eval { require Sub::Util };
131+
return if $@; # Sub::Util not available, use defaults
131132
my $fqn = Sub::Util::subname($self->{ref});
132133
if (defined $fqn && $fqn ne '__ANON__') {
133134
# Split "Package::Name::subname" into package and name

0 commit comments

Comments
 (0)