uulib-0.9.15: Haskell Utrecht Tools Library

Safe HaskellNone

UU.Parsing.Machine

Documentation

pDynE :: ParsRec state result s p a -> AnaParser state result s p aSource

pDynL :: ParsRec state result s p a -> AnaParser state result s p aSource

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 t1 t2 t3 t, RealRecogn t1 t2 t3) -> ParsRec t1 result t2 t3 tSource

unP :: RealParser t t1 t2 t3 -> (t3 -> r'' -> r') -> (t -> Steps r'' t1 t2) -> t -> Steps r' t1 t2Source

unR :: RealRecogn t t1 t2 -> (t -> Steps r t1 t2) -> t -> Steps r t1 t2Source

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

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

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

libInsert :: (OutputState result, InputState t t1 t2) => Int# -> t1 -> Expecting t1 -> ParsRec t result t1 t2 t1Source

libSucceed :: OutputState result => t -> ParsRec t1 result t2 t3 tSource

libSeq :: (OutputState result, OutputState t4) => ParsRec t3 t t1 t2 (t5 -> t6) -> ParsRec t3 t4 t1 t2 t5 -> ParsRec t3 result t1 t2 t6Source

libDollar :: OutputState result => (t4 -> t5) -> ParsRec t t1 t2 t3 t4 -> ParsRec t result t2 t3 t5Source

libDollarL :: OutputState result => t5 -> ParsRec t t1 t2 t3 t4 -> ParsRec t result t2 t3 t5Source

libDollarR :: OutputState result => t -> ParsRec t1 t2 t3 t4 t5 -> ParsRec t1 result t3 t4 t5Source

libSeqL :: OutputState result => ParsRec t3 t t1 t2 t6 -> ParsRec t3 t4 t1 t2 t5 -> ParsRec t3 result t1 t2 t6Source

libSeqR :: OutputState result => ParsRec t4 t t1 t2 t3 -> ParsRec t4 t5 t1 t2 t6 -> ParsRec t4 result t1 t2 t6Source

libOr :: (Ord t1, OutputState result) => ParsRec t5 t t1 t2 t4 -> ParsRec t5 t3 t1 t2 t4 -> ParsRec t5 result t1 t2 t4Source

addToMessage :: Ord sym => Message sym pos -> Expecting sym -> Message sym posSource

addexpecting :: Ord s => Expecting s -> Steps val s p -> Steps val s pSource

libBest :: Ord s => Steps b s p -> Steps b s p -> Steps b s pSource

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

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

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

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

(InputState inp s p, OutputState out) => StateParser (AnaParser (inp, st) out s p) st 
(Ord s, Symbol s, InputState state s p, OutputState result) => IsParser (AnaParser state result s p) s

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.

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) 

noOneParser :: OneDescr state result s p aSource

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

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

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

anaDynE :: ParsRec state result s p a -> AnaParser state result s p aSource

anaDynL :: ParsRec state result s p a -> AnaParser state result s p aSource

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

anaSeq :: (Ord s, Symbol s, OutputState t1, OutputState result, InputState state s p) => (t7 -> ParsRec t t1 s t2 t3 -> ParsRec state result s p a) -> (ParsRec t4 t5 s t6 t7 -> ParsRec t t1 s t2 t3 -> ParsRec state result s p a) -> (t7 -> t3 -> a) -> AnaParser t4 t5 s t6 t7 -> AnaParser t t1 s t2 t3 -> AnaParser state result s p aSource

seqZeroZero :: OutputState result => Maybe (Bool, Either t t1) -> Maybe (Bool, Either t2 (ParsRec t3 result t4 t5 t2)) -> (t -> ParsRec t3 result t4 t5 t2 -> b) -> (t1 -> ParsRec t3 result t4 t5 t2 -> b) -> (t -> t2 -> a) -> Maybe (Bool, Either a b)Source

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

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

anaGetFirsts :: AnaParser state result s p a -> Expecting sSource

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

mapOnePars :: (ParsRec t t1 s t2 t3 -> ParsRec state result s p a) -> OneDescr t t1 s t2 t3 -> OneDescr state result s p aSource

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 aSource

data Nat Source

Constructors

Zero 
Succ Nat 
Infinite 

Instances

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

mergeTables :: (Ord t1, Ord a, Symbol a, OutputState t) => [(SymbolR a, ParsRec t4 t t1 t2 t3)] -> [(SymbolR a, ParsRec t4 t t1 t2 t3)] -> [(SymbolR a, ParsRec t4 t t1 t2 t3)]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 bSource

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 bSource

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 bSource

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 bSource

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