Jeffrey,
Is semantics_package's new() method supposed to be called if it exist ?
C.f. file attached.
Thanks / JD.
--
You received this message because you are subscribed to the Google Groups
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
#!env perl
use strict;
use warnings FATAL => 'all';
package MyActions;
sub new {
print STDERR "==> In " . __PACKAGE__ . "::new()\n";
bless({}, shift);
}
sub x {
print STDERR "==> In " . __PACKAGE__ . ":x()\n";
'X'
}
package main;
use Marpa::R2;
use Data::Dumper;
print STDERR "==> \$Marpa::R2::VERSION=$Marpa::R2::VERSION\n";
my $grammar = do {local $/; <DATA>};
my $input = 'x';
my %hash = (
grammar => Marpa::R2::Scanless::G->new( { source => \$grammar }),
semantics_package => 'MyActions',
trace_terminals => 1,
trace_values => 1,
);
my $re = Marpa::R2::Scanless::R->new(\%hash);
$re->read(\$input);
print STDERR "==> VALUE\n" . Dumper($re->value());
__DATA__
:default ::= action => [values]
:start ::= test
test ::= 'x' action => x