Erik de Castro Lopo schrieb:
Erik de Castro Lopo wrote:

    qualifiedIdentifier :: CharParser st [ String ]

Ahh, figured it out myself:

    qualifiedIdentifier :: CharParser st [ String ]
    qualifiedIdentifier = do
            i <- identifier
            r <- dotIdentifier
            return (i : r)
        where
        dotIdentifier = do
                char '.'
                i <- identifier
                r <- dotIdentifier
                return (i  : r)
            <|> return []

Does that look sane to people who know Haskell and Parsec
better than  me?
Hi Erik,
have a look at the module Text.ParserCombinators.Parsec.Combinator.
Those functions should help you to build up parsers from smaller building blocks.

Using sepBy1, the above parser can be written as

    dot = T.dot lexer
    qualifiedIdentifier = sepBy1 identifier dot

benedikt
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to