A Peek into Pugs Internals #30

Back to Braces

ruleHashSubscriptBraces :: RuleParser (Exp -> Exp)
ruleHashSubscriptBraces = do
    between (symbol "{") (char '}') $ option id $ do
        exp <- ruleExpression; return $ \x -> Syn "{}" [x, exp]
firstPossibleReturnValue = id
    where
    id x = x    -- actually, this is a standard function
otherPossibleReturnValue = \x -> Syn "{}" [x, exp]
return sub { my $x = shift; return $x };
return sub { my $x = shift; return Syn("{}", [$x, $exp]) };
return -> $x { $x };
return -> $x { Syn("{}", [$x, $exp]) };
Copyright © 2006 Gaal Yahas