Skip to content

Commit

Permalink
* Discover core tags from Interpolate.pm, so they show up in list of
Browse files Browse the repository at this point in the history
  tags and can have docs and everything.
  Few rough edges will be polished, but it works already.
  • Loading branch information
docelic committed Nov 13, 2007
1 parent b05604f commit cdc1be8
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
3 changes: 3 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Bugs:
- u CVS listi, da je fajl nejm link na CVS
- documentation for bounce and restrict is ignored
- some small error in glossary/pragma at the bottom, [tag pragma]0[/tag]
- see if the files we parse in bin/stattree in block (like parseVendConfig, parseVendInterpolate) allow some stuff to go unaccounted for mkreport
- with tags from Interpolate.pm, context for systemtag is not always 'whole file', but can be x-y as well


- order counter, Session->{mv_order_number}, cronjob -0001, or file da-te.counter, or session_id.time
- in iccattut, s/item-field/item-param/ at least on some places.
Expand Down
68 changes: 68 additions & 0 deletions bin/stattree
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,12 @@ sub wanted {
if ( $c{file} eq 'lib/Vend/Config.pm' ) {
file_parseVendConfig(\%c, \@filedata);
}

####################################################################
# lib/Vend/Interpolate.pm
if ( $c{file} eq 'lib/Vend/Interpolate.pm' ) {
file_parseVendInterpolate(\%c, \@filedata);
}
}

# Format the context lines before saving to the db.
Expand Down Expand Up @@ -1087,8 +1093,70 @@ sub file_parseVendConfig {
}
}

# Parse Interpolate.pm and take out some great stuff ;-)
sub file_parseVendInterpolate {
my %c = %{ (shift) };
my $content = shift; # Complete lib/Vend/Interpolate.pm file

my $linenr = -1; # Increases as we parse file (search "MINUS" above)
my $startline; # Remember first line nr. of context, not last
my $context = "systemtag";
my @tags; # List of tags found and line nrs at which they start

for my $line (@$content) {
$linenr++;
$startline = $linenr;

# If we found a tag
if ( $line =~ /^sub\s+tag_(\S+)\s*{\s*$/ ) {
push @tags, [ $1, $startline ] ;
$hash{total}{systemtags}++;
$hash{total}{tags}++;
}
} # END for()

for my $itm (@tags) {
my ($tag, $lnum) = @$itm;
push @{ $hash{symbols}{$context}{$tag} }, {
%c,
lnum => $lnum,
ctx => [ '' ], #?format_ctx(split(/\n/, $tag)) ],
};

file_extractSub($tag, "Vend::Interpolate::tag_$tag",
\%c, {group => $context});

if ( $resolver_path{$context}{$tag} ) {
while (my $spath=shift @{ $resolver_path{$context}{$tag}}){
push @{ $hash{symbols}{$context}{$tag} }, {
ctx_p => 0,
ctx_n => 0,
%$spath,
};
}
}else{
push @{ $hash{symbols}{$context}{$tag} }, {
ctx_p => 0,
ctx_n => 0,
ctx => [ 'No extracted context' ],
};
}
}
}


# This is basically an excersize in bracket-matching
# Invoke as:
# (
# symbol_this_function_belongs_to,
# Path::To::function(),
# \%c,
# { context_data }
# )
# This will extract a function (function body) and push it
# onto @{ $resolver_path{$$context_data{group}}{$funcname} }.
# So after you call extractSub, check if anything was pushed
# onto that variable for your processing.
sub file_extractSub {
my ( $funcname, $func, $c, $context_data) = @_;

Expand Down

0 comments on commit cdc1be8

Please sign in to comment.