do not wrap with a begin read expressions if it is single

This commit is contained in:
Yuichi Nishiwaki 2013-10-27 18:14:15 +09:00
parent f3041b7ebc
commit c93cef8c8c
1 changed files with 8 additions and 1 deletions

View File

@ -46,7 +46,14 @@ void yylex_destroy();
program
: program_data
{
p->value = pic_cons(p->pic, p->pic->sBEGIN, $1);
/* if single? */
if (pic_eq_p(p->pic, pic_cdr(p->pic, $1), pic_nil_value())) {
p->value = pic_car(p->pic, $1);
}
/* if multiple? */
else {
p->value = pic_cons(p->pic, p->pic->sBEGIN, $1);
}
}
| incomplete_program_data
{