packages feed

hunp-0.1: HunpParser.hs

module HunpParser where

import Control.Applicative ((<$>))
import Data.List.Split (splitOn)
import Text.ParserCombinators.Parsec

parser :: GenParser Char st [([String], String)]
parser = sepEndBy line newline

line :: GenParser Char st ([String], String)
line = do
  regex <- filter (not . null) . splitOn "," <$> anyChar `manyTill` char '\t'
  skipMany $ char '\t'
  action <- many $ noneOf "\n"
  return (regex, action)