From b9494feebfabec0db65ee1b0e77cbd2d0d740470 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Tue, 9 Apr 2019 23:28:58 +0200 Subject: Fix parser (lambdas and quotes in names) --- src/Haskell/Parser.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Haskell') diff --git a/src/Haskell/Parser.hs b/src/Haskell/Parser.hs index dcee39e..41216d5 100644 --- a/src/Haskell/Parser.hs +++ b/src/Haskell/Parser.hs @@ -43,6 +43,7 @@ pExpr = pLam <|> pCase <|> pApp pLam = do symbolO "\\" args <- many1 pNameV + symbolO "->" body <- pExpr return $ Lam args body @@ -93,7 +94,7 @@ pNameT :: Parser Name pNameT = notReserved $ liftM2 (:) (satisfy isUpper) pNameRest pNameRest :: Parser Name -pNameRest = many (satisfy $ \d -> isAlphaNum d || d == '_') <* aheadW +pNameRest = many (satisfy $ \d -> isAlphaNum d || d `elem` "_'") <* aheadW notReserved :: Parser Name -> Parser Name notReserved p = @@ -120,7 +121,7 @@ symbolBare s = string s >> whitespace aheadW :: Parser () aheadW = do - void (lookAhead (space <|> satisfy (\d -> not (isAlphaNum d) && d /= '_'))) <|> eof + void (lookAhead (space <|> satisfy (\d -> not (isAlphaNum d) && d `notElem` "_'"))) <|> eof whitespace aheadO :: Parser () -- cgit v1.2.3-70-g09d2