{-# LANGUAGE RecordWildCards, PatternGuards #-}
module Text.HTML.TagSoup.Specification(parse) where
import Text.HTML.TagSoup.Implementation
import Data.Char (isAlpha, isAlphaNum, isDigit, toLower)
data TypeTag = TypeNormal
| TypeXml
| TypeDecl
| TypeScript
deriving TypeTag -> TypeTag -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypeTag -> TypeTag -> Bool
$c/= :: TypeTag -> TypeTag -> Bool
== :: TypeTag -> TypeTag -> Bool
$c== :: TypeTag -> TypeTag -> Bool
Eq
white :: Char -> Bool
white Char
x = Char
x forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
" \t\n\f\r"
type Parser = S -> [Out]
parse :: String -> [Out]
parse :: String -> [Out]
parse = Parser
dat forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> S
state
dat :: Parser
dat :: Parser
dat S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'&' -> Parser
charReference S
tl
Char
'<' -> Parser
tagOpen S
tl
Char
_ | Bool
eof -> []
Char
_ -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
charReference :: Parser
charReference S
s = Parser -> Bool -> Maybe Char -> Parser
charRef Parser
dat Bool
False forall a. Maybe a
Nothing S
s
tagOpen :: Parser
tagOpen S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
'!' -> Parser
markupDeclOpen S
tl
Char
'/' -> Parser
closeTagOpen S
tl
Char
_ | Char -> Bool
isAlpha Char
hd -> Out
Tag forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
tagName (if S -> Bool
isScript S
s then TypeTag
TypeScript else TypeTag
TypeNormal) S
tl
Char
'>' -> forall {a}. Show a => a -> Out
errSeen String
"<>" forall a. Outable a => a -> [Out] -> [Out]
& Char
'<' forall a. Outable a => a -> [Out] -> [Out]
& Char
'>' forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
'?' -> Parser
neilXmlTagOpen S
tl
Char
_ -> forall {a}. Show a => a -> Out
errSeen String
"<" forall a. Outable a => a -> [Out] -> [Out]
& Char
'<' forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
isScript :: S -> Bool
isScript = String -> S -> Bool
f String
"script"
where
f :: String -> S -> Bool
f (Char
c:String
cs) S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = Char -> Char
toLower Char
hd forall a. Eq a => a -> a -> Bool
== Char
c Bool -> Bool -> Bool
&& String -> S -> Bool
f String
cs S
tl
f [] S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = Char -> Bool
white Char
hd Bool -> Bool -> Bool
|| Char
hd forall a. Eq a => a -> a -> Bool
== Char
'/' Bool -> Bool -> Bool
|| Char
hd forall a. Eq a => a -> a -> Bool
== Char
'>' Bool -> Bool -> Bool
|| Char
hd forall a. Eq a => a -> a -> Bool
== Char
'?' Bool -> Bool -> Bool
|| Bool
eof
neilXmlTagOpen :: Parser
neilXmlTagOpen S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Char -> Bool
isAlpha Char
hd -> Out
Tag forall a. Outable a => a -> [Out] -> [Out]
& Char
'?' forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
tagName TypeTag
TypeXml S
tl
Char
_ -> forall {a}. Show a => a -> Out
errSeen String
"<?" forall a. Outable a => a -> [Out] -> [Out]
& Char
'<' forall a. Outable a => a -> [Out] -> [Out]
& Char
'?' forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
neilXmlTagClose :: Parser
neilXmlTagClose S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'>' -> Out
TagEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
_ -> forall {a}. Show a => a -> Out
errSeen String
"?" forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
beforeAttName TypeTag
TypeXml S
s
neilTagEnd :: TypeTag -> Parser
neilTagEnd TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..}
| TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ forall {a}. Show a => a -> Out
errWant String
"?>" forall a. Outable a => a -> [Out] -> [Out]
& Out
TagEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
| TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeScript = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ Out
TagEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
neilScriptBody S
s
| Bool
otherwise = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ Out
TagEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
neilScriptBody :: Parser
neilScriptBody o :: S
o@S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..}
| Char
hd forall a. Eq a => a -> a -> Bool
== Char
'<', S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} <- S
tl
, Char
hd forall a. Eq a => a -> a -> Bool
== Char
'/', S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} <- S
tl
, S -> Bool
isScript S
s
= Parser
dat S
o
| Bool
eof = []
| Bool
otherwise = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
neilScriptBody S
tl
closeTagOpen :: Parser
closeTagOpen S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Char -> Bool
isAlpha Char
hd Bool -> Bool -> Bool
|| Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"?!" -> Out
TagShut forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
tagName TypeTag
TypeNormal S
tl
Char
'>' -> forall {a}. Show a => a -> Out
errSeen String
"</>" forall a. Outable a => a -> [Out] -> [Out]
& Char
'<' forall a. Outable a => a -> [Out] -> [Out]
& Char
'/' forall a. Outable a => a -> [Out] -> [Out]
& Char
'>' forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
_ | Bool
eof -> Char
'<' forall a. Outable a => a -> [Out] -> [Out]
& Char
'/' forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> forall {a}. Show a => a -> Out
errWant String
"tag name" forall a. Outable a => a -> [Out] -> [Out]
& Parser
bogusComment S
s
tagName :: TypeTag -> Parser
tagName TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | Char -> Bool
white Char
hd -> TypeTag -> Parser
beforeAttName TypeTag
typ S
tl
Char
'/' -> TypeTag -> Parser
selfClosingStartTag TypeTag
typ S
tl
Char
'>' -> TypeTag -> Parser
neilTagEnd TypeTag
typ S
tl
Char
'?' | TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml -> Parser
neilXmlTagClose S
tl
Char
_ | Char -> Bool
isAlpha Char
hd -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
tagName TypeTag
typ S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant (if TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml then String
"?>" else String
">") forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
tagName TypeTag
typ S
tl
beforeAttName :: TypeTag -> Parser
beforeAttName TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | Char -> Bool
white Char
hd -> TypeTag -> Parser
beforeAttName TypeTag
typ S
tl
Char
'/' -> TypeTag -> Parser
selfClosingStartTag TypeTag
typ S
tl
Char
'>' -> TypeTag -> Parser
neilTagEnd TypeTag
typ S
tl
Char
'?' | TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml -> Parser
neilXmlTagClose S
tl
Char
_ | TypeTag
typ forall a. Eq a => a -> a -> Bool
/= TypeTag
TypeNormal Bool -> Bool -> Bool
&& Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"\'\"" -> TypeTag -> Parser
beforeAttValue TypeTag
typ S
s
Char
_ | Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"\"'<=" -> forall {a}. Show a => a -> Out
errSeen [Char
hd] forall a. Outable a => a -> [Out] -> [Out]
& Out
AttName forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attName TypeTag
typ S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant (if TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml then String
"?>" else String
">") forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Out
AttName forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attName TypeTag
typ S
tl
attName :: TypeTag -> Parser
attName TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | Char -> Bool
white Char
hd -> TypeTag -> Parser
afterAttName TypeTag
typ S
tl
Char
'/' -> TypeTag -> Parser
selfClosingStartTag TypeTag
typ S
tl
Char
'=' -> TypeTag -> Parser
beforeAttValue TypeTag
typ S
tl
Char
'>' -> TypeTag -> Parser
neilTagEnd TypeTag
typ S
tl
Char
'?' | TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml -> Parser
neilXmlTagClose S
tl
Char
_ | Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"\"'<" -> forall {a}. Show a => a -> Out
errSeen [Char
hd] forall a. Outable a => a -> [Out] -> [Out]
& [Out]
def
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant (if TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml then String
"?>" else String
">") forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> [Out]
def
where def :: [Out]
def = Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attName TypeTag
typ S
tl
afterAttName :: TypeTag -> Parser
afterAttName TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | Char -> Bool
white Char
hd -> TypeTag -> Parser
afterAttName TypeTag
typ S
tl
Char
'/' -> TypeTag -> Parser
selfClosingStartTag TypeTag
typ S
tl
Char
'=' -> TypeTag -> Parser
beforeAttValue TypeTag
typ S
tl
Char
'>' -> TypeTag -> Parser
neilTagEnd TypeTag
typ S
tl
Char
'?' | TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml -> Parser
neilXmlTagClose S
tl
Char
_ | TypeTag
typ forall a. Eq a => a -> a -> Bool
/= TypeTag
TypeNormal Bool -> Bool -> Bool
&& Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"\"'" -> Out
AttVal forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
beforeAttValue TypeTag
typ S
s
Char
_ | Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"\"'<" -> forall {a}. Show a => a -> Out
errSeen [Char
hd] forall a. Outable a => a -> [Out] -> [Out]
& [Out]
def
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant (if TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml then String
"?>" else String
">") forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> [Out]
def
where def :: [Out]
def = Out
AttName forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attName TypeTag
typ S
tl
beforeAttValue :: TypeTag -> Parser
beforeAttValue TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | Char -> Bool
white Char
hd -> TypeTag -> Parser
beforeAttValue TypeTag
typ S
tl
Char
'\"' -> Out
AttVal forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attValueDQuoted TypeTag
typ S
tl
Char
'&' -> Out
AttVal forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attValueUnquoted TypeTag
typ S
s
Char
'\'' -> Out
AttVal forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attValueSQuoted TypeTag
typ S
tl
Char
'>' -> forall {a}. Show a => a -> Out
errSeen String
"=" forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
neilTagEnd TypeTag
typ S
tl
Char
'?' | TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml -> Parser
neilXmlTagClose S
tl
Char
_ | Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"<=" -> forall {a}. Show a => a -> Out
errSeen [Char
hd] forall a. Outable a => a -> [Out] -> [Out]
& [Out]
def
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant (if TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml then String
"?>" else String
">") forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> [Out]
def
where def :: [Out]
def = Out
AttVal forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attValueUnquoted TypeTag
typ S
tl
attValueDQuoted :: TypeTag -> Parser
attValueDQuoted TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'\"' -> TypeTag -> Parser
afterAttValueQuoted TypeTag
typ S
tl
Char
'&' -> Parser -> Maybe Char -> Parser
charRefAttValue (TypeTag -> Parser
attValueDQuoted TypeTag
typ) (forall a. a -> Maybe a
Just Char
'\"') S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"\"" forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attValueDQuoted TypeTag
typ S
tl
attValueSQuoted :: TypeTag -> Parser
attValueSQuoted TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'\'' -> TypeTag -> Parser
afterAttValueQuoted TypeTag
typ S
tl
Char
'&' -> Parser -> Maybe Char -> Parser
charRefAttValue (TypeTag -> Parser
attValueSQuoted TypeTag
typ) (forall a. a -> Maybe a
Just Char
'\'') S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"\'" forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attValueSQuoted TypeTag
typ S
tl
attValueUnquoted :: TypeTag -> Parser
attValueUnquoted TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | Char -> Bool
white Char
hd -> TypeTag -> Parser
beforeAttName TypeTag
typ S
tl
Char
'&' -> Parser -> Maybe Char -> Parser
charRefAttValue (TypeTag -> Parser
attValueUnquoted TypeTag
typ) forall a. Maybe a
Nothing S
tl
Char
'>' -> TypeTag -> Parser
neilTagEnd TypeTag
typ S
tl
Char
'?' | TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml -> Parser
neilXmlTagClose S
tl
Char
_ | Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"\"'<=" -> forall {a}. Show a => a -> Out
errSeen [Char
hd] forall a. Outable a => a -> [Out] -> [Out]
& [Out]
def
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant (if TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml then String
"?>" else String
">") forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> [Out]
def
where def :: [Out]
def = Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
attValueUnquoted TypeTag
typ S
tl
charRefAttValue :: Parser -> Maybe Char -> Parser
charRefAttValue :: Parser -> Maybe Char -> Parser
charRefAttValue Parser
resume Maybe Char
c S
s = Parser -> Bool -> Maybe Char -> Parser
charRef Parser
resume Bool
True Maybe Char
c S
s
afterAttValueQuoted :: TypeTag -> Parser
afterAttValueQuoted TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | Char -> Bool
white Char
hd -> TypeTag -> Parser
beforeAttName TypeTag
typ S
tl
Char
'/' -> TypeTag -> Parser
selfClosingStartTag TypeTag
typ S
tl
Char
'>' -> TypeTag -> Parser
neilTagEnd TypeTag
typ S
tl
Char
'?' | TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml -> Parser
neilXmlTagClose S
tl
Char
_ | Bool
eof -> Parser
dat S
s
Char
_ -> forall {a}. Show a => a -> Out
errSeen [Char
hd] forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
beforeAttName TypeTag
typ S
s
selfClosingStartTag :: TypeTag -> Parser
selfClosingStartTag TypeTag
typ S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | TypeTag
typ forall a. Eq a => a -> a -> Bool
== TypeTag
TypeXml -> forall {a}. Show a => a -> Out
errSeen String
"/" forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
beforeAttName TypeTag
typ S
s
Char
'>' -> Out
TagEndClose forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
">" forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> forall {a}. Show a => a -> Out
errSeen String
"/" forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
beforeAttName TypeTag
typ S
s
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = Out
Comment forall a. Outable a => a -> [Out] -> [Out]
& Parser
bogusComment1 S
s
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'>' -> Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
_ | Bool
eof -> Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
bogusComment1 S
tl
markupDeclOpen :: Parser
markupDeclOpen S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Just S
s <- String -> Maybe S
next String
"--" -> Out
Comment forall a. Outable a => a -> [Out] -> [Out]
& Parser
commentStart S
s
Char
_ | Char -> Bool
isAlpha Char
hd -> Out
Tag forall a. Outable a => a -> [Out] -> [Out]
& Char
'!' forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& TypeTag -> Parser
tagName TypeTag
TypeDecl S
tl
Char
_ | Just S
s <- String -> Maybe S
next String
"[CDATA[" -> Parser
cdataSection S
s
Char
_ -> forall {a}. Show a => a -> Out
errWant String
"tag name" forall a. Outable a => a -> [Out] -> [Out]
& Parser
bogusComment S
s
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'-' -> Parser
commentStartDash S
tl
Char
'>' -> forall {a}. Show a => a -> Out
errSeen String
"<!-->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"-->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
comment S
tl
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'-' -> Parser
commentEnd S
tl
Char
'>' -> forall {a}. Show a => a -> Out
errSeen String
"<!--->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"-->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
comment S
tl
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'-' -> Parser
commentEndDash S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"-->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
comment S
tl
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'-' -> Parser
commentEnd S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"-->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
comment S
tl
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'>' -> Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
'-' -> forall {a}. Show a => a -> Out
errWant String
"-->" forall a. Outable a => a -> [Out] -> [Out]
& Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Parser
commentEnd S
tl
Char
_ | Char -> Bool
white Char
hd -> forall {a}. Show a => a -> Out
errSeen String
"--" forall a. Outable a => a -> [Out] -> [Out]
& Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
commentEndSpace S
tl
Char
'!' -> forall {a}. Show a => a -> Out
errSeen String
"!" forall a. Outable a => a -> [Out] -> [Out]
& Parser
commentEndBang S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"-->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> forall {a}. Show a => a -> Out
errSeen String
"--" forall a. Outable a => a -> [Out] -> [Out]
& Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
comment S
tl
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'>' -> Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
'-' -> Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
'!' forall a. Outable a => a -> [Out] -> [Out]
& Parser
commentEndDash S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"-->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
'-' forall a. Outable a => a -> [Out] -> [Out]
& Char
'!' forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
comment S
tl
S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
'>' -> Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
tl
Char
'-' -> Parser
commentEndDash S
tl
Char
_ | Char -> Bool
white Char
hd -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
commentEndSpace S
tl
Char
_ | Bool
eof -> forall {a}. Show a => a -> Out
errWant String
"-->" forall a. Outable a => a -> [Out] -> [Out]
& Out
CommentEnd forall a. Outable a => a -> [Out] -> [Out]
& Parser
dat S
s
Char
_ -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
comment S
tl
cdataSection :: Parser
cdataSection S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = [Out] -> [Out]
pos forall a b. (a -> b) -> a -> b
$ case Char
hd of
Char
_ | Just S
s <- String -> Maybe S
next String
"]]>" -> Parser
dat S
s
Char
_ | Bool
eof -> Parser
dat S
s
Char
_ | Bool
otherwise -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser
cdataSection S
tl
charRef :: Parser -> Bool -> Maybe Char -> S -> [Out]
charRef :: Parser -> Bool -> Maybe Char -> Parser
charRef Parser
resume Bool
att Maybe Char
end S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Bool
eof Bool -> Bool -> Bool
|| Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"\t\n\f <&" Bool -> Bool -> Bool
|| forall b a. b -> (a -> b) -> Maybe a -> b
maybe Bool
False (forall a. Eq a => a -> a -> Bool
== Char
hd) Maybe Char
end -> Char
'&' forall a. Outable a => a -> [Out] -> [Out]
& Parser
resume S
s
Char
'#' -> Parser -> S -> Parser
charRefNum Parser
resume S
s S
tl
Char
_ -> Parser -> Bool -> Parser
charRefAlpha Parser
resume Bool
att S
s
charRefNum :: Parser -> S -> Parser
charRefNum Parser
resume S
o S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Char
hd forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
"xX" -> Parser -> S -> Bool -> Parser
charRefNum2 Parser
resume S
o Bool
True S
tl
Char
_ -> Parser -> S -> Bool -> Parser
charRefNum2 Parser
resume S
o Bool
False S
s
charRefNum2 :: Parser -> S -> Bool -> Parser
charRefNum2 Parser
resume S
o Bool
hex S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Bool -> Char -> Bool
hexChar Bool
hex Char
hd -> (if Bool
hex then Out
EntityHex else Out
EntityNum) forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser -> Bool -> Parser
charRefNum3 Parser
resume Bool
hex S
tl
Char
_ -> forall {a}. Show a => a -> Out
errSeen String
"&" forall a. Outable a => a -> [Out] -> [Out]
& Char
'&' forall a. Outable a => a -> [Out] -> [Out]
& Parser
resume S
o
charRefNum3 :: Parser -> Bool -> Parser
charRefNum3 Parser
resume Bool
hex S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Bool -> Char -> Bool
hexChar Bool
hex Char
hd -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser -> Bool -> Parser
charRefNum3 Parser
resume Bool
hex S
tl
Char
';' -> Bool -> Out
EntityEnd Bool
True forall a. Outable a => a -> [Out] -> [Out]
& Parser
resume S
tl
Char
_ -> Bool -> Out
EntityEnd Bool
False forall a. Outable a => a -> [Out] -> [Out]
& forall {a}. Show a => a -> Out
errWant String
";" forall a. Outable a => a -> [Out] -> [Out]
& Parser
resume S
s
charRefAlpha :: Parser -> Bool -> Parser
charRefAlpha Parser
resume Bool
att S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Char -> Bool
isAlpha Char
hd -> Out
EntityName forall a. Outable a => a -> [Out] -> [Out]
& Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser -> Bool -> Parser
charRefAlpha2 Parser
resume Bool
att S
tl
Char
_ -> forall {a}. Show a => a -> Out
errSeen String
"&" forall a. Outable a => a -> [Out] -> [Out]
& Char
'&' forall a. Outable a => a -> [Out] -> [Out]
& Parser
resume S
s
charRefAlpha2 :: Parser -> Bool -> Parser
charRefAlpha2 Parser
resume Bool
att S{Bool
Char
S
String -> Maybe S
[Out] -> [Out]
pos :: [Out] -> [Out]
next :: String -> Maybe S
eof :: Bool
hd :: Char
tl :: S
s :: S
pos :: S -> [Out] -> [Out]
next :: S -> String -> Maybe S
eof :: S -> Bool
hd :: S -> Char
tl :: S -> S
s :: S -> S
..} = case Char
hd of
Char
_ | Char -> Bool
alphaChar Char
hd -> Char
hd forall a. Outable a => a -> [Out] -> [Out]
& Parser -> Bool -> Parser
charRefAlpha2 Parser
resume Bool
att S
tl
Char
';' -> Bool -> Out
EntityEnd Bool
True forall a. Outable a => a -> [Out] -> [Out]
& Parser
resume S
tl
Char
_ | Bool
att -> Bool -> Out
EntityEnd Bool
False forall a. Outable a => a -> [Out] -> [Out]
& Parser
resume S
s
Char
_ -> Bool -> Out
EntityEnd Bool
False forall a. Outable a => a -> [Out] -> [Out]
& forall {a}. Show a => a -> Out
errWant String
";" forall a. Outable a => a -> [Out] -> [Out]
& Parser
resume S
s
alphaChar :: Char -> Bool
alphaChar Char
x = Char -> Bool
isAlphaNum Char
x Bool -> Bool -> Bool
|| Char
x forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
":-_"
hexChar :: Bool -> Char -> Bool
hexChar Bool
False Char
x = Char -> Bool
isDigit Char
x
hexChar Bool
True Char
x = Char -> Bool
isDigit Char
x Bool -> Bool -> Bool
|| (Char
x forall a. Ord a => a -> a -> Bool
>= Char
'a' Bool -> Bool -> Bool
&& Char
x forall a. Ord a => a -> a -> Bool
<= Char
'f') Bool -> Bool -> Bool
|| (Char
x forall a. Ord a => a -> a -> Bool
>= Char
'A' Bool -> Bool -> Bool
&& Char
x forall a. Ord a => a -> a -> Bool
<= Char
'F')