Fixed tag-parsing
    
    
      
        Getty Ritter
        10 years ago
      
    
    
  
  
  | 54 | 54 | pTagName :: Parse String | 
| 55 | 55 | pTagName s = go s `bind` ensureLen | 
| 56 | 56 | 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 | |
| 59 | 59 | | otherwise = return (i, "") | 
| 60 | 60 | go [] = throw "unexpected end-of-document while parsing tag" | 
| 61 | 61 | ensureLen (xs, name) | 
| 62 | 62 | | length name > 0 = return (xs, name) | 
| 63 | 
                            | otherwise       = throw  | 
              |
| 63 | | otherwise = throw $ "expected tag name after `\\': " ++ show (name, xs) | |
| 64 | 64 | |
| 65 | 65 | -- Skip any space charaters, returning () for the first non-space | 
| 66 | 66 | -- character (including EOF). |