module UHC.Light.Compiler.Scanner.Scanner
( module UHC.Light.Compiler.Scanner.Machine, module UHC.Light.Compiler.Scanner.Token, module UHC.Light.Compiler.Scanner.TokenParser, module UU.Scanner.Position )
where
import Data.List
import UHC.Light.Compiler.Scanner.Machine
import UHC.Light.Compiler.Scanner.Token
import UHC.Light.Compiler.Scanner.TokenParser
import UU.Scanner.Position
import UU.Scanner.GenTokenOrd ()
import UU.Scanner.GenTokenSymbol ()
instance Show Token where
showsPrec _ token
= showString
(case token of
Reserved key pos -> "symbol " ++ key ++ maybeshow pos
ValToken tp val pos -> show tp ++ " " ++ concat (intersperse "." val) ++ maybeshow pos
)
instance Show EnumValToken where
show tp = case tp of
TkVarid -> "lower case identifier"
TkConid -> "upper case identifier"
TkOp -> "operator"
TkConOp -> "con operator"
TkQOp -> "qualified operator"
TkQVarid -> "lower case qualified identifier"
TkQConid -> "upper case qualified identifier"
TkQConOp -> "qualified con operator"
TkString -> "string"
TkChar -> "character"
TkInteger8 -> "octal integer"
TkInteger10 -> "decimal Integer"
TkInteger16 -> "hexadecimal integer"
TkFraction -> "fraction (float,...)"
TkTextnm -> "text name"
TkTextln -> "text lines"
TkError -> "error in scanner:"
maybeshow :: Pos -> String
maybeshow (Pos l c fn) | l <= 0 || c <= 0 = ""
| otherwise = " at line " ++ show l
++ ", column " ++ show c
++ " of file " ++ show fn