diff --git a/Makefile b/Makefile index 86062de..f91c347 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,11 @@ build/%.o : %.c $(HDRS) build/libjs.a: $(OBJS) ar cru $@ $^ +opnames.h : jscompile.h + grep 'OP_' jscompile.h | sed 's/OP_/"/;s/,/",/' | tr A-Z a-z > opnames.h + +jsdump.c : opnames.h + js: build/main.o build/libjs.a $(CC) -o $@ $^ -lm diff --git a/jsdump.c b/jsdump.c index 95df38b..0db096b 100644 --- a/jsdump.c +++ b/jsdump.c @@ -22,16 +22,7 @@ static const char *astname[] = { }; static const char *opname[] = { - "const", "undef", "null", "true", "false", "this", - "array", "arrayput", - "object", "objectput", - "defvar", "var", "index", "member", "load", "dupload", "store", "call", "new", - "closure", "delete", "void", "typeof", "preinc", "postinc", "predec", - "postdec", "pos", "neg", "bitnot", "lognot", "logor", "logand", - "bitor", "bitxor", "bitand", "eq", "ne", "eq3", "ne3", "lt", "gt", - "le", "ge", "instanceof", "in", "shl", "shr", "ushr", "add", "sub", - "mul", "div", "mod", "jump", "jtrue", "jfalse", "try", "throw", - "return", "pushwith", "popwith", "debugger", "pop", +#include "opnames.h" }; static void pstmlist(int d, js_Ast *list);