258 |
my @out_atoms; |
my @out_atoms; |
259 |
my $keep_atom; |
my $keep_atom; |
260 |
$out->{current_sections} ||= []; |
$out->{current_sections} ||= []; |
261 |
|
my $line_idx = 1; |
262 |
foreach my $in (@file) { |
foreach my $in (@file) { |
263 |
$out_atoms[$item] ||= {}; |
$out_atoms[$item] ||= {}; |
264 |
$in eq "\n" and $out_atoms[$item]->{comments} .= " \n", next; |
$in eq "\n" and $out_atoms[$item]->{comments} .= " \n", next; |
314 |
$matched and last; |
$matched and last; |
315 |
} |
} |
316 |
# validate($out, $out_atoms[$item]); |
# validate($out, $out_atoms[$item]); |
317 |
$in !~ /^\s*$/ and push @{$out_atoms[$item]->{invalid}}, $in and print "Libconf.pm warning: can't parse line :\n$in\n"; |
if ($in !~ /^\s*$/){ |
318 |
|
push @{$out_atoms[$item]->{invalid}}, $in; |
319 |
|
print "\nLibconf.pm warning: can't parse line n°" . $line_idx . " :\n$in\n"; |
320 |
|
} |
321 |
$keep_atom or $item++; |
$keep_atom or $item++; |
322 |
# if (!$keep_atom) { |
# if (!$keep_atom) { |
323 |
# $item++; |
# $item++; |
324 |
# $next_item = 0; |
# $next_item = 0; |
325 |
# } |
# } |
326 |
|
} continue { |
327 |
|
$line_idx++; |
328 |
} |
} |
329 |
$out->{atoms} = [@out_atoms]; |
$out->{atoms} = [@out_atoms]; |
330 |
} |
} |