1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-25 01:05:37 +00:00

Handle one-liners with '/*:: ... */' upfront

This commit is contained in:
Jonas Fonseca 2006-01-09 05:03:07 +01:00 committed by Jonas Fonseca
parent 4e8abf55ec
commit 41fe69f86e

View File

@ -21,6 +21,16 @@ my ($found, $start, $first, $gotone, $idpath);
$idpath = '';
while (<>)
{
# Match:
# IDENT, /*:: ... */
# IDENT = value, /*:: ... */
# type ident; /*:: ... */
if ($_ =~ /^(\s|[^\s=]+)*[\s*]([A-Za-z0-9_]+)(\s+=\s+[^,;]+)?[,;]\s*\/\*::\s*(.*)\s+\*\/$/)
{
print "\nid:[$idpath$2]::\n\t$4\n";
next;
}
if ($found)
{
if ($_ =~ /^\s+\*\s$/) { next if $first; $_ =~ s/\s\*// if not $first; }
@ -41,12 +51,6 @@ while (<>)
$_ = "$_\n$dash\n\n";
}
}
elsif ($_ =~ /^(\s|[^\s=]+)*[\s*]([A-Za-z0-9_]+)(\s+=\s+[^,;]+)?[,;]\s*\/\*::\s*(.*)\s+\*\/$/)
{
print STDOUT "\n" if $gotone;
$_ = "\nid:[$idpath$2]::\n\t$4\n";
$found = 'sorta'; $gotone = $.;
}
print STDOUT "\n" and $gotone = undef if $gotone and $gotone < $.;
next if not $found; $found = undef if $found eq 'sorta';
print STDOUT $_ and $start = 1;