Auto-generate list of operator names.

This commit is contained in:
Tor Andersson
2014-01-12 12:50:39 +01:00
parent fb30504592
commit 50d5cb95ab
2 changed files with 6 additions and 10 deletions

View File

@@ -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

View File

@@ -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);