roundtrip-string-0.1.0.1: Bidirectional (de-)serialization

Safe HaskellNone

Text.Roundtrip.Parser

Synopsis

Documentation

newPos :: SourceName -> Line -> Column -> SourcePos

Create a new SourcePos with the given source name, line number and column number.

initialPos :: SourceName -> SourcePos

Create a new SourcePos with the given source name, and line number and column number set to 1, the upper left.

type PParser s u m = ParsecT s u mSource

parsecApply :: Iso a b -> PParser s u m a -> PParser s u m bSource

parsecConcat :: PParser s u m a -> PParser s u m b -> PParser s u m (a, b)Source

parsecAlternative1Lookahead :: PParser s u m a -> PParser s u m a -> PParser s u m aSource

parsecPure :: a -> PParser s u m aSource

runParser :: Stream s Identity t => Parsec s u a -> u -> SourceName -> s -> Either ParseError a

The most general way to run a parser over the Identity monad. runParser p state filePath input runs parser p on the input list of tokens input, obtained from source filePath with the initial user state st. The filePath is only used in error messages and may be the empty string. Returns either a ParseError (Left) or a value of type a (Right).

  parseFromFile p fname
    = do{ input <- readFile fname
        ; return (runParser p () fname input)
        }