uulib-0.9.23: Haskell Utrecht Tools Library

Safe HaskellNone
LanguageHaskell98

UU.Parsing.MachineInterface

Synopsis

Documentation

class InputState state s pos | state -> s, state -> pos where #

The InputState class contains the interface that the AnaParser parsers expect for the input. A minimal complete instance definition consists of splitStateE, splitState and getPosition.

Minimal complete definition

splitStateE, splitState, getPosition

Methods

splitStateE :: state -> Either' state s #

Splits the state in a strict variant of Either, with Left' if a symbol can be split off and Right' if none can

splitState :: state -> (#s, state#) #

Splits the state in the first symbol and the remaining state

getPosition :: state -> pos #

Gets the current position in the input

reportError :: Message s pos -> state -> state #

Reports an error

insertSymbol :: s -> state -> state #

Modify the state as the result of inserting a symbol s in the input. The symbol that has already been considered as having been inserted is passed. It should normally not be added to the state.

deleteSymbol :: s -> state -> state #

Modify the state as the result of deleting a symbol s from the input. The symbol that has already been deleted from the input state is passed. It should normally not be deleted from the state.

Instances
InputState Input Char Pos # 
Instance details

Defined in UU.Parsing.CharParser

InputState [s] s (Maybe s) # 
Instance details

Defined in UU.Parsing.Interface

Methods

splitStateE :: [s] -> Either' [s] s #

splitState :: [s] -> (#s, [s]#) #

getPosition :: [s] -> Maybe s #

reportError :: Message s (Maybe s) -> [s] -> [s] #

insertSymbol :: s -> [s] -> [s] #

deleteSymbol :: s -> [s] -> [s] #

InputState inp s p => InputState (inp, state) s p # 
Instance details

Defined in UU.Parsing.StateParser

Methods

splitStateE :: (inp, state) -> Either' (inp, state) s #

splitState :: (inp, state) -> (#s, (inp, state)#) #

getPosition :: (inp, state) -> p #

reportError :: Message s p -> (inp, state) -> (inp, state) #

insertSymbol :: s -> (inp, state) -> (inp, state) #

deleteSymbol :: s -> (inp, state) -> (inp, state) #

InputState inp s p => InputState (OffsideInput inp s p) (OffsideSymbol s) p # 
Instance details

Defined in UU.Parsing.Offside

class OutputState r where #

Minimal complete definition

acceptR, nextR

Methods

acceptR :: v -> rest -> r v rest #

nextR :: (a -> rest -> rest') -> (b -> a) -> r b rest -> rest' #

Instances
OutputState Pair # 
Instance details

Defined in UU.Parsing.Interface

Methods

acceptR :: v -> rest -> Pair v rest #

nextR :: (a -> rest -> rest') -> (b -> a) -> Pair b rest -> rest' #

class Symbol s where #

Methods

deleteCost :: s -> Int# #

symBefore :: s -> s #

symAfter :: s -> s #

Instances
Symbol Char # 
Instance details

Defined in UU.Parsing.CharParser

Symbol s => Symbol (OffsideSymbol s) # 
Instance details

Defined in UU.Parsing.Offside

Symbol (GenToken key tp val) # 
Instance details

Defined in UU.Scanner.GenTokenSymbol

Methods

deleteCost :: GenToken key tp val -> Int# #

symBefore :: GenToken key tp val -> GenToken key tp val #

symAfter :: GenToken key tp val -> GenToken key tp val #

data Either' state s #

Constructors

Left' !s state 
Right' state 

data Steps val s p #

Constructors

OkVal (a -> val) (Steps a s p) 
Ok 

Fields

Cost 

Fields

StRepair 

Fields

Best (Steps val s p) (Steps val s p) (Steps val s p) 
NoMoreSteps val 

data Action s #

Constructors

Insert s 
Delete s 
Other String 
Instances
Show s => Show (Action s) # 
Instance details

Defined in UU.Parsing.MachineInterface

Methods

showsPrec :: Int -> Action s -> ShowS #

show :: Action s -> String #

showList :: [Action s] -> ShowS #

val :: (a -> b) -> Steps a s p -> Steps b s p #

evalSteps :: Steps a s p -> a #

getMsgs :: Steps a s p -> [Message s p] #

data Message sym pos #

Constructors

Msg (Expecting sym) !pos (Action sym) 
Instances
(Eq s, Show s, Show p) => Show (Message s p) # 
Instance details

Defined in UU.Parsing.MachineInterface

Methods

showsPrec :: Int -> Message s p -> ShowS #

show :: Message s p -> String #

showList :: [Message s p] -> ShowS #

data Expecting s #

Constructors

ESym (SymbolR s) 
EStr String 
EOr [Expecting s] 
ESeq [Expecting s] 
Instances
Eq s => Eq (Expecting s) # 
Instance details

Defined in UU.Parsing.MachineInterface

Methods

(==) :: Expecting s -> Expecting s -> Bool #

(/=) :: Expecting s -> Expecting s -> Bool #

Ord s => Ord (Expecting s) # 
Instance details

Defined in UU.Parsing.MachineInterface

(Eq s, Show s) => Show (Expecting s) # 
Instance details

Defined in UU.Parsing.MachineInterface

data SymbolR s #

Constructors

Range !s !s 
EmptyR 
Instances
Eq s => Eq (SymbolR s) # 
Instance details

Defined in UU.Parsing.MachineInterface

Methods

(==) :: SymbolR s -> SymbolR s -> Bool #

(/=) :: SymbolR s -> SymbolR s -> Bool #

Ord s => Ord (SymbolR s) # 
Instance details

Defined in UU.Parsing.MachineInterface

Methods

compare :: SymbolR s -> SymbolR s -> Ordering #

(<) :: SymbolR s -> SymbolR s -> Bool #

(<=) :: SymbolR s -> SymbolR s -> Bool #

(>) :: SymbolR s -> SymbolR s -> Bool #

(>=) :: SymbolR s -> SymbolR s -> Bool #

max :: SymbolR s -> SymbolR s -> SymbolR s #

min :: SymbolR s -> SymbolR s -> SymbolR s #

(Eq s, Show s) => Show (SymbolR s) # 
Instance details

Defined in UU.Parsing.MachineInterface

Methods

showsPrec :: Int -> SymbolR s -> ShowS #

show :: SymbolR s -> String #

showList :: [SymbolR s] -> ShowS #

mk_range :: Ord s => s -> s -> SymbolR s #

symInRange :: Ord a => SymbolR a -> a -> Bool #

symRS :: Ord a => SymbolR a -> a -> Ordering #

except :: (Foldable t, Ord s, Symbol s) => SymbolR s -> t s -> [SymbolR s] #

usererror :: [Char] -> a #

systemerror :: [Char] -> [Char] -> a #