Changeset 3454
- Timestamp:
- Mar 18, 2005, 1:38:05 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm
r3453 r3454 1 1 # Copyright (c) 2005 Joshua Hoblitt 2 2 # 3 # $Id: Config.pm,v 1. 5 2005-03-18 22:12:45 jhoblitt Exp $3 # $Id: Config.pm,v 1.6 2005-03-18 23:38:05 jhoblitt Exp $ 4 4 5 5 package PS::IPP::Metadata::Config; … … 43 43 #print Dumper($tree); 44 44 45 # remove comment only lines46 $self->_strip_comments( $tree ) or return undef;47 48 45 # handle multi-symbol lines 49 46 $self->_merge_multi_symbols( $tree ) or return undef; … … 54 51 55 52 return $tree; 56 }57 58 sub _strip_comments {59 my ( $self, $tree ) = @_;60 61 # Iteratate through the parse tree and remove the hashes that have a62 # class key equal to "comment_line".63 for (my $i = 0; $i < @{$tree}; $i++) {64 my $elem = $tree->[$i];65 66 # recurse through nested metadata67 if ( $elem->{class} eq "metadata" ) {68 $self->_strip_comments( $elem->{value} );69 }70 71 # stop if the prevous pass removed the last element and called redo72 last unless defined $elem;73 74 if ( $elem->{class} =~ /comment_line|blank_line/ ) {75 # delete element from array76 splice @$tree, $i, 1;77 78 # the list just got shorter by one element so we don't want to79 # increment the cursor80 redo;81 }82 }83 84 return 1;85 53 } 86 54 … … 192 160 grammar: 193 161 statement(s) 194 { $item[1]}162 {[ grep $_->{class} !~ /(comment_line|blank_line)/, @{$item[1]} ]} 195 163 196 164 statement:
Note:
See TracChangeset
for help on using the changeset viewer.
