X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/566e87bb15a98ed499e79b45f6c834ad0ffdc3b7..ec4bdd2e748b84924b0b6bae6c37ff6f0ec8cc6c:/src/gen-specstr.awk diff --git a/src/gen-specstr.awk b/src/gen-specstr.awk index c07856e..6831667 100755 --- a/src/gen-specstr.awk +++ b/src/gen-specstr.awk @@ -79,7 +79,7 @@ END { if (specs[i] == "IDENT") s = "0"; else - s = "T_" substr(specs[i] " ", 1, maxwidth) " - 256"; + s = "T_" substr(specs[i] " ", 1, maxwidth) " & 0xff"; offset_table = offset_table s suffix; } @@ -93,6 +93,8 @@ END { print "\tassert(x < sizeof idx);"; print "\tif (!(x = idx[x]))"; print "\t\treturn \"\";"; - print "\treturn cdecl__token_name(x + 256);"; + print "\tif (T_" specs[0] " >= 256)"; + print "\t\tx += 256;"; + print "\treturn cdecl__token_name(x);"; print "}"; }