ref: 33cced33c6e25614b230c0d6e53edfba1e36fc9e
parent: 4dd8392ce7ff341b5d19cf8a9d1473aa94b9d807
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Apr 21 11:14:49 EDT 2015
Simplify generror script awk allows expressions in the patterns.
--- a/cc2/generror
+++ b/cc2/generror
@@ -6,18 +6,15 @@
/^enum nerrors {/ {
inhome = 1
}
-/E[A-Z]*, / {
- if (inhome == 1) {
- sub(/,/, "", $1)
- printf("\t[%s] = \"", $1)
- for (i = 3; i < NF-1; ++i)
- printf("%s ", $i)
- printf("%s\",\n", $(NF-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));
}
-/^}/ {
- if (inhome)
- print "};"
+inhome && /^}/ {
+ print "};"
inhome = 0
}