A Peek into Pugs Internals #31

Back to Braces

ruleHashSubscriptBraces :: RuleParser (Exp -> Exp)
ruleHashSubscriptBraces = do
    between (symbol "{") (char '}') $ option id $ do
        exp <- ruleExpression; return $ \x -> Syn "{}" [x, exp]
%siblings{};       # exactly the same as %siblings, except
say "%siblings";   # "%siblings"
say "%siblings{}"; # charlie   => donald etc.
Copyright © 2006 Gaal Yahas