A Peek into Pugs Internals #28

Parsing with parsec - what goes down

ruleHashSubscriptBraces = do
    between start end subscript
    where
    start       = symbol "{"
    end         = char   '}'
    -- try out subscriptExp, but it's okay if it fails
    subscript   = option id subscriptExp
    subscriptExp = do
        exp <- ruleExpression
        return $ \x -> Syn "{}" [x, exp]
Copyright © 2006 Gaal Yahas