$type = 'v';
report_v_string($tok);
}
- else { $type = 'w' }
+ else {
+
+ # Bareword followed by a fat comma ... see 'git18.in'
+ # If tok is something like 'x17' then it could
+ # actually be operator x followed by number 17.
+ # For example, here:
+ # 123x17 => [ 792, 1224 ],
+ # (a key of 123 repeated 17 times, perhaps not
+ # what was intended). We will mark x17 as type
+ # 'n' and it will be split. If the previous token
+ # was also a bareword then it is not very clear is
+ # going on. In this case we will not be sure that
+ # an operator is expected, so we just mark it as a
+ # bareword. Perl is a little murky in what it does
+ # with stuff like this, and its behavior can change
+ # over time. Something like
+ # a x18 => [792, 1224], will compile as
+ # a key with 18 a's. But something like
+ # push @array, a x18;
+ # is a syntax error.
+ if ( $expecting == OPERATOR && $tok =~ /^x\d+$/ ) {
+ $type = 'n';
+ }
+ else {
+
+ # git #18
+ $type = 'w';
+ error_if_expecting_OPERATOR();
+ }
+ }
next;
}
--- /dev/null
+# parsing stuff like 'x17' before fat comma
+my %bb = (
+ 123 x 18 => '123x18',
+ 123 x 19 => '123 x19',
+ 123 x 20 => '123x 20',
+ 2 x 7 => '2 x 7',
+ x40 => 'x40',
+ 'd' x 17 => "'d' x17",
+ c x17 => 'c x17',
+);
+foreach my $key ( keys %bb ) {
+ print "key='$key' => $bb{$key}\n";
+}
--- /dev/null
+# parsing stuff like 'x17' before fat comma
+my %bb = (
+ 123x18 => '123x18',
+ 123 x19 => '123 x19',
+ 123x 20 => '123x 20',
+ 2 x 7 => '2 x 7',
+ x40 => 'x40',
+ 'd' x17 => "'d' x17",
+ c x17 => 'c x17',
+);
+foreach my $key ( keys %bb ) {
+ print "key='$key' => $bb{$key}\n";
+}
../snippets16.t ndsm1.def
../snippets16.t ndsm1.ndsm
../snippets16.t rt131288.def
+../snippets16.t rt130394.rt130394
../snippets2.t angle.def
../snippets2.t arrows1.def
../snippets2.t arrows2.def
../snippets9.t rt98902.def
../snippets9.t rt98902.rt98902
../snippets9.t rt99961.def
-../snippets16.t rt130394.rt130394
+../snippets16.t git18.def
#15 ndsm1.ndsm
#16 rt131288.def
#17 rt130394.rt130394
+#18 git18.def
# To locate test #13 you can search for its name or the string '#13'
# git#16, two equality lines with fat commas on the right
my $Package = $Self->RepositoryGet( %Param, Result => 'SCALAR' );
my %Structure = $Self->PackageParse( String => $Package );
+----------
+
+ 'git18' => <<'----------',
+# parsing stuff like 'x17' before fat comma
+my %bb = (
+ 123x18 => '123x18',
+ 123 x19 => '123 x19',
+ 123x 20 => '123x 20',
+ 2 x 7 => '2 x 7',
+ x40 => 'x40',
+ 'd' x17 => "'d' x17",
+ c x17 => 'c x17',
+);
+foreach my $key ( keys %bb ) {
+ print "key='$key' => $bb{$key}\n";
+}
----------
'multiple_equals' => <<'----------',
$factorial = sub { reduce { $a * $b } 1 .. 11 };
#17...........
},
+
+ 'git18.def' => {
+ source => "git18",
+ params => "def",
+ expect => <<'#18...........',
+# parsing stuff like 'x17' before fat comma
+my %bb = (
+ 123 x 18 => '123x18',
+ 123 x 19 => '123 x19',
+ 123 x 20 => '123x 20',
+ 2 x 7 => '2 x 7',
+ x40 => 'x40',
+ 'd' x 17 => "'d' x17",
+ c x17 => 'c x17',
+);
+foreach my $key ( keys %bb ) {
+ print "key='$key' => $bb{$key}\n";
+}
+#18...........
+ },
};
my $ntests = 0 + keys %{$rtests};