module UU.Parsing( module UU.Parsing.Derived
                 , module UU.Parsing.Interface
                 , parseIO
                 ) where

import UU.Parsing.Derived
import UU.Parsing.Interface

parseIO :: (Eq s, Show s, Symbol s) => Parser s a -> [s] -> IO a
parseIO :: forall s a. (Eq s, Show s, Symbol s) => Parser s a -> [s] -> IO a
parseIO = (Message s (Maybe s) -> String)
-> AnaParser [s] Pair s (Maybe s) a -> [s] -> IO a
forall s inp p a.
(Symbol s, InputState inp s p) =>
(Message s p -> String) -> AnaParser inp Pair s p a -> inp -> IO a
parseIOMessage Message s (Maybe s) -> String
forall {sym} {a}.
(Eq sym, Show a, Show sym) =>
Message sym (Maybe a) -> String
showMessage 
  where showMessage :: Message sym (Maybe a) -> String
showMessage (Msg Expecting sym
expecting Maybe a
position Action sym
action)  
          =  let pos :: String
pos = case Maybe a
position of
                           Maybe a
Nothing -> String
"at end of file"
                           Just a
s  -> case Action sym
action of 
                                Insert sym
_ -> String
"before " String -> String -> String
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
s
                                Delete sym
t -> String
"at " String -> String -> String
forall a. [a] -> [a] -> [a]
++ sym -> String
forall a. Show a => a -> String
show sym
t  
             in String
"\n?? Error      : " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pos String -> String -> String
forall a. [a] -> [a] -> [a]
++
                String
"\n?? Expecting  : " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Expecting sym -> String
forall a. Show a => a -> String
show Expecting sym
expecting String -> String -> String
forall a. [a] -> [a] -> [a]
++
                String
"\n?? Repaired by: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Action sym -> String
forall a. Show a => a -> String
show Action sym
action String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"