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

Match against comment end once

This commit is contained in:
Jonas Fonseca 2006-01-09 06:49:15 +01:00 committed by Jonas Fonseca
parent 9e23ea9eeb
commit 9699396658

View File

@ -21,11 +21,13 @@ my ($found, $indent, $idpath);
$idpath = ''; $indent = ''; $idpath = ''; $indent = '';
while (<>) while (<>)
{ {
my $end = s/\s*\*+\//\n/ ? 'yes' : undef;
# Match: # Match:
# IDENT, /*:: ... */ # IDENT, /*:: ... */
# IDENT = value, /*:: ... */ # IDENT = value, /*:: ... */
# type ident; /*:: ... */ # type ident; /*:: ... */
if (/^(\s|[^\s=]+)*[\s*]([A-Za-z0-9_]+)(\s+=\s+[^,;]+)?[,;]\s*\/\*::\s*(.*)\s+\*\/$/) if ($end and /^(\s|[^\s=]+)*[\s*]([A-Za-z0-9_]+)(\s+=\s+[^,;]+)?[,;]\s*\/\*::\s*(.*)/)
{ {
print "\nid:[$idpath$2]::\n\t$4\n"; print "\nid:[$idpath$2]::\n\t$4\n";
next; next;
@ -33,14 +35,12 @@ while (<>)
if ($found) if ($found)
{ {
$found = 'sorta' if s/\s*\*+\//\n/;
s/^(\s|\*)*/$indent/; s/^(\s|\*)*/$indent/;
s/^$indent$/\n/; s/^$indent$/\n/;
} }
elsif (/^\s*\/\*\*\s(.*)/) elsif (/^\s*\/\*\*\s(.*)/)
{ {
$_ = $1; $_ = $1;
if (/\s*\*\/$/) { $found = 'sorta'; } else { $found = $.; }
if (/struct:[[]([^\]]+)[\]]/) { $idpath = "$1."; } else { $idpath = ''; } if (/struct:[[]([^\]]+)[\]]/) { $idpath = "$1."; } else { $idpath = ''; }
if (/::/) if (/::/)
{ {
@ -53,7 +53,9 @@ while (<>)
$_ = "\n$_\n$dash\n"; $_ = "\n$_\n$dash\n";
$indent = ""; $indent = "";
} }
$found = 'jep';
} }
next if not $found; $found = undef if $found eq 'sorta'; next if not $found;
$found = undef if $end;
print STDOUT $_; print STDOUT $_;
} }