From 97b2fd1ba1685137dd1933a9e7e70fdc010760d3 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 8 Jun 1995 16:47:28 -0300 Subject: [PATCH] syntax for {...;...} is more flexible now. --- lua.stx | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/lua.stx b/lua.stx index e32686c6..f8bdb9d7 100644 --- 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 #include @@ -398,8 +398,8 @@ void lua_parse (Byte **code) %type PrepJump %type expr, exprlist, exprlist1, varlist1, funcParams, funcvalue %type fieldlist, localdeclist, decinit -%type ffieldlist1 -%type lfieldlist1 +%type ffieldlist, ffieldlist1, semicolonpart +%type lfieldlist, lfieldlist1 %type var, singlevar %type 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 {