diff --git a/util/ncgg/build.lua b/util/ncgg/build.lua index bf459dafc..c514306b1 100644 --- a/util/ncgg/build.lua +++ b/util/ncgg/build.lua @@ -13,14 +13,12 @@ local cgglexer = flex { normalrule { name = "keywords", ins = { - "./cvtkeywords", - "util/cmisc+ed", + "./make_enterkeyw_c.lua", "./keywords", - matching(filenamesof(cggparser), "%.h$") }, outleaves = { "enterkeyw.c" }, commands = { - "%{ins[1]} %{ins[2]} %{ins[3]} %{ins[4]} %{outs[1]}" + "$LUA %{ins[1]} < %{ins[2]} > %{outs[1]}" } } diff --git a/util/ncgg/cvtkeywords b/util/ncgg/cvtkeywords deleted file mode 100755 index 46472ecbc..000000000 --- a/util/ncgg/cvtkeywords +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -: '$Id$' - -grep '^#' $3 >tokendefs -$1 -s $2 > $4 <<'!Funky!Stuff!' -g/^#/d -1,$s/\([^ ]*\)[ ][ ]*\(.*\)/ sy_p=lookup("\1",symkeyw,newsymbol);sy_p->sy_value.syv_keywno=\2;/ -1i -#include "lookup.h" -. -.r tokendefs -a - -void enterkeyw(void) { - register symbol *sy_p; - -. -$a -} -. -1,$p -!Funky!Stuff! -rm tokendefs - diff --git a/util/ncgg/make_enterkeyw_c.lua b/util/ncgg/make_enterkeyw_c.lua new file mode 100755 index 000000000..572cbb084 --- /dev/null +++ b/util/ncgg/make_enterkeyw_c.lua @@ -0,0 +1,26 @@ +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("^(%g+)%s+(%g+)$") + print(string.format([[ + lookup("%s", symkeyw, newsymbol)->sy_value.syv_keywno = %s; + ]], w1, w2)) + end +end + +print([[ +} +]]) +