I can not seem to make head or tails of this Raku error message I found while exploring grammars...
Cannot resolve caller report(Array:D); none of these signatures matches:
(Array @r)
(Match $r)
So an Array is not an Array?! How does that work and how do I find out why? Here is the full program and output.
#!/usr/bin/env perl6
use v6;
grammar Integers {
rule TOP { ^ .*? <targets> .* $ }
rule targets { <integer>+ % ',' }
token integer { \d+ }
}
multi sub report(Array @r) { say @r.raku }
multi sub report(Match $r) { say $r.raku }
sub MAIN() {
my $result = Integers.parse(' a 1234 ');
report($result);
report(%$result{'targets'});
report(%$result{'targets'}{'integer'});
}
#`( output:
Match.new(:orig(" a 1234 "), :from(0), :pos(8), :hash(Map.new((:targets(Match.new(:orig(" a 1234 "), :from(3), :pos(8), :hash(Map.new((:integer([Match.new(:orig(" a 1234 "), :from(3), :pos(7))]))))))))))
Match.new(:orig(" a 1234 "), :from(3), :pos(8), :hash(Map.new((:integer([Match.new(:orig(" a 1234 "), :from(3), :pos(7))])))))
Cannot resolve caller report(Array:D); none of these signatures matches:
(Array @r)
(Match $r)
in sub MAIN at /home/hans/Programming/Raku/Parsing/Array_Array.raku line 16
in block <unit> at /home/hans/Programming/Raku/Parsing/Array_Array.raku line 3
)
(Array @r)
could be described as array of arrays r, or as array ofPositional
s r? As for why I am re-implementing dd, that's how I am learning the syntax for accessing Match object properties. – Chartography