on master help sign in
SimpleParser: optional combinator added
commitef93607b9d6f653c8a049f9a791c7ea667c102cf authorJürgen Peters <taulmarill@xgn.de> dateSat 31 Aug 2013, 01:12 (13 years ago) parent20d32cc
1 file changed+3
contribs/lib/SimpleParser/SimpleParser.idr+3
contribs/lib/SimpleParser/SimpleParser.idr+3
@@ -154,6 +154,9 @@ strToken = map pack (token (many1 alphanum))
154154-- combinators
155155--------------------------------------------------------------------------------
156156
157+optional : Parser a -> Parser ()
158+optional p = (p $> pure ()) <|> pure ()
159+
157160sepBy1 : Parser a -> Parser b -> Parser (List a)
158161sepBy1 p s = [| p :: many (s $> p) |]
159162