commit 97b2fd1ba1685137dd1933a9e7e70fdc010760d3
parent e13753e2fb6ad6522c87e9a0a88dc745e9205797
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 8 Jun 1995 16:47:09 -0300
syntax for {...;...} is more flexible now.
Diffstat:
M | lua.stx | | | 31 | +++++++++++++++++++++---------- |
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/lua.stx b/lua.stx
@@ -1,6 +1,6 @@
%{
-char *rcs_luastx = "$Id: lua.stx,v 3.17 1995/01/13 22:11:12 roberto Exp celes $";
+char *rcs_luastx = "$Id: lua.stx,v 3.18 1995/04/11 17:56:30 celes Exp roberto $";
#include <stdio.h>
#include <stdlib.h>
@@ -398,8 +398,8 @@ void lua_parse (Byte **code)
%type <vLong> PrepJump
%type <vInt> expr, exprlist, exprlist1, varlist1, funcParams, funcvalue
%type <vInt> fieldlist, localdeclist, decinit
-%type <vInt> ffieldlist1
-%type <vInt> lfieldlist1
+%type <vInt> ffieldlist, ffieldlist1, semicolonpart
+%type <vInt> lfieldlist, lfieldlist1
%type <vLong> var, singlevar
%type <pByte> body
@@ -648,21 +648,28 @@ parlist1 : NAME
}
;
-fieldlist : /* empty */ { $$ = 0; }
- | lfieldlist1 lastcomma
- { $$ = $1; flush_list($1/FIELDS_PER_FLUSH, $1%FIELDS_PER_FLUSH); }
+fieldlist : lfieldlist
+ { flush_list($1/FIELDS_PER_FLUSH, $1%FIELDS_PER_FLUSH); }
+ semicolonpart
+ { $$ = $1+$3; }
| ffieldlist1 lastcomma
{ $$ = $1; flush_record($1%FIELDS_PER_FLUSH); }
- | lfieldlist1 ';'
- { flush_list($1/FIELDS_PER_FLUSH, $1%FIELDS_PER_FLUSH); }
- ffieldlist1 lastcomma
- { $$ = $1+$4; flush_record($4%FIELDS_PER_FLUSH); }
;
+semicolonpart : /* empty */
+ { $$ = 0; }
+ | ';' ffieldlist
+ { $$ = $2; flush_record($2%FIELDS_PER_FLUSH); }
+ ;
+
lastcomma : /* empty */
| ','
;
+ffieldlist : /* empty */ { $$ = 0; }
+ | ffieldlist1 lastcomma { $$ = $1; }
+ ;
+
ffieldlist1 : ffield {$$=1;}
| ffieldlist1 ',' ffield
{
@@ -677,6 +684,10 @@ ffield : NAME '=' expr1
}
;
+lfieldlist : /* empty */ { $$ = 0; }
+ | lfieldlist1 lastcomma { $$ = $1; }
+ ;
+
lfieldlist1 : expr1 {$$=1;}
| lfieldlist1 ',' expr1
{