Thanks!

Example, now looks like this:

#!/usr/bin/perl
use strict;
use warnings;
use Marpa::R2;
use Data::Dumper;

my $dsl = <<'END_OF_DSL';
:default ::= action => [name,values]
lexeme default = latm => 1

seq ::= digit seq
action => peep
| digit
action => peep

digit ~ [01]
END_OF_DSL

sub MyActions::peep {
my $rule_id = $Marpa::R2::Context::rule;
my $slg = $Marpa::R2::Context::slg;
my ($lhs, @rhs) = map { $slg->symbol_display_form($_) } 
$slg->rule_expand($rule_id);
$_[0] = $lhs;

print "peep:\n--->\n";
print Dumper(\@_);
print "<---\n";
return \@_;
}

my $grammar = Marpa::R2::Scanless::G->new({ source => \$dsl });
my $input = '01';
my $value_ref = $grammar->parse(\$input, 'MyActions');
print Dumper($value_ref);

Result with "peep" is:

peep:
--->
$VAR1 = [
          'seq',
          '1'
        ];
<---
peep:
--->
$VAR1 = [
          'seq',
          '0',
          [
            ${\$VAR1->[0]},
            '1'
          ]
        ];
<---
$VAR1 = \[
            'seq',
            '0',
            [
              ${\${$VAR1}->[0]},
              '1'
            ]
          ];

Without peep:

$VAR1 = \[
            'seq',
            '0',
            [
              ${\${$VAR1}->[0]},
              '1'
            ]
          ];

That's what I want.

-- 
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/d/optout.

Reply via email to