NQP question to add a null value node
Gerd Pokorra
gp at zimt.uni-siegen.de
Sat Mar 5 02:22:08 UTC 2011
I added a subroutine to get the null PMC in a variable.
sub got_null() {
my $result := Q:PIR{
null $P0
%r = $P0
};
return $result;
}
.
.
.
method value:sym<null>($/) {
my $val := got_null();
_dumper($val, 'JSON');
make PAST::Val.new( :value($val), :node($/) );
}
The dumper output shows that the value is correct and is that what I
want.
[gz016 at vgerd1 example]$ parrot json.pir
> null
"JSON" => null
PAST::Val node missing :value attribute
>
But a value node in the AST with a null PMC is not accepted.
So the solution must be an opcode node I think. But I did not up to now
get it working this way.
The complete NQP test program is at:
ftp://ftp.uni-siegen.de/pub/json.nqp
I tried it with an installed Parrot 3.0.0.
-- Gerd
Am Freitag, den 04.03.2011, 13:11 +0100 schrieb Gerd Pokorra:
> How can I add a node with the value null with NQP?
>
>
> method value:sym<null>($/) {
>
> # ????
>
> }
>
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
More information about the parrot-dev
mailing list