#!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

