label syntax changed to ':🏷️:'

This commit is contained in:
Roberto Ierusalimschy 2011-06-20 13:52:48 -03:00
parent 43f13729a2
commit 719c01359f
2 changed files with 8 additions and 8 deletions

4
llex.h
View File

@ -1,5 +1,5 @@
/*
** $Id: llex.h,v 1.69 2011/02/23 13:13:10 roberto Exp roberto $
** $Id: llex.h,v 1.70 2011/05/03 15:51:16 roberto Exp roberto $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@ -26,7 +26,7 @@ enum RESERVED {
TK_GOTO, 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_EOS,
TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS,
TK_NUMBER, TK_NAME, TK_STRING
};

View File

@ -1,5 +1,5 @@
/*
** $Id: lparser.c,v 2.109 2011/05/02 17:33:01 roberto Exp roberto $
** $Id: lparser.c,v 2.110 2011/06/16 16:36:39 roberto Exp roberto $
** Lua Parser
** See Copyright Notice in lua.h
*/
@ -1209,16 +1209,16 @@ static void checkrepeated (LexState *ls, FuncState *fs, Labellist *ll,
static void labelstat (LexState *ls, TString *label, int line) {
/* label -> '@' NAME ':' */
/* label -> '::' NAME '::' */
FuncState *fs = ls->fs;
Labellist *ll = &ls->dyd->label;
int l; /* index of new label being created */
checkrepeated(ls, fs, ll, label); /* check for repeated labels */
checknext(ls, ':'); /* skip colon */
checknext(ls, TK_DBCOLON); /* skip double colon */
/* create new entry for this label */
l = newlabelentry(ls, ll, label, line, fs->pc);
/* skip other no-op statements */
while (ls->t.token == ';' || ls->t.token == '@')
while (ls->t.token == ';' || ls->t.token == TK_DBCOLON)
statement(ls);
if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */
/* assume that locals are already out of scope */
@ -1552,8 +1552,8 @@ static void statement (LexState *ls) {
localstat(ls);
break;
}
case '@': { /* stat -> label */
luaX_next(ls); /* skip '@' */
case TK_DBCOLON: { /* stat -> label */
luaX_next(ls); /* skip double colon */
labelstat(ls, str_checkname(ls), line);
break;
}