Renamed 'switch' variable to avoid conflict with a keyword in modern awks.

This commit is contained in:
dtrg 2010-08-01 10:35:04 +00:00
parent 2c54f8c742
commit ee72886e54
2 changed files with 9 additions and 9 deletions

View file

@ -2,13 +2,13 @@ BEGIN {
print "char *pop_push[]=" print "char *pop_push[]="
print "{" print "{"
print "\"\"," print "\"\","
switch = 0 s = 0
} }
/aar/ { /aar/ {
switch = 1 s = 1
} }
{ {
if (switch) printf("\"%s\",\n",$3) if (s) printf("\"%s\",\n",$3)
} }
END { END {
print "};" print "};"

View file

@ -2,21 +2,21 @@ BEGIN { print "#include \"pop_push.h\""
print print
print "char *pop_push[] = {" print "char *pop_push[] = {"
print "\"\"," print "\"\","
switch = 0 s = 0
} }
/aar/ { switch = NR } /aar/ { s = NR }
{ if (switch) { { if (s) {
if ($1 == "cal" || $1 == "cai") $3 = "-?" if ($1 == "cal" || $1 == "cai") $3 = "-?"
printf("/* %s */ \"%s\",\n",$1,$3) printf("/* %s */ \"%s\",\n",$1,$3)
col_2[NR-switch] = $2 col_2[NR-s] = $2
comment[NR-switch] = $1 comment[NR-s] = $1
} }
} }
END { print "};" END { print "};"
print print
print "char flow_tab[]= {" print "char flow_tab[]= {"
print "'\\000'," print "'\\000',"
for(i=0; i < NR-switch; i++) { for(i=0; i < NR-s; i++) {
inf = col_2[i] inf = col_2[i]
f_out = "/* " comment[i] " */ " f_out = "/* " comment[i] " */ "
if (substr(inf,1,1)=="b") f_out = f_out "HASLABEL|" if (substr(inf,1,1)=="b") f_out = f_out "HASLABEL|"