diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-06-08 16:47:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-06-08 16:47:28 -0300 |
commit | 97b2fd1ba1685137dd1933a9e7e70fdc010760d3 (patch) | |
tree | a83b1b79a2b82c980dcbc978c658e80aa4ec36ac | |
parent | e13753e2fb6ad6522c87e9a0a88dc745e9205797 (diff) | |
download | lua-97b2fd1ba1685137dd1933a9e7e70fdc010760d3.tar.gz lua-97b2fd1ba1685137dd1933a9e7e70fdc010760d3.tar.bz2 lua-97b2fd1ba1685137dd1933a9e7e70fdc010760d3.zip |
syntax for {...;...} is more flexible now.
-rw-r--r-- | lua.stx | 31 |
1 files changed, 21 insertions, 10 deletions
@@ -1,6 +1,6 @@ | |||
1 | %{ | 1 | %{ |
2 | 2 | ||
3 | char *rcs_luastx = "$Id: lua.stx,v 3.17 1995/01/13 22:11:12 roberto Exp celes $"; | 3 | char *rcs_luastx = "$Id: lua.stx,v 3.18 1995/04/11 17:56:30 celes Exp roberto $"; |
4 | 4 | ||
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
@@ -398,8 +398,8 @@ void lua_parse (Byte **code) | |||
398 | %type <vLong> PrepJump | 398 | %type <vLong> PrepJump |
399 | %type <vInt> expr, exprlist, exprlist1, varlist1, funcParams, funcvalue | 399 | %type <vInt> expr, exprlist, exprlist1, varlist1, funcParams, funcvalue |
400 | %type <vInt> fieldlist, localdeclist, decinit | 400 | %type <vInt> fieldlist, localdeclist, decinit |
401 | %type <vInt> ffieldlist1 | 401 | %type <vInt> ffieldlist, ffieldlist1, semicolonpart |
402 | %type <vInt> lfieldlist1 | 402 | %type <vInt> lfieldlist, lfieldlist1 |
403 | %type <vLong> var, singlevar | 403 | %type <vLong> var, singlevar |
404 | %type <pByte> body | 404 | %type <pByte> body |
405 | 405 | ||
@@ -648,21 +648,28 @@ parlist1 : NAME | |||
648 | } | 648 | } |
649 | ; | 649 | ; |
650 | 650 | ||
651 | fieldlist : /* empty */ { $$ = 0; } | 651 | fieldlist : lfieldlist |
652 | | lfieldlist1 lastcomma | 652 | { flush_list($1/FIELDS_PER_FLUSH, $1%FIELDS_PER_FLUSH); } |
653 | { $$ = $1; flush_list($1/FIELDS_PER_FLUSH, $1%FIELDS_PER_FLUSH); } | 653 | semicolonpart |
654 | { $$ = $1+$3; } | ||
654 | | ffieldlist1 lastcomma | 655 | | ffieldlist1 lastcomma |
655 | { $$ = $1; flush_record($1%FIELDS_PER_FLUSH); } | 656 | { $$ = $1; flush_record($1%FIELDS_PER_FLUSH); } |
656 | | lfieldlist1 ';' | ||
657 | { flush_list($1/FIELDS_PER_FLUSH, $1%FIELDS_PER_FLUSH); } | ||
658 | ffieldlist1 lastcomma | ||
659 | { $$ = $1+$4; flush_record($4%FIELDS_PER_FLUSH); } | ||
660 | ; | 657 | ; |
661 | 658 | ||
659 | semicolonpart : /* empty */ | ||
660 | { $$ = 0; } | ||
661 | | ';' ffieldlist | ||
662 | { $$ = $2; flush_record($2%FIELDS_PER_FLUSH); } | ||
663 | ; | ||
664 | |||
662 | lastcomma : /* empty */ | 665 | lastcomma : /* empty */ |
663 | | ',' | 666 | | ',' |
664 | ; | 667 | ; |
665 | 668 | ||
669 | ffieldlist : /* empty */ { $$ = 0; } | ||
670 | | ffieldlist1 lastcomma { $$ = $1; } | ||
671 | ; | ||
672 | |||
666 | ffieldlist1 : ffield {$$=1;} | 673 | ffieldlist1 : ffield {$$=1;} |
667 | | ffieldlist1 ',' ffield | 674 | | ffieldlist1 ',' ffield |
668 | { | 675 | { |
@@ -677,6 +684,10 @@ ffield : NAME '=' expr1 | |||
677 | } | 684 | } |
678 | ; | 685 | ; |
679 | 686 | ||
687 | lfieldlist : /* empty */ { $$ = 0; } | ||
688 | | lfieldlist1 lastcomma { $$ = $1; } | ||
689 | ; | ||
690 | |||
680 | lfieldlist1 : expr1 {$$=1;} | 691 | lfieldlist1 : expr1 {$$=1;} |
681 | | lfieldlist1 ',' expr1 | 692 | | lfieldlist1 ',' expr1 |
682 | { | 693 | { |