diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-15 10:32:02 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-05-15 10:32:02 -0300 |
| commit | 12c764ed1ed37179f123af6ab225ba38e6d405d7 (patch) | |
| tree | 0fead6de46b4ffcda620059f055f15f2a44bfe13 | |
| parent | e99e9a94732dcb7407777b724fb61e548d51ba33 (diff) | |
| download | lua-12c764ed1ed37179f123af6ab225ba38e6d405d7.tar.gz lua-12c764ed1ed37179f123af6ab225ba38e6d405d7.tar.bz2 lua-12c764ed1ed37179f123af6ab225ba38e6d405d7.zip | |
semicolons now represent the empty statement
| -rw-r--r-- | lparser.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 2.84 2010/05/13 12:03:26 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.85 2010/05/14 15:03:43 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 | */ |
| @@ -1346,7 +1346,8 @@ static void retstat (LexState *ls) { | |||
| 1346 | static int statement (LexState *ls) { | 1346 | static int statement (LexState *ls) { |
| 1347 | int line = ls->linenumber; /* may be needed for error messages */ | 1347 | int line = ls->linenumber; /* may be needed for error messages */ |
| 1348 | switch (ls->t.token) { | 1348 | switch (ls->t.token) { |
| 1349 | case ';': { /* stat -> <empty statement> */ | 1349 | case ';': { /* stat -> ';' (empty statement) */ |
| 1350 | luaX_next(ls); /* skip ';' */ | ||
| 1350 | return 0; | 1351 | return 0; |
| 1351 | } | 1352 | } |
| 1352 | case TK_IF: { /* stat -> ifstat */ | 1353 | case TK_IF: { /* stat -> ifstat */ |
| @@ -1407,7 +1408,8 @@ static void chunk (LexState *ls) { | |||
| 1407 | enterlevel(ls); | 1408 | enterlevel(ls); |
| 1408 | while (!islast && !block_follow(ls->t.token)) { | 1409 | while (!islast && !block_follow(ls->t.token)) { |
| 1409 | islast = statement(ls); | 1410 | islast = statement(ls); |
| 1410 | testnext(ls, ';'); | 1411 | if (islast) |
| 1412 | testnext(ls, ';'); | ||
| 1411 | lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && | 1413 | lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && |
| 1412 | ls->fs->freereg >= ls->fs->nactvar); | 1414 | ls->fs->freereg >= ls->fs->nactvar); |
| 1413 | ls->fs->freereg = ls->fs->nactvar; /* free registers */ | 1415 | ls->fs->freereg = ls->fs->nactvar; /* free registers */ |
