    module UU.Scanner.TokenShow() where

    import UU.Scanner.Token(Token,EnumValToken(..))
    import UU.Scanner.Position(Pos(..))
    import UU.Scanner.GenToken(GenToken(..))

    instance Show Token where
      showsPrec :: Int -> Token -> ShowS
    showsPrec _ token :: Token
    token
        = String -> ShowS
    showString
           (case Token
    token of
             Reserved key :: String
    key      pos :: Pos
    pos -> "symbol "      String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    key String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Pos -> String
    maybeshow Pos
    pos
             ValToken tp :: EnumValToken
    tp val :: String
    val   pos :: Pos
    pos -> EnumValToken -> String
    forall a. Show a => a -> String
    show EnumValToken
    tp String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ " " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ String
    val String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Pos -> String
    maybeshow Pos
    pos
           )
    instance Show EnumValToken where
     show :: EnumValToken -> String
    show tp :: EnumValToken
    tp = case EnumValToken
    tp of
      TkOp         -> "operator"
      TkConOp      -> "con operator"
      TkString     -> "string"
      TkChar       -> "character"
      TkInteger8   -> "octal integer"
      TkInteger10  -> "decimal Integer"
      TkInteger16  -> "hexadecimal integer"
      TkFraction   -> "fraction (float,...)"
      TkVarid      -> "lower case identifier"
      TkConid      -> "upper case identifier"
      TkTextnm     -> "text name"
      TkTextln     -> "text lines"
      TkError      -> "error in scanner:"

    maybeshow :: Pos -> String
    maybeshow :: Pos -> String
    maybeshow (Pos l :: Int
    l c :: Int
    c fn :: String
    fn) | Int
    l Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <= 0 Bool -> Bool -> Bool
    || Int
    c Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    <= 0 =  ""
                           | Bool
    otherwise        =  " at line " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    l
                                              String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ", column " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Int -> String
    forall a. Show a => a -> String
    show Int
    c
                                              String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ " of file " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ShowS
    forall a. Show a => a -> String
    show String
    fn