-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathliterst.awk
More file actions
46 lines (43 loc) · 773 Bytes
/
literst.awk
File metadata and controls
46 lines (43 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
BEGIN {
block=0;
printf(".. highlight:: c\n\n");
}
{
spos=match($0,"^[/][*]");
mpos=match($0,"^[ ][*][ ]|^[ ][*]$");
epos=match($0,"^[ ][*][/]");
if(spos > 0 && epos ==0)
{
printf("%s\n",substr($0,spos+3,length($0)));
block=0;
}
else if ( spos == 0 && epos > 0)
{
printf("%s\n",substr($0,spos+3,epos-3));
block=1;
}
else if(mpos > 0)
{
printf("%s\n",substr($0,mpos+3,length($0)));
block=0;
}
else if (epos > 0)
{
block=1;
}
else if ( epos == 0 && mpos == 0 && spos == 0 )
{
if (block==1)
{
block = 0;
printf("\n::\n\n");
}
printf("\t%s\n",$0);
}
}
END {
if(found==1)
{
print "there is unmatched comment"
}
}