From 7aa09be0797c8d73a28dc43962f1cbf1ea0c5b46 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 23 Jun 2016 12:03:24 +0200 Subject: [PATCH] mooie seplist --- examples/print.spl | 3 +++ parse.icl | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 examples/print.spl diff --git a/examples/print.spl b/examples/print.spl new file mode 100644 index 0000000..058348c --- /dev/null +++ b/examples/print.spl @@ -0,0 +1,3 @@ +main(){ + print(1, 2, 3, 4, 5); +} diff --git a/parse.icl b/parse.icl index a6374c1..ebfc7a0 100644 --- a/parse.icl +++ b/parse.icl @@ -243,10 +243,9 @@ tokEq (StringToken _) (StringToken _) = True tokEq x y = gEq {|*|} x y parseSepList :: TokenValue (Parser Token a) -> Parser Token [a] -parseSepList sep p = - (p <* satTok sep >>= \v1-> parseSepList sep p >>= \vs -> pure [v1:vs]) - <|> (p >>= \v-> pure [v]) - <|> pure [] +parseSepList sep p = pSL` sep p <|> pure [] + where + pSL` sep p = (p <* satTok sep >>= \v1->parseSepList sep p >>= \vs->pure [v1:vs]) <|> (p >>= \v->pure [v]) parseIdent :: Parser Token String parseIdent = trans2 (IdentToken "") (\(IdentToken e)->toString e) -- 2.20.1