git.iko.soy/typeable/html-parse
on master help sign in
Refactor.
commit315f11fe63d8124c6286757dd7b4690a843a372d authorMatthias Fischmann <mf@zerobuzz.net> dateSat 31 Dec 2016, 09:49 (10 years ago) parent7773524
1 file changed+6−13
Text/HTML/Parser.hs+6−13
Text/HTML/Parser.hs+6−13
@@ -91,32 +91,23 @@ tagOpen =
9191 (char '!' >> markupDeclOpen)
9292 <|> (char '/' >> endTagOpen)
9393 <|> (char '?' >> bogusComment)
94− <|> tryStartTag
94+ <|> tagNameOpen
9595 <|> other
9696 where
97− tryStartTag = do
98− c <- peekChar'
99− guard $ isAsciiUpper c || isAsciiLower c
100− tagNameOpen
101−
10297 other = do
10398 return $ ContentChar '<'
10499
105100-- | /§8.2.4.9/: End tag open state
106101endTagOpen :: Parser Token
107−endTagOpen = do
108− tryEndTag
109− where
110− tryEndTag = do
111− c <- peekChar'
112− guard $ isAsciiUpper c || isAsciiLower c
113− tagNameClose
102+endTagOpen = tagNameClose
114103
115104-- | /§8.2.4.10/: Tag name state: the open case
116105--
117106-- deviation: no lower-casing
118107tagNameOpen :: Parser Token
119108tagNameOpen = do
109+ c <- peekChar'
110+ guard $ isAsciiUpper c || isAsciiLower c
120111 tag <- takeWhile $ notInClass "\x09\x0a\x0c />"
121112 id $ (satisfy (inClass "\x09\x0a\x0c ") >> beforeAttrName tag [])
122113 <|> (char '/' >> selfClosingStartTag tag [])
@@ -127,6 +118,8 @@ tagNameOpen = do
127118-- deviation: no lower-casing
128119tagNameClose :: Parser Token
129120tagNameClose = do
121+ c <- peekChar'
122+ guard $ isAsciiUpper c || isAsciiLower c
130123 tag <- takeWhile $ notInClass "\x09\x0a\x0c />"
131124 char '>' >> return (TagClose tag)
132125