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

This commit is contained in:
Roberto Ierusalimschy 2000-11-29 09:57:42 -02:00
parent 96253ed8ce
commit fc7b167ae0
2 changed files with 12 additions and 2 deletions

10
bugs
View File

@ -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)

View File

@ -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 */