Text.ParserCombinators.ReadPrec

Copyright (c) The University of Glasgow 2002
License BSD-style (see the file libraries/base/LICENSE)
Maintainer [email protected]
Stability provisional
Portability non-portable (uses Text.ParserCombinators.ReadP)
Safe Haskell Trustworthy
Language Haskell2010

Description

This library defines parser combinators for precedence parsing.

data ReadPrec a Source

Precedences

type Prec = Int Source

minPrec :: Prec Source

Precedence operations

lift :: ReadP a -> ReadPrec a Source

Lift a precedence-insensitive ReadP to a ReadPrec.

prec :: Prec -> ReadPrec a -> ReadPrec a Source

(prec n p) checks whether the precedence context is less than or equal to n, and

  • if not, fails
  • if so, parses p in context n.

step :: ReadPrec a -> ReadPrec a Source

Increases the precedence context by one.

reset :: ReadPrec a -> ReadPrec a Source

Resets the precedence context to zero.

Other operations

All are based directly on their similarly-named ReadP counterparts.

get :: ReadPrec Char Source

Consumes and returns the next character. Fails if there is no input left.

look :: ReadPrec String Source

Look-ahead: returns the part of the input that is left, without consuming it.

(+++) :: ReadPrec a -> ReadPrec a -> ReadPrec a Source

Symmetric choice.

(<++) :: ReadPrec a -> ReadPrec a -> ReadPrec a Source

Local, exclusive, left-biased choice: If left parser locally produces any result at all, then right parser is not used.

pfail :: ReadPrec a Source

Always fails.

choice :: [ReadPrec a] -> ReadPrec a Source

Combines all parsers in the specified list.

Converters

readPrec_to_P :: ReadPrec a -> Int -> ReadP a Source

readP_to_Prec :: (Int -> ReadP a) -> ReadPrec a Source

readPrec_to_S :: ReadPrec a -> Int -> ReadS a Source

readS_to_Prec :: (Int -> ReadS a) -> ReadPrec a Source

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/7.10.3/docs/html/libraries/base-4.8.2.0/Text-ParserCombinators-ReadPrec.html