shithub: scc

ref: a6cab76f9a90a0dbadf789b1b68aa0c05fc90ff7
dir: /cc2/generror/

View raw version
#!/usr/bin/env awk -f

BEGIN {
	print "char *errlist[] = {"
}
/^enum nerrors {/ {
	inhome = 1
}
inhome && /E[A-Z]*, / {
	sub(/,/, "", $1)
	printf("\t[%s] = \"", $1)
	for (i = 3; i < NF-1; ++i)
		printf("%s ", $i)
	printf("%s\",\n", $(NF-1));
}
inhome && /^}/ {
	print "};"
	inhome = 0
}