VirtualBox

source: kBuild/trunk/src/sed/doc/groupify.sed@ 2788

Last change on this file since 2788 was 599, checked in by bird, 18 years ago

GNU sed 4.1.5.

File size: 1.0 KB
Line 
1#! /bin/sed -nf
2# Script to add @group...@end group tags to sed.texi.in
3# so that comments are not separated from the instructions
4# that they refer to.
5
6# Step 1: search for the conventional "@c start----" comment
71a\
8@c Do not edit this file!! It is automatically generated from sed-in.texi.
9p
10/^@c start-*$/! b
11
12# Step 2: loop until we find a @ command
13:a
14n
15p
16/^@/! ba
17
18# Step 3: process everything until a "@end" command
19
20# Step 3.1: Print the blank lines before the group. If we reach the "@end",
21# we go back to step 1.
22:b
23n
24/^@end/ {
25 p
26 b
27}
28/^[ ]*$/ {
29 p
30 bb
31}
32
33# Step 3.2: Add to hold space every line until an empty one or "@end"
34h
35:c
36n
37/^@end example/! {
38 /^[ ]*$/! {
39 H
40 bc
41 }
42}
43
44# Step 3.3: Working in hold space, add @group...@end group if there are
45# at least two lines. Then print the lines we processed and
46# switch back to pattern space.
47x
48/\n/ {
49 s/.*/@group\
50&\
51@end group/
52}
53p
54
55# Step 3.4: Switch back to pattern space, print the first blank line
56# and possibly go back to step 3.1
57x
58p
59/^@end/ !bb
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette