From c550b6bbe1fa3768483adc25b77f2a816ef56a60 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 5 Jun 2019 15:44:04 -0400 Subject: [PATCH] Just use expressions. --- src/Language/Python/Assignment.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Language/Python/Assignment.hs b/src/Language/Python/Assignment.hs index b18a0426e..6c0a4dcc8 100644 --- a/src/Language/Python/Assignment.hs +++ b/src/Language/Python/Assignment.hs @@ -253,7 +253,7 @@ forStatement = symbol ForStatement >>= \ loc -> children (make loc <$> (symbol V Just a -> makeTerm loc (Statement.Else (makeTerm loc $ Statement.ForEach binding subject body) a) whileStatement :: Assignment Term -whileStatement = symbol WhileStatement >>= \ loc -> children (make loc <$> term expression <*> block <*> optional (symbol ElseClause *> children expressions)) +whileStatement = symbol WhileStatement >>= \ loc -> children (make loc <$> term expression <*> expressions <*> optional (symbol ElseClause *> children expressions)) where make loc whileCondition whileBody whileElseClause = case whileElseClause of Nothing -> makeTerm loc (Statement.While whileCondition whileBody) @@ -279,8 +279,8 @@ functionParam = (makeParameter <$> location <*> identifier) functionDefinition :: Assignment Term functionDefinition = - makeFunctionDeclaration <$> symbol FunctionDefinition <*> children ((,,,) <$> term expression <* symbol Parameters <*> children (manyTerm functionParam) <*> optional (symbol Type *> children (term expression)) <*> block) - <|> makeFunctionDeclaration <$> (symbol Lambda' <|> symbol Lambda) <*> children ((,,,) <$ token AnonLambda <*> emptyTerm <*> (symbol LambdaParameters *> children (manyTerm expression) <|> pure []) <*> optional (symbol Type *> children (term expression)) <*> block) + makeFunctionDeclaration <$> symbol FunctionDefinition <*> children ((,,,) <$> term expression <* symbol Parameters <*> children (manyTerm functionParam) <*> optional (symbol Type *> children (term expression)) <*> expressions) + <|> makeFunctionDeclaration <$> (symbol Lambda' <|> symbol Lambda) <*> children ((,,,) <$ token AnonLambda <*> emptyTerm <*> (symbol LambdaParameters *> children (manyTerm expression) <|> pure []) <*> optional (symbol Type *> children (term expression)) <*> expressions) where makeFunctionDeclaration loc (functionName', functionParameters, ty, functionBody) = let fn = makeTerm loc (Declaration.Function [] functionName' functionParameters functionBody)