Permalink
Browse files

Changing null value logic: t+

  • Loading branch information...
1 parent 638cd36 commit 11d22a53af202795dd5634152e636848fd61f5fa Jeffrey Kegler committed May 22, 2012
Showing with 17 additions and 20 deletions.
  1. +17 −20 r2/pperl/Marpa/R2/Perl.pm
View
@@ -893,26 +893,23 @@ sub Marpa::R2::Perl::new {
} ## end for my $symbol ( $lhs, @rhs )
$symbol{$lhs}++;
- # only create action for non-empty rules
my @additional_args = ();
- if ( scalar @rhs ) {
- if ( $closure_type eq 'CODE' ) {
- $rule_name ||= q{!} . scalar @rules;
- my ($action) = $gen_closure->( $lhs, \@rhs, $rule_name );
- if ( defined $action ) {
- $closure{"!$rule_name"} = $action;
- push @additional_args, action => "!$rule_name";
- }
- } ## end if ( $closure_type eq 'CODE' )
- if ( $closure_type eq 'HASH' ) {
- my $action_name = $rule_name // $lhs;
- my $action = $gen_closure->{$action_name};
- if ( defined $action ) {
- $closure{"!$action_name"} = $action;
- push @additional_args, action => "!$action_name";
- }
- } ## end if ( $closure_type eq 'HASH' )
- } ## end if ( scalar @rhs )
+ if ( $closure_type eq 'CODE' ) {
+ $rule_name ||= q{!} . scalar @rules;
+ my ($action) = $gen_closure->( $lhs, \@rhs, $rule_name );
+ if ( defined $action ) {
+ $closure{"!$rule_name"} = $action;
+ push @additional_args, action => "!$rule_name";
+ }
+ } ## end if ( $closure_type eq 'CODE' )
+ if ( $closure_type eq 'HASH' ) {
+ my $action_name = $rule_name // $lhs;
+ my $action = $gen_closure->{$action_name};
+ if ( defined $action ) {
+ $closure{"!$action_name"} = $action;
+ push @additional_args, action => "!$action_name";
+ }
+ } ## end if ( $closure_type eq 'HASH' )
my $rank = defined $rule_name ? $rule_rank{$rule_name} : undef;
if ( defined $rank ) {
push @additional_args, rank => $rank;
@@ -923,13 +920,13 @@ sub Marpa::R2::Perl::new {
rhs => \@rhs,
@additional_args, name => $rule_name
};
+
} ## end for my $line ( split /\n/xms, $reference_grammar )
my $grammar = Marpa::R2::Grammar->new(
{ start => 'prog',
rules => \@rules,
symbols => { listexpr => { null_value => undef } },
- default_empty_action => '::undef',
}
);

0 comments on commit 11d22a5

Please sign in to comment.