Skip to content

Commit

Permalink
fix Parser condition with &
Browse files Browse the repository at this point in the history
  • Loading branch information
fglock committed Oct 21, 2024
1 parent 4fe2048 commit ba8a322
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/perlonjava/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,10 @@ public boolean looksLikeEmptyList() {
} else if (INFIX_OP.contains(token.text) || token.text.equals(",")) {
// tokenIndex++;
ctx.logDebug("parseZeroOrMoreList infix `" + token.text + "` followed by `" + nextToken.text + "`");
if (token.text.equals("%") && (nextToken.text.equals("$") || nextToken.type == LexerTokenType.IDENTIFIER)) {
if (token.text.equals("&")) {
// looks like a subroutine call, not an infix `&`
ctx.logDebug("parseZeroOrMoreList looks like subroutine call");
} else if (token.text.equals("%") && (nextToken.text.equals("$") || nextToken.type == LexerTokenType.IDENTIFIER)) {
// looks like a hash deref, not an infix `%`
ctx.logDebug("parseZeroOrMoreList looks like Hash");
} else if (token.text.equals(".") && token1.type == LexerTokenType.NUMBER) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/perl/lib/Test/More.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package Test::More;
use strict;
use warnings;
use Exporter 'import';
use Symbol 'qualify_to_ref';

our @EXPORT = qw(
plan ok is isnt like unlike cmp_ok can_ok isa_ok
Expand All @@ -13,6 +14,16 @@ my $Test_Count = 0;
my $Plan_Count;
my $Failed_Count = 0;

# sub import {
# my $package = shift;
# my $caller = caller;
#
# for my $symbol (@EXPORT) {
# my $full_name = qualify_to_ref($symbol, $caller);
# *$full_name = \&{$symbol};
# }
# }

sub plan {
my ($directive, $arg) = @_;
if ($directive eq 'tests') {
Expand Down

0 comments on commit ba8a322

Please sign in to comment.