aboutsummaryrefslogtreecommitdiff
path: root/vendor/cabal-helper-0.8.1.2/scripts/update-cabal-common-section-instantiations.awk
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/cabal-helper-0.8.1.2/scripts/update-cabal-common-section-instantiations.awk')
-rw-r--r--vendor/cabal-helper-0.8.1.2/scripts/update-cabal-common-section-instantiations.awk34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/cabal-helper-0.8.1.2/scripts/update-cabal-common-section-instantiations.awk b/vendor/cabal-helper-0.8.1.2/scripts/update-cabal-common-section-instantiations.awk
new file mode 100644
index 0000000..0bfacae
--- /dev/null
+++ b/vendor/cabal-helper-0.8.1.2/scripts/update-cabal-common-section-instantiations.awk
@@ -0,0 +1,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;
+ }
+}