Safe Haskell | None |
---|---|
Language | Haskell98 |
UU.Parsing.MachineInterface
Synopsis
- class InputState state s pos | state -> s, state -> pos where
- class OutputState r where
- class Symbol s where
- data Either' state s
- data Steps val s p
- data Action s
- 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 = Msg (Expecting sym) !pos (Action sym)
- data Expecting s
- data SymbolR s
- 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
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
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 # | |
Defined in UU.Parsing.CharParser | |
InputState [s] s (Maybe s) # | |
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 # | |
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 # | |
Defined in UU.Parsing.Offside Methods splitStateE :: OffsideInput inp s p -> Either' (OffsideInput inp s p) (OffsideSymbol s) # splitState :: OffsideInput inp s p -> (#OffsideSymbol s, OffsideInput inp s p#) # getPosition :: OffsideInput inp s p -> p # reportError :: Message (OffsideSymbol s) p -> OffsideInput inp s p -> OffsideInput inp s p # insertSymbol :: OffsideSymbol s -> OffsideInput inp s p -> OffsideInput inp s p # deleteSymbol :: OffsideSymbol s -> OffsideInput inp s p -> OffsideInput inp s p # |
class OutputState r where #
Methods
acceptR :: v -> rest -> r v rest #
nextR :: (a -> rest -> rest') -> (b -> a) -> r b rest -> rest' #
Instances
OutputState Pair # | |
Instances
Symbol Char # | |
Symbol s => Symbol (OffsideSymbol s) # | |
Defined in UU.Parsing.Offside Methods deleteCost :: OffsideSymbol s -> Int# # symBefore :: OffsideSymbol s -> OffsideSymbol s # symAfter :: OffsideSymbol s -> OffsideSymbol s # | |
Symbol (GenToken key tp val) # | |
Instances
Eq s => Eq (Expecting s) # | |
Ord s => Ord (Expecting s) # | |
Defined in UU.Parsing.MachineInterface | |
(Eq s, Show s) => Show (Expecting s) # | |
Instances
Eq s => Eq (SymbolR s) # | |
Ord s => Ord (SymbolR s) # | |
(Eq s, Show s) => Show (SymbolR s) # | |
symInRange :: Ord a => SymbolR a -> a -> Bool #
systemerror :: [Char] -> [Char] -> a #