From ffbca6a64654ffd0124656640f6fd852340faaac Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 17 Jan 2020 14:54:22 -0800 Subject: [PATCH] Revert "Lua 'global' keyword, only for functions for now because I'm tired" This reverts commit db4dc1010088918f9c9ccb3176adf64efe08cd57. --- src/blua/llex.c | 2 +- src/blua/llex.h | 2 +- src/blua/lparser.c | 16 ---------------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/blua/llex.c b/src/blua/llex.c index 742319b0c..9e3dc2929 100644 --- a/src/blua/llex.c +++ b/src/blua/llex.c @@ -38,7 +38,7 @@ const char *const luaX_tokens [] = { "and", "break", "continue", "do", "else", "elseif", "end", "false", "for", "function", "if", - "in", "local", "global", "nil", "not", "or", "repeat", + "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while", "..", "...", "==", ">=", "<=", "~=", "", "", "", "", diff --git a/src/blua/llex.h b/src/blua/llex.h index 4da3fe9f3..3f55c75cd 100644 --- a/src/blua/llex.h +++ b/src/blua/llex.h @@ -25,7 +25,7 @@ enum RESERVED { /* terminal symbols denoted by reserved words */ TK_AND = FIRST_RESERVED, TK_BREAK, TK_CONTINUE, TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, - TK_IF, TK_IN, TK_LOCAL, TK_GLOBAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, + TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, /* other terminal symbols */ TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, diff --git a/src/blua/lparser.c b/src/blua/lparser.c index aab441a83..dde2caf4c 100644 --- a/src/blua/lparser.c +++ b/src/blua/lparser.c @@ -1349,16 +1349,6 @@ static void localfunc (LexState *ls) { } -static void globalfunc (LexState *ls) { - expdesc v, b; - FuncState *fs = ls->fs; - init_exp(&v, VGLOBAL, NO_REG); - v.u.s.info = luaK_stringK(fs, str_checkname(ls)); - body(ls, &b, 0, ls->linenumber); - luaK_storevar(fs, &v, &b); -} - - static void localstat (LexState *ls) { /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ int nvars = 0; @@ -1498,12 +1488,6 @@ static int statement (LexState *ls) { localstat(ls); return 0; } - case TK_GLOBAL: { /* stat -> globalstat */ - luaX_next(ls); /* skip GLOBAL */ - if (testnext(ls, TK_FUNCTION)) - globalfunc(ls); - return 0; - } case TK_RETURN: { /* stat -> retstat */ retstat(ls); return 1; /* must be last statement */