Skip to content

Instantly share code, notes, and snippets.

@adamczykm
Created July 20, 2015 23:46
Show Gist options
  • Save adamczykm/e3ee332f59e22d1a9bba to your computer and use it in GitHub Desktop.
Save adamczykm/e3ee332f59e22d1a9bba to your computer and use it in GitHub Desktop.
parseXmark :: Parser L.Text
parseXmark = (L.strip . L.pack) <$>
(char '<' *> spaces
*> (many $ noneOf ">") <*
char '>' <* spaces)
parseLit :: T.Text -> Parser Xexpr
parseLit endMark = (Lit . T.strip . T.pack) <$> (spaces *>
(manyTill anyChar
(try (string ("</" ++ T.unpack endMark ++ ">")))))
parseSubs :: T.Text -> Parser Xexpr
parseSubs endMark = Subs <$>
manyTill (parseXexpr <* spaces)
(try (string ("</" ++ T.unpack endMark ++ ">")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment