gdritter repos telml / c6bb8af
Fixed tag-parsing Getty Ritter 9 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Collapse all Expand all
5454 pTagName :: Parse String
5555 pTagName s = go s `bind` ensureLen
5656 where go i@(x:xs)
57 | isAlpha x = (x:) `over` pTagName xs
58 | elem x "-_" = (x:) `over` pTagName xs
57 | isAlpha x = (x:) `over` go xs
58 | elem x "-_" = (x:) `over` go xs
5959 | otherwise = return (i, "")
6060 go [] = throw "unexpected end-of-document while parsing tag"
6161 ensureLen (xs, name)
6262 | length name > 0 = return (xs, name)
63 | otherwise = throw "expected tag name after `\\'"
63 | otherwise = throw $ "expected tag name after `\\': " ++ show (name, xs)
6464
6565 -- Skip any space charaters, returning () for the first non-space
6666 -- character (including EOF).