1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Obsolete $start and $gotone; tune newlines; simply line matching

This commit is contained in:
Jonas Fonseca 2006-01-09 05:30:59 +01:00 committed by Jonas Fonseca
parent 41fe69f86e
commit cab1380031

View File

@ -17,7 +17,7 @@ getopts("hv") or usage($HELP);
$opt_v and usage("Copyleft (c) 2006, Russ Rowan (See `COPYING')"); $opt_v and usage("Copyleft (c) 2006, Russ Rowan (See `COPYING')");
usage($HELP) if $opt_h or @ARGV < 1; usage($HELP) if $opt_h or @ARGV < 1;
my ($found, $start, $first, $gotone, $idpath); my ($found, $first, $idpath);
$idpath = ''; $idpath = '';
while (<>) while (<>)
{ {
@ -25,7 +25,7 @@ while (<>)
# IDENT, /*:: ... */ # IDENT, /*:: ... */
# IDENT = value, /*:: ... */ # IDENT = value, /*:: ... */
# type ident; /*:: ... */ # type ident; /*:: ... */
if ($_ =~ /^(\s|[^\s=]+)*[\s*]([A-Za-z0-9_]+)(\s+=\s+[^,;]+)?[,;]\s*\/\*::\s*(.*)\s+\*\/$/) if (/^(\s|[^\s=]+)*[\s*]([A-Za-z0-9_]+)(\s+=\s+[^,;]+)?[,;]\s*\/\*::\s*(.*)\s+\*\/$/)
{ {
print "\nid:[$idpath$2]::\n\t$4\n"; print "\nid:[$idpath$2]::\n\t$4\n";
next; next;
@ -33,25 +33,23 @@ while (<>)
if ($found) if ($found)
{ {
if ($_ =~ /^\s+\*\s$/) { next if $first; $_ =~ s/\s\*// if not $first; } if (/^\s+\*\s$/) { next if $first; $_ =~ s/\s\*// if not $first; }
if ($_ =~ /^\s\*+\/$/ or $_ !~ /^\s/) { $found = undef; next; } if (/^\s\*+\/$/ or $_ !~ /^\s/) { $found = undef; next; }
$_ =~ s/^(\s*)\s\*\s/$1/; $_ =~ s/^(\s*)\s\*\s/$1/;
$found = 'sorta' if $_ =~ s/\s*\*\/$/\n/; $first = undef; $found = 'sorta' if s/\s*\*\/$/\n/; $first = undef;
} }
elsif ($_ =~ /^\s*\/\*\*\s(.*)/) elsif (/^\s*\/\*\*\s(.*)/)
{ {
$_ = $1; $first = 1; $_ = $1; $first = 1;
print STDOUT "\n\n" if $start; if (/\s*\*\/$/) { $found = 'sorta'; } else { $found = $.; }
if ($_ =~ s/\s*\*\/$//) { $found = 'sorta'; } else { $found = $.; } if (/struct:[[]([^\]]+)[\]]/) { $idpath = "$1."; } else { $idpath = ''; }
if ($_ =~ /struct:[[]([^\]]+)[\]]/) { $idpath = "$1."; } else { $idpath = ''; } if (/::/) { $_ = "\n$_\n\n"; }
if ($_ =~ /::/) { $_ = "$_\n\n"; }
else else
{ {
my $dash; for (my $x = 0; $x < length($_); $x++) { $dash .= '-'; } my $dash; for (my $x = 0; $x < length($_); $x++) { $dash .= '-'; }
$_ = "$_\n$dash\n\n"; $_ = "\n$_\n$dash\n\n";
} }
} }
print STDOUT "\n" and $gotone = undef if $gotone and $gotone < $.;
next if not $found; $found = undef if $found eq 'sorta'; next if not $found; $found = undef if $found eq 'sorta';
print STDOUT $_ and $start = 1; print STDOUT $_;
} }