From 719c01359f797e3933a7a69b541d7e57e149d061 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 20 Jun 2011 13:52:48 -0300 Subject: [PATCH] label syntax changed to '::label::' --- llex.h | 4 ++-- lparser.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/llex.h b/llex.h index 8d2a4d80..2c1ab559 100644 --- a/llex.h +++ b/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 ** 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 }; diff --git a/lparser.c b/lparser.c index c02e4b84..59aba947 100644 --- a/lparser.c +++ b/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 ** 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; }