shithub: scc

ref: 80450c349f4ca1207c3dfcfbd4e7d91f90bb537e
dir: /cc2.old/generror/

View raw version

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
}