uulib-0.9.23: Haskell Utrecht Tools Library

Safe Haskell | None
Language | Haskell98

UU.Parsing.Machine

# Documentation

pDynE :: ParsRec state result s p a -> AnaParser state result s p a Source #

pDynL :: ParsRec state result s p a -> AnaParser state result s p a Source #

newtype RealParser state s p a Source #

Constructors

P (forall r' r''. (a -> r'' -> r') -> (state -> Steps r'' s p) -> state -> Steps r' s p) |

newtype RealRecogn state s p Source #

Constructors

R (forall r. (state -> Steps r s p) -> state -> Steps r s p) |

newtype RealAccept state result s p a Source #

Constructors

A (forall r. (state -> Steps r s p) -> state -> Steps (result a r) s p) |

newtype ParsRec state result s p a Source #

Constructors

PR (RealParser state s p a, RealRecogn state s p, RealAccept state result s p a) |

mkPR :: OutputState result => (RealParser state s p a, RealRecogn state s p) -> ParsRec state result s p a Source #

unP :: RealParser state s p a -> (a -> r'' -> r') -> (state -> Steps r'' s p) -> state -> Steps r' s p Source #

unR :: RealRecogn state s p -> (state -> Steps r s p) -> state -> Steps r s p Source #

parseRecbasic :: (inp -> Steps (out c d) sym pos) -> ParsRec inp out sym pos a -> inp -> Steps (out a (out c d)) sym pos Source #

parsebasic :: (inp -> Steps (out c d) sym pos) -> AnaParser inp out sym pos a -> inp -> Steps (out a (out c d)) sym pos Source #

libAccept :: (OutputState a, InputState b s p) => ParsRec b a s p s Source #

libInsert :: (OutputState result, InputState state s1 p, InputState state a p, InputState state s2 p) => Int# -> a -> Expecting a -> ParsRec state result a p a Source #

libSucceed :: OutputState result => a -> ParsRec state result s p a Source #

libSeq :: (OutputState result1, OutputState result2) => ParsRec state result3 s p (a1 -> a2) -> ParsRec state result2 s p a1 -> ParsRec state result1 s p a2 Source #

libDollar :: OutputState result1 => (a1 -> a2) -> ParsRec state result2 s p a1 -> ParsRec state result1 s p a2 Source #

libDollarL :: OutputState result1 => a1 -> ParsRec state result2 s p a2 -> ParsRec state result1 s p a1 Source #

libDollarR :: OutputState result1 => p1 -> ParsRec state result2 s p2 a -> ParsRec state result1 s p2 a Source #

libSeqL :: OutputState result1 => ParsRec state result2 s p a1 -> ParsRec state result3 s p a2 -> ParsRec state result1 s p a1 Source #

libSeqR :: OutputState result1 => ParsRec state result2 s p a1 -> ParsRec state result3 s p a2 -> ParsRec state result1 s p a2 Source #

libOr :: (OutputState result1, Ord s) => ParsRec state result2 s p a -> ParsRec state result3 s p a -> ParsRec state result1 s p a Source #

libFail :: OutputState a => ParsRec b a c p d Source #

starting :: Steps a s p -> Expecting s Source #

hasSuccess :: Steps a s p -> Bool Source #

getStart :: Message sym pos -> Expecting sym Source #

addToMessage :: Ord sym => Message sym pos -> Expecting sym -> Message sym pos Source #

addexpecting :: Ord s => Expecting s -> Steps val s p -> Steps val s p Source #

eor :: Ord a => Expecting a -> Expecting a -> Expecting a Source #

libBest :: Ord s => Steps b s p -> Steps b s p -> Steps b s p Source #

libBest' :: Ord s => Steps b s p -> Steps c s p -> (b -> d) -> (c -> d) -> Steps d s p Source #

isTrue :: Int# -> Bool Source #

lib_correct :: Ord s => (b -> c -> Steps d s p) -> (b -> c -> Steps d s p) -> b -> c -> Steps d s p Source #

libCorrect :: Ord s => Steps a s p -> Steps c s p -> (a -> d) -> (c -> d) -> Steps d s p Source #

data ToBeat a Source #

Constructors

ToBeat Int# a |

traverse :: ToBeat (Steps a s p) -> (Steps v s p -> Steps a s p, Steps v s p) -> Int# -> Int# -> ToBeat (Steps a s p) Source #

data AnaParser state result s p a Source #

Constructors

AnaParser |

Fields

- pars :: ParsRec state result s p a
- leng :: Nat
- zerop :: Maybe (Bool, Either a (ParsRec state result s p a))
- onep :: OneDescr state result s p a

Instances

(Ord s, Symbol s, InputState state s p, OutputState result, Applicative (AnaParser state result s p)) => Functor (AnaParser state result s p) Source # |
Instance details Defined in UU.Parsing.Interface Methods fmap :: (a -> b) -> AnaParser state result s p a -> AnaParser state result s p b Source # (<$) :: a -> AnaParser state result s p b -> AnaParser state result s p a Source #
(Ord s, Symbol s, InputState state s p, OutputState result) => Applicative (AnaParser state result s p) Source # |

Instance details

Defined in UU.Parsing.Interface

Methods

pure :: a -> AnaParser state result s p a Source #

(<*>) :: AnaParser state result s p (a -> b) -> AnaParser state result s p a -> AnaParser state result s p b Source #

liftA2 :: (a -> b -> c) -> AnaParser state result s p a -> AnaParser state result s p b -> AnaParser state result s p c Source #

(*>) :: AnaParser state result s p a -> AnaParser state result s p b -> AnaParser state result s p b Source #

(<*) :: AnaParser state result s p a -> AnaParser state result s p b -> AnaParser state result s p a Source #

(Ord s, Symbol s, InputState state s p, OutputState result) => Alternative (AnaParser state result s p) Source # |
Instance details Defined in UU.Parsing.Interface Methods empty :: AnaParser state result s p a Source # (<|>) :: AnaParser state result s p a -> AnaParser state result s p a -> AnaParser state result s p a Source # some :: AnaParser state result s p a -> AnaParser state result s p [a] Source # many :: AnaParser state result s p a -> AnaParser state result s p [a] Source #
(InputState inp s p, OutputState out) => StateParser (AnaParser (inp, st) out s p) st Source # |
Instance details Defined in UU.Parsing.StateParser Methods change :: (st -> st) -> AnaParser (inp, st) out s p st Source # set :: st -> AnaParser (inp, st) out s p st Source # get :: AnaParser (inp, st) out s p st Source #

(Ord s, Symbol s, InputState state s p, OutputState result) => IsParser (AnaParser state result s p) s Source #

The fast `AnaParser` instance of the `IsParser` class. Note that this requires a functioning `Ord` for the symbol type s, as tokens are often compared using the `compare` function in `Ord` rather than always using `==` rom `Eq`. The two do need to be consistent though, that is for any two `x1`, `x2` such that `x1 == x2` you must have `compare x1 x2 == EQ`.

Instance details

Defined in UU.Parsing.Interface

Methods

pSucceed :: a -> AnaParser state result s p a Source #

pLow :: a -> AnaParser state result s p a Source #

pFail :: AnaParser state result s p a Source #

pCostRange :: Int# -> s -> SymbolR s -> AnaParser state result s p s Source #

pCostSym :: Int# -> s -> s -> AnaParser state result s p s Source #

pSym :: s -> AnaParser state result s p s Source #

pRange :: s -> SymbolR s -> AnaParser state result s p s Source #

getfirsts :: AnaParser state result s p v -> Expecting s Source #

setfirsts :: Expecting s -> AnaParser state result s p v -> AnaParser state result s p v Source #

getzerop :: AnaParser state result s p v -> Maybe (AnaParser state result s p v) Source #

getonep :: AnaParser state result s p v -> Maybe (AnaParser state result s p v) Source #

data OneDescr state result s p a Source #

Constructors

OneDescr |

Fields

- firsts :: Expecting s
- table :: [(SymbolR s, TableEntry state result s p a)]

data TableEntry state result s p a Source #

Constructors

TableEntry (ParsRec state result s p a) (Expecting s -> ParsRec state result s p a) |

anaFail :: OutputState a => AnaParser b a c p d Source #

noOneParser :: OneDescr state result s p a Source #

pEmpty :: ParsRec state result s p a -> (Bool, Either a (ParsRec state result s p a)) -> AnaParser state result s p a Source #

anaSucceed :: OutputState result => a -> AnaParser state result s p a Source #

anaLow :: OutputState result => a -> AnaParser state result s p a Source #

anaDynE :: ParsRec state result s p a -> AnaParser state result s p a Source #

anaDynL :: ParsRec state result s p a -> AnaParser state result s p a Source #

anaOr :: (InputState state s p, Symbol s, OutputState result, Ord s) => AnaParser state result s p a -> AnaParser state result s p a -> AnaParser state result s p a Source #

anaSeq :: (InputState state1 s p1, Symbol s, OutputState result1, Ord s, OutputState result2) => (a1 -> ParsRec state2 result2 s p2 a2 -> ParsRec state1 result1 s p1 a3) -> (ParsRec state3 result3 s p3 a1 -> ParsRec state2 result2 s p2 a2 -> ParsRec state1 result1 s p1 a3) -> (a1 -> a2 -> a3) -> AnaParser state3 result3 s p3 a1 -> AnaParser state2 result2 s p2 a2 -> AnaParser state1 result1 s p1 a3 Source #

seqZeroZero :: OutputState result => Maybe (Bool, Either t1 t2) -> Maybe (Bool, Either a1 (ParsRec state result s p a1)) -> (t1 -> ParsRec state result s p a1 -> b) -> (t2 -> ParsRec state result s p a1 -> b) -> (t1 -> a1 -> a2) -> Maybe (Bool, Either a2 b) Source #

orOneOneDescr :: Ord s => OneDescr state result s p a -> OneDescr state result s p a -> Bool -> OneDescr state result s p a Source #

anaCostRange :: (InputState b s p, OutputState a, Symbol s, Ord s) => Int# -> s -> SymbolR s -> AnaParser b a s p s Source #

anaGetFirsts :: AnaParser state result s p a -> Expecting s Source #

anaSetFirsts :: (InputState state s p, Symbol s, Ord s, OutputState result) => Expecting s -> AnaParser state result s p a -> AnaParser state result s p a Source #

mapOnePars :: (ParsRec state1 result1 s p1 a1 -> ParsRec state2 result2 s p2 a2) -> OneDescr state1 result1 s p1 a1 -> OneDescr state2 result2 s p2 a2 Source #

mkParser :: (InputState state s p, Symbol s, Ord s, OutputState result) => Nat -> Maybe (Bool, Either a (ParsRec state result s p a)) -> OneDescr state result s p a -> AnaParser state result s p a Source #

data Nat Source #

Constructors

Zero |
Succ Nat |
Infinite |

Instances

Eq Nat Source # |
Instance details Defined in UU.Parsing.Machine Methods (==) :: Nat -> Nat -> Bool Source # (/=) :: Nat -> Nat -> Bool Source #
Show Nat Source # |
Instance details Defined in UU.Parsing.Machine Methods showsPrec :: Int -> Nat -> ShowS Source # show :: Nat -> String Source # showList :: [Nat] -> ShowS Source #

nat_le :: Nat -> Nat -> Bool Source #

nat_min :: Nat -> Nat -> (Nat, (b -> b -> c) -> b -> b -> c) Source #

nat_add :: Nat -> Nat -> Nat Source #

mergeTables :: (Ord a1, Symbol a1, OutputState result, Ord s) => [(SymbolR a1, ParsRec state result s p a2)] -> [(SymbolR a1, ParsRec state result s p a2)] -> [(SymbolR a1, ParsRec state result s p a2)] Source #

libMap :: OutputState result => (forall r r''. (b -> r -> r'') -> state -> Steps (a, r) s p -> (state, Steps r'' s p)) -> (forall r. state -> Steps r s p -> (state, Steps r s p)) -> ParsRec state result s p a -> ParsRec state result s p b Source #

pMap :: OutputState result => (forall r r''. (b -> r -> r'') -> state -> Steps (a, r) s p -> (state, Steps r'' s p)) -> (forall r. state -> Steps r s p -> (state, Steps r s p)) -> AnaParser state result s p a -> AnaParser state result s p b Source #

libWrap :: OutputState result => (forall r r''. (b -> r -> r'') -> state -> Steps (a, r) s p -> (state -> Steps r s p) -> (state, Steps r'' s p, state -> Steps r s p)) -> (forall r. state -> Steps r s p -> (state -> Steps r s p) -> (state, Steps r s p, state -> Steps r s p)) -> ParsRec state result s p a -> ParsRec state result s p b Source #

pWrap :: OutputState result => (forall r r''. (b -> r -> r'') -> state -> Steps (a, r) s p -> (state -> Steps r s p) -> (state, Steps r'' s p, state -> Steps r s p)) -> (forall r. state -> Steps r s p -> (state -> Steps r s p) -> (state, Steps r s p, state -> Steps r s p)) -> AnaParser state result s p a -> AnaParser state result s p b Source #

lookupSym :: Ord a => BinSearchTree (SymbolR a, b) -> a -> Maybe b Source #