summaryrefslogtreecommitdiffstats
path: root/third_party/js/cfworker/exports.awk
blob: 17f63d7bbfbfe2bb403de02e2f7aa22d995ce318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/awk -f

BEGIN {
  n_exports = 0;
}

{
  if ($0 ~ /^exports.*=/) {
    exports[n_exports] = substr($3, 0, length($3) - 1);
    n_exports++;
  } else {
    print;
  }
}

END {
  for (i = 0; i < n_exports; i++) {
    print "this." exports[i] " = " exports[i] ";";
  }
}