From 393c481f83f85a03b01b27b4a28397f942e72a40 Mon Sep 17 00:00:00 2001 From: Rick Winfrey Date: Tue, 30 May 2017 16:58:30 -0700 Subject: [PATCH] Expand If assignment --- src/Language/Python/Syntax.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index 3e30d219a..4ceeae2b8 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -197,9 +197,9 @@ returnStatement = makeTerm <$> symbol ReturnStatement <*> (Statement.Return <$> ifStatement :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) -ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> condition <*> statement <*> (flip (foldr makeElif) <$> many elifClause <*> optionalElse)) +ifStatement = makeTerm <$> symbol IfStatement <*> children (Statement.If <$> expression <*> statement <*> (flip (foldr makeElif) <$> many elifClause <*> optionalElse)) where elseClause = symbol ElseClause *> children statement - elifClause = (,) <$ symbol ElifClause <*> location <*> children (Statement.If <$> condition <*> statement) + elifClause = (,) <$ symbol ElifClause <*> location <*> children (Statement.If <$> expression <*> statement) condition = boolean optionalElse = fromMaybe <$> emptyTerm <*> optional elseClause makeElif (loc, makeIf) rest = makeTerm loc (makeIf rest)