| 48 | | enterWhen :: Exp -> Eval Val -> Eval Val |
| | 46 | {-| |
| | 47 | Bind @&continue@ and @&break@ to subs that break out of the @when@ body |
| | 48 | and topicalising block respectively, then perform the given evaluation |
| | 49 | in the new lexical scope. |
| | 50 | |
| | 51 | Note that this function is /not/ responsible for performing the actual @when@ |
| | 52 | test, nor is it responsible for adding the implicit @break@ to the end of the |
| | 53 | @when@'s block--those are already taken care of by 'Pugs.Eval.reduce' |
| | 54 | (see the entry for @('Syn' \"when\" ... )@). |
| | 55 | -} |
| | 56 | enterWhen :: Exp -- ^ The expression that @&break@ should be bound to |
| | 57 | -> Eval Val -- ^ The @when@'s body block, as an evaluation |
| | 58 | -> Eval Val |
| | 81 | {-| |
| | 82 | Generate a new Perl6 operation from a Haskell function, give it a name, and |
| | 83 | generate a @('Pad' -> 'Pad')@ transformer that can be used to install it into |
| | 84 | a pad. |
| | 85 | |
| | 86 | This transformer is passed into a given \'action\' function, which is |
| | 87 | expected to apply the pad-transformer (e.g. in a new lexical scope), then |
| | 88 | perform some evaluation in that scope. |
| | 89 | |
| | 90 | Most of the time, this \'action\' is an anonymous function that passes its |
| | 91 | argument into 'enterLex'. |
| | 92 | -} |
| 84 | | genSymCC :: String |
| 85 | | -> ((Pad -> Pad) -> Eval Val) |
| 86 | | -> Eval Val |
| | 108 | {-| |
| | 109 | Generate a Perl6 primitive that, when called, will activate the /current/ |
| | 110 | continuation (i.e. one that can be used to immediately break out of whatever |
| | 111 | evaluation we are about to perform). This is great for @&last@ and the like. |
| | 112 | |
| | 113 | This produces a pad-transformer @('Pad' -> 'Pad')@. This transformer is given |
| | 114 | to an \'action\' function, which is expected to apply it (e.g. in a lexical |
| | 115 | scope), then perform some evaluation in that scope. |
| | 116 | -} |
| | 117 | genSymCC :: String -- ^ Name of the primitive in the symbol table ('Pad'). |
| | 118 | -> ((Pad -> Pad) -> Eval Val) -- ^ An \'action\' function that will |
| | 119 | -- take the pad-transformer and use |
| | 120 | -- it to perform some evaluation |
| | 121 | -> Eval Val -- ^ Result of passing the pad-transformer to the |
| | 122 | -- \'action\' |
| 91 | | Perform the specified evaluation in a new lexical scope in which |
| 92 | | @&?BLOCK_EXIT@ is bound to a continuation that will break out of the block |
| 93 | | when called. (Actually, @&?BLOCK_EXIT@ is bound to a 'Prim' 'VCode' |
| 94 | | that is /implemented/ using the continuation.) Used by 'Pugs.Eval.reduce' |
| 95 | | when evaluating @('Syn' \"block\" ... )@ expressions. |
| | 127 | Create a Perl6 @&?BLOCK_EXIT@ function that, when activated, breaks out of |
| | 128 | the block scope by activating the current continuation. The block body |
| | 129 | evaluation is then performed in a new lexical scope with @&?BLOCK_EXIT@ |
| | 130 | installed. |
| | 131 | |
| | 132 | Used by 'Pugs.Eval.reduce' when evaluating @('Syn' \"block\" ... )@ |
| | 133 | expressions. |