aboutsummaryrefslogtreecommitdiff
path: root/vendor/cabal-helper-0.8.1.2/scripts/update-cabal-common-section-instantiations.awk
blob: 0bfacae9a25f456134b9b1b0f1c79eaced7818de (plain) (blame)
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
BEGIN {
        delete sections;
        section="";
        ignoring=0;
}

/^[[:space:]]*$/ {
        section="";
        ignoring=0;
}

{
        if(section) {
                tmp = sections[section];
                sections[section] = tmp (tmp ? RS : "") $0;
        }
}

/^[[:space:]]*-- *Common/ {
        section = $3
}

/^[[:space:]]*-- *Instantiate *common/ {
        ignoring=1

        print $0;
        print sections[$4];
}

{
        if(!ignoring) {
                print $0;
        }
}