From eae48c8938e50ebb341a72c2886c5ae8587092a5 Mon Sep 17 00:00:00 2001 From: Zefram Date: Tue, 19 Oct 2010 21:16:11 +0100 Subject: refactor and regularise label/statement grammar Refactoring of the grammar around statements. New production encompasses a statement without label. It includes all statement types, including declarations, with no unnecessary intermediate non-terminals. It generates an op tree for the statement's content, with no leading state op. The production has just one rule, consisting of optional label followed by . It puts a state op on the front of the statement's content ops. To support the regular statement op structure, the op sequence for for(;;) loops no longer has a second state op between the initialisation and the loop. Instead, the unstack op type is slightly adapted to achieve the stack clearing without a state op. The newFOROP() constructor function no longer generates a state op, that now being the job of the production. Consequently it no longer takes a parameter stating what label is to go in the state op. This brings it in line with the other op constructors. --- pp_hot.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pp_hot.c') diff --git a/pp_hot.c b/pp_hot.c index 34542c27f5..3414365b61 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -223,13 +223,14 @@ PP(pp_cond_expr) PP(pp_unstack) { dVAR; - I32 oldsave; PERL_ASYNC_CHECK(); TAINT_NOT; /* Each statement is presumed innocent */ PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp; FREETMPS; - oldsave = PL_scopestack[PL_scopestack_ix - 1]; - LEAVE_SCOPE(oldsave); + if (!(PL_op->op_flags & OPf_SPECIAL)) { + I32 oldsave = PL_scopestack[PL_scopestack_ix - 1]; + LEAVE_SCOPE(oldsave); + } return NORMAL; } -- cgit v1.2.1