Changeset 3358
- Timestamp:
- Mar 1, 2005, 1:45:21 PM (21 years ago)
- Location:
- trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata
- Files:
-
- 2 edited
-
Config.pm (modified) (11 diffs)
-
Config.pod (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm
r3354 r3358 1 1 # Copyright (c) 2005 Joshua Hoblitt 2 2 # 3 # $Id #3 # $Id: Config.pm,v 1.2 2005-03-01 23:45:21 jhoblitt Exp $ 4 4 5 5 package PS::IPP::Metadata::Config; … … 12 12 use Carp qw( carp ); 13 13 use Parse::RecDescent; 14 #use Data::Dumper;15 14 16 15 use base qw( Class::Accessor::Fast ); … … 44 43 $self->_strip_comments( $tree ) or return undef; 45 44 46 # handle multi- declarelines47 $self->_merge_multi_ declares( $tree ) or return undef;45 # handle multi-symbol lines 46 $self->_merge_multi_symbols( $tree ) or return undef; 48 47 49 48 # look for duplicate names, there should be none after processing the 50 # multi- declares49 # multi-symbols 51 50 $self->_merge_duplicates( $tree ) or return undef; 52 51 … … 57 56 my ( $self, $tree ) = @_; 58 57 59 # Iteratate through the AoH structure and remove the hashes that have a58 # Iteratate through the parse tree and remove the hashes that have a 60 59 # class key equal to "comment_line". 61 60 for (my $i = 0; $i < @{$tree}; $i++) { … … 75 74 } 76 75 77 sub _merge_multi_ declares {76 sub _merge_multi_symbols { 78 77 my ( $self, $tree ) = @_; 79 78 80 # list of valid multi- declares79 # list of valid multi-symbols 81 80 my %multis; 82 81 83 # Iteratate through the AoH structure looking for multi-declare84 # declarations. This is done in a single pass so multi- declares must82 # Iteratate through the parse tree looking for multi-symbol 83 # declarations. This is done in a single pass so multi-symbols must 85 84 # actually be 'declared' before any member elements appear. 86 85 for (my $i = 0; $i < @{$tree}; $i++) { 87 86 my $elem = $tree->[$i]; 88 87 89 if ( $elem->{class} eq "multi_ declare" ) {88 if ( $elem->{class} eq "multi_symbol" ) { 90 89 # construct a valid parse spec 91 90 my $node = { … … 96 95 }; 97 96 98 # add to list of valid multi- declares97 # add to list of valid multi-symbols 99 98 $multis{ $elem->{name} } = $node; 100 99 101 # delete mult-declare hash from the array and replace it with the 102 # valid spec 100 # delete multi-symbol hash from the parse tree and replace it 103 101 splice @$tree, $i, 1, $node; 104 102 … … 108 106 if ( my $node = $multis{ $elem->{name} } ) { 109 107 if ( ! $elem->{type} =~ /STR|STRING/ ) { 110 carp "multi- declareelement, ",108 carp "multi-symbol element, ", 111 109 $elem->{name}, 112 110 "has type of ", … … 116 114 } 117 115 118 # add element value to the appropriate multi- declareelement116 # add element value to the appropriate multi-symbol element 119 117 my $vec = $node->{value}; 120 118 push( @$vec, $elem->{value} ); … … 138 136 my %names; 139 137 138 # Iteratate through the parse tree looking for duplicate declarations and 139 # resolving them by discarding elements according to the value of 'overwrite'. 140 140 for (my $i = 0; $i < @{$tree}; $i++) { 141 141 my $elem = $tree->[$i]; … … 171 171 scalar 172 172 | vector 173 | multi_ declare173 | multi_symbol 174 174 | comment_line 175 175 … … 219 219 }} 220 220 221 multi_ declare:221 multi_symbol: 222 222 name '*' end_of_line 223 223 {{ 224 class => 'multi_ declare',224 class => 'multi_symbol', 225 225 name => $item{name}, 226 226 comment => $item{end_of_line}, -
trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pod
r3357 r3358 81 81 =head1 DEVELOPER NOTES 82 82 83 =head2 REFERENCES 83 Currently, "multiple symbols" are translated into "STR" vectors as the 84 appropriate behavior isn't clear in the psLib SDRS. 85 86 The parser does not have complete support for all of C99's floating point 87 constants or any support for complex numbers. 88 89 None of the "extended" config language syntax, as defined in the SDRS, is 90 supported. 91 92 =head1 REFERENCES 84 93 85 94 =over 4
Note:
See TracChangeset
for help on using the changeset viewer.
