diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-06-20 13:52:48 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-06-20 13:52:48 -0300 |
commit | 719c01359f797e3933a7a69b541d7e57e149d061 (patch) | |
tree | 871c306cafaf033a99de4a31ce2f8bdeea1b9c7d | |
parent | 43f13729a24f187c291135aa60cdeb9d9be89251 (diff) | |
download | lua-719c01359f797e3933a7a69b541d7e57e149d061.tar.gz lua-719c01359f797e3933a7a69b541d7e57e149d061.tar.bz2 lua-719c01359f797e3933a7a69b541d7e57e149d061.zip |
label syntax changed to '::label::'
-rw-r--r-- | llex.h | 4 | ||||
-rw-r--r-- | lparser.c | 12 |
2 files changed, 8 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.h,v 1.69 2011/02/23 13:13:10 roberto Exp roberto $ | 2 | ** $Id: llex.h,v 1.70 2011/05/03 15:51:16 roberto Exp roberto $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -26,7 +26,7 @@ enum RESERVED { | |||
26 | TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, | 26 | TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, |
27 | TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, | 27 | TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, |
28 | /* other terminal symbols */ | 28 | /* other terminal symbols */ |
29 | TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_EOS, | 29 | TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS, |
30 | TK_NUMBER, TK_NAME, TK_STRING | 30 | TK_NUMBER, TK_NAME, TK_STRING |
31 | }; | 31 | }; |
32 | 32 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.109 2011/05/02 17:33:01 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.110 2011/06/16 16:36:39 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1209,16 +1209,16 @@ static void checkrepeated (LexState *ls, FuncState *fs, Labellist *ll, | |||
1209 | 1209 | ||
1210 | 1210 | ||
1211 | static void labelstat (LexState *ls, TString *label, int line) { | 1211 | static void labelstat (LexState *ls, TString *label, int line) { |
1212 | /* label -> '@' NAME ':' */ | 1212 | /* label -> '::' NAME '::' */ |
1213 | FuncState *fs = ls->fs; | 1213 | FuncState *fs = ls->fs; |
1214 | Labellist *ll = &ls->dyd->label; | 1214 | Labellist *ll = &ls->dyd->label; |
1215 | int l; /* index of new label being created */ | 1215 | int l; /* index of new label being created */ |
1216 | checkrepeated(ls, fs, ll, label); /* check for repeated labels */ | 1216 | checkrepeated(ls, fs, ll, label); /* check for repeated labels */ |
1217 | checknext(ls, ':'); /* skip colon */ | 1217 | checknext(ls, TK_DBCOLON); /* skip double colon */ |
1218 | /* create new entry for this label */ | 1218 | /* create new entry for this label */ |
1219 | l = newlabelentry(ls, ll, label, line, fs->pc); | 1219 | l = newlabelentry(ls, ll, label, line, fs->pc); |
1220 | /* skip other no-op statements */ | 1220 | /* skip other no-op statements */ |
1221 | while (ls->t.token == ';' || ls->t.token == '@') | 1221 | while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) |
1222 | statement(ls); | 1222 | statement(ls); |
1223 | if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ | 1223 | if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ |
1224 | /* assume that locals are already out of scope */ | 1224 | /* assume that locals are already out of scope */ |
@@ -1552,8 +1552,8 @@ static void statement (LexState *ls) { | |||
1552 | localstat(ls); | 1552 | localstat(ls); |
1553 | break; | 1553 | break; |
1554 | } | 1554 | } |
1555 | case '@': { /* stat -> label */ | 1555 | case TK_DBCOLON: { /* stat -> label */ |
1556 | luaX_next(ls); /* skip '@' */ | 1556 | luaX_next(ls); /* skip double colon */ |
1557 | labelstat(ls, str_checkname(ls), line); | 1557 | labelstat(ls, str_checkname(ls), line); |
1558 | break; | 1558 | break; |
1559 | } | 1559 | } |