Flag for to-be-closed variables changed to '<toclose>'

The flag for to-be-closed variables was changed from '*toclose'
to '<toclose>'. Several people found confusing the old syntax and
the new one has a clear terminator, making it more flexible for
future changes.
This commit is contained in:
Roberto Ierusalimschy
2019-05-09 12:10:31 -03:00
parent 3f253f116e
commit d881325c2f
8 changed files with 40 additions and 38 deletions

View File

@@ -1621,6 +1621,7 @@ static void tocloselocalstat (LexState *ls) {
if (strcmp(getstr(attr), "toclose") != 0)
luaK_semerror(ls,
luaO_pushfstring(ls->L, "unknown attribute '%s'", getstr(attr)));
testnext(ls, '>');
new_localvar(ls, str_checkname(ls));
checknext(ls, '=');
exp1(ls);
@@ -1634,7 +1635,7 @@ static void tocloselocalstat (LexState *ls) {
static void localstat (LexState *ls) {
/* stat -> LOCAL NAME {',' NAME} ['=' explist]
| LOCAL *toclose NAME '=' exp */
if (testnext(ls, '*'))
if (testnext(ls, '<'))
tocloselocalstat(ls);
else
commonlocalstat(ls);