mirror of https://github.com/rusefi/lua.git
label syntax changed to ':🏷️:'
This commit is contained in:
parent
43f13729a2
commit
719c01359f
4
llex.h
4
llex.h
|
@ -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
|
** Lexical Analyzer
|
||||||
** See Copyright Notice in lua.h
|
** 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_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,
|
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
|
||||||
/* other terminal symbols */
|
/* 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
|
TK_NUMBER, TK_NAME, TK_STRING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
12
lparser.c
12
lparser.c
|
@ -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
|
** Lua Parser
|
||||||
** See Copyright Notice in lua.h
|
** 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) {
|
static void labelstat (LexState *ls, TString *label, int line) {
|
||||||
/* label -> '@' NAME ':' */
|
/* label -> '::' NAME '::' */
|
||||||
FuncState *fs = ls->fs;
|
FuncState *fs = ls->fs;
|
||||||
Labellist *ll = &ls->dyd->label;
|
Labellist *ll = &ls->dyd->label;
|
||||||
int l; /* index of new label being created */
|
int l; /* index of new label being created */
|
||||||
checkrepeated(ls, fs, ll, label); /* check for repeated labels */
|
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 */
|
/* create new entry for this label */
|
||||||
l = newlabelentry(ls, ll, label, line, fs->pc);
|
l = newlabelentry(ls, ll, label, line, fs->pc);
|
||||||
/* skip other no-op statements */
|
/* skip other no-op statements */
|
||||||
while (ls->t.token == ';' || ls->t.token == '@')
|
while (ls->t.token == ';' || ls->t.token == TK_DBCOLON)
|
||||||
statement(ls);
|
statement(ls);
|
||||||
if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */
|
if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */
|
||||||
/* assume that locals are already out of scope */
|
/* assume that locals are already out of scope */
|
||||||
|
@ -1552,8 +1552,8 @@ static void statement (LexState *ls) {
|
||||||
localstat(ls);
|
localstat(ls);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case '@': { /* stat -> label */
|
case TK_DBCOLON: { /* stat -> label */
|
||||||
luaX_next(ls); /* skip '@' */
|
luaX_next(ls); /* skip double colon */
|
||||||
labelstat(ls, str_checkname(ls), line);
|
labelstat(ls, str_checkname(ls), line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue