Ver código fonte

BUG: parser does not accept a `;' after a `return'

Roberto Ierusalimschy 25 anos atrás
pai
commit
fc7b167ae0
2 arquivos alterados com 12 adições e 2 exclusões
  1. 10 0
      bugs
  2. 2 2
      lparser.c

+ 10 - 0
bugs

@@ -235,3 +235,13 @@ Thu Oct 26 10:50:46 EDT 2000
 >> allocate new memory
 (by Mauro Vezzosi; since 4.0b)
 
+
+
+=================================================================
+--- Version 4.0
+
+** lparser.c
+Wed Nov 29 09:51:44 EDT 2000
+>> parser does not accept a `;' after a `return'
+(by lhf; since 4.0b)
+

+ 2 - 2
lparser.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lparser.c,v 1.115 2000/10/10 19:51:15 roberto Exp roberto $
+** $Id: lparser.c,v 1.116 2000/10/27 11:39:52 roberto Exp roberto $
 ** LL(1) Parser and code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -997,7 +997,7 @@ static void retstat (LexState *ls) {
   /* stat -> RETURN explist */
   FuncState *fs = ls->fs;
   next(ls);  /* skip RETURN */
-  if (!block_follow(ls->t.token))
+  if (!block_follow(ls->t.token) && ls->t.token != ';')
     explist1(ls);  /* optional return values */
   luaK_code1(fs, OP_RETURN, ls->fs->nactloc);
   fs->stacklevel = fs->nactloc;  /* removes all temp values */