/[libconf]/libconf/perl-Libconf/Libconf.pm
ViewVC logotype

Diff of /libconf/perl-Libconf/Libconf.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by dams, Mon Apr 21 11:52:07 2003 UTC revision 1.17 by dams, Mon Apr 21 16:37:56 2003 UTC
# Line 190  sub appendAtom { Line 190  sub appendAtom {
190  }  }
191    
192  sub insertAtom {  sub insertAtom {
193      my ($out, $index, $ref_args) = @_;        my ($out, $index, $ref_args) = @_;
194        $index >= @{$out->{atoms}} and return appendAtom($out, $ref_args);
195      my %args = %$ref_args;      my %args = %$ref_args;
196      splice(@{$out->{atoms}}, $index, 0, {});      splice(@{$out->{atoms}}, $index, 0, {});
197      $args{sections} ||= @{$out->{atoms}}[$index-1]->{sections};      $args{sections} ||= @{$out->{atoms}}[$index-1]->{sections};
198        $args{sections} ||= [];
199      eval($templates{$out->{template_name}}{edit_atom});      eval($templates{$out->{template_name}}{edit_atom});
200  #    validate($out, @{$out->{atoms}}[$index]);  #    validate($out, @{$out->{atoms}}[$index]);
201  }  }
# Line 250  sub parse { Line 252  sub parse {
252      my ($out, $file) = @_;      my ($out, $file) = @_;
253      my @file = @$file;      my @file = @$file;
254      my $item = 0;      my $item = 0;
255      my $next_item = 0;  #    my $next_item = 0;
256      my $matched;      my $matched;
257      my $template_name = $out->{template_name};      my $template_name = $out->{template_name};
258      my @out_atoms;      my @out_atoms;
# Line 307  sub parse { Line 309  sub parse {
309              my $atom = $out_atoms[$item];              my $atom = $out_atoms[$item];
310              eval ( $_ );              eval ( $_ );
311              $@ and die qq(error while applying the rule '$_' to '$in' : $@);              $@ and die qq(error while applying the rule '$_' to '$in' : $@);
312              $next_item = $matched && !$keep_atom;  #            $next_item = $matched && !$keep_atom;
313              $matched and last;              $matched and last;
314          }          }
315  #       validate($out, $out_atoms[$item]);  #       validate($out, $out_atoms[$item]);
316          $in !~ /^\s*$/ and push @{$out_atoms[$item]->{invalid}}, $in;          $in !~ /^\s*$/ and push @{$out_atoms[$item]->{invalid}}, $in;
317          if ($next_item) {          $keep_atom or $item++;
318              $item++;  #       if (!$keep_atom) {
319              $next_item = 0;  #           $item++;
320          }  #           $next_item = 0;
321    #       }
322      }      }
323      $out->{atoms} = [@out_atoms];      $out->{atoms} = [@out_atoms];
324  }  }

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26