parsimony-1: Monadic parser combinators derived from Parsec

Stabilityprovisional
Maintaineriavor.diatchki@gmail.com

Parsimony.UserState

Description

Support for parsers with custom state.

Synopsis

Documentation

type ParserU u s = Parser (UserState u s)Source

The type of parsers with a user state.

data UserState user stream Source

An input stream annotated with some user state.

Constructors

UserState 

Fields

userState :: !user
 
parserStream :: !stream
 

Instances

Stream stream token => Stream (UserState user stream) token 

lifted :: Parser s a -> ParserU u s aSource

Turn a parser without user space into ine that supports user state manipulation.

getUserState :: ParserU u s uSource

Get the user state.

setUserState :: u -> ParserU u s ()Source

Set the user state.

updateUserState :: (u -> u) -> ParserU u s ()Source

Update the user state.

uparse :: ParserU u s a -> u -> s -> Either ParseError aSource