#!/usr/bin/env python import sets import sys def getNames(n): result = [] f = open(n, "r") if True: for line in f.readlines(): if line.startswith("export "): sys.stdout.write(line[len("export ") : ]) else: sys.stdout.write(line) if line.find("=") == -1 or not line.startswith("export let "): continue rest = line[len("export let ") : ] rest = rest[: rest.find("=")].strip() if rest.endswith(":"): # := rest = rest[:-1].strip() name = rest result.append(name) return(sets.Set(result)) #l = ["('%s, %s)" % (n, n) for n in getNames(sys.argv[1])] l = [n for n in getNames(sys.argv[1])] #print "let (:) := (requireModule \"List\").(:) in " print "(requireModule \"Composition\").dispatch1 #exports[\n" + ("\n".join(l)) + "]"