ack/util/ncgg/make_enterkeyw_c.lua
2022-08-01 22:44:31 +02:00

27 lines
442 B
Lua
Executable file

print([[
#include "param.h"
#include "lookup.h"
#include "varinfo.h"
#include "instruct.h"
#include "set.h"
#include "expr.h"
#include "iocc.h"
#include "y.tab.h"
void enterkeyw(void) {
]])
for line in io.stdin:lines() do
if not line:find("^#") then
local _, _, w1, w2 = line:find("^([^ \t]+)%s+([^ \t]+)$")
print(string.format([[
lookup("%s", symkeyw, newsymbol)->sy_value.syv_keywno = %s;
]], w1, w2))
end
end
print([[
}
]])