IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 1, 2005, 1:45:21 PM (21 years ago)
Author:
jhoblitt
Message:

code tidying
misc comment/doc cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Metadata-Config/lib/PS/IPP/Metadata/Config.pm

    r3354 r3358  
    11# Copyright (c) 2005  Joshua Hoblitt
    22#
    3 # $Id#
     3# $Id: Config.pm,v 1.2 2005-03-01 23:45:21 jhoblitt Exp $
    44
    55package PS::IPP::Metadata::Config;
     
    1212use Carp qw( carp );
    1313use Parse::RecDescent;
    14 #use Data::Dumper;
    1514
    1615use base qw( Class::Accessor::Fast );
     
    4443    $self->_strip_comments( $tree ) or return undef;
    4544
    46     # handle multi-declare lines
    47     $self->_merge_multi_declares( $tree ) or return undef;
     45    # handle multi-symbol lines
     46    $self->_merge_multi_symbols( $tree ) or return undef;
    4847
    4948    # look for duplicate names, there should be none after processing the
    50     # multi-declares
     49    # multi-symbols
    5150    $self->_merge_duplicates( $tree ) or return undef;
    5251
     
    5756    my ( $self, $tree ) = @_;
    5857
    59     # Iteratate through the AoH structure and remove the hashes that have a
     58    # Iteratate through the parse tree and remove the hashes that have a
    6059    # class key equal to "comment_line".
    6160    for (my $i = 0; $i < @{$tree}; $i++) {
     
    7574}
    7675
    77 sub _merge_multi_declares {
     76sub _merge_multi_symbols {
    7877    my ( $self, $tree ) = @_;
    7978
    80     # list of valid multi-declares
     79    # list of valid multi-symbols
    8180    my %multis;
    8281
    83     # Iteratate through the AoH structure looking for multi-declare
    84     # declarations.  This is done in a single pass so multi-declares must
     82    # Iteratate through the parse tree looking for multi-symbol
     83    # declarations.  This is done in a single pass so multi-symbols must
    8584    # actually be 'declared' before any member elements appear. 
    8685    for (my $i = 0; $i < @{$tree}; $i++) {
    8786        my $elem = $tree->[$i];
    8887
    89         if ( $elem->{class} eq "multi_declare" ) {
     88        if ( $elem->{class} eq "multi_symbol" ) {
    9089            # construct a valid parse spec
    9190            my $node = {
     
    9695            };
    9796
    98             # add to list of valid multi-declares
     97            # add to list of valid multi-symbols
    9998            $multis{ $elem->{name} } = $node;
    10099
    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
    103101            splice @$tree, $i, 1, $node;
    104102
     
    108106        if ( my $node = $multis{ $elem->{name} } ) {
    109107            if ( ! $elem->{type} =~ /STR|STRING/ ) {
    110                 carp "multi-declare element, ",
     108                carp "multi-symbol element, ",
    111109                     $elem->{name},
    112110                     "has type of ",
     
    116114            }
    117115
    118             # add element value to the appropriate multi-declare element
     116            # add element value to the appropriate multi-symbol element
    119117            my $vec = $node->{value};
    120118            push( @$vec, $elem->{value} );
     
    138136    my %names;
    139137
     138    # Iteratate through the parse tree looking for duplicate declarations and
     139    # resolving them by discarding elements according to the value of 'overwrite'.
    140140    for (my $i = 0; $i < @{$tree}; $i++) {
    141141        my $elem = $tree->[$i];
     
    171171    scalar
    172172    | vector
    173     | multi_declare
     173    | multi_symbol
    174174    | comment_line
    175175
     
    219219         }}
    220220
    221 multi_declare:
     221multi_symbol:
    222222    name '*' end_of_line
    223223        {{
    224             class   => 'multi_declare',
     224            class   => 'multi_symbol',
    225225            name    => $item{name},
    226226            comment => $item{end_of_line},
Note: See TracChangeset for help on using the changeset viewer.