in reply to while ()
("remember" starts a lexical scope, but doesn't use any tokens.)/* Loops: while, until, for, and a bare block */ loop : label WHILE '(' remember texpr ')' mintro mblock cont { PL_copline = (line_t)$2; $$ = block_end($4, newSTATEOP(0, $1, newWHILEOP(0, 1, (LOOP*)Nullop, $2, $5, $8, $9, $7))); + } ... | label FOR '(' remember mnexpr ';' texpr ';' mintro mne +xpr ')' mblock /* basically fake up an initialize-while lines +eq */ { OP *forop; PL_copline = (line_t)$2; forop = newSTATEOP(0, $1, newWHILEOP(0, 1, (LOOP*)Nu +llop, $2, scalar($7), $12, $10, $9)); if ($5) { forop = append_elem(OP_LINESEQ, newSTATEOP(0, ($1?savepv($1):N +ullch), $5), forop); } $$ = block_end($4, forop); } ... /* Boolean expression */ texpr : /* NULL means true */ { (void)scan_num("1", &yylval); $$ = yylval.op +val; } | expr ;
AIUI, while () would be illegal if it had said
instead.loop : label WHILE '(' remember expr ')' mintro mblock cont
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: while ()
by jdhedden (Deacon) on Jun 08, 2005 at 12:41 UTC |