From 3125759abead3d08f51dbf12dda604a6a6a2649c Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 21 Aug 2017 15:51:54 -0400 Subject: [PATCH] Assign comments in decorators. --- src/Language/Python/Syntax.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index 594cc084c..1fb3553ca 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -206,11 +206,9 @@ parameter = makeTerm <$> symbol DefaultParameter <*> children (Statement.Assign makeAssignment loc identifier' value' = makeTerm loc (Statement.Assignment identifier' value') decoratedDefinition :: Assignment -decoratedDefinition = symbol DecoratedDefinition *> children (makeDecorator <$> partialDecorator <*> (flip (foldr makeDecorator) <$> many partialDecorator <*> term (functionDefinition <|> classDefinition))) +decoratedDefinition = symbol DecoratedDefinition *> children (term decorator) where - makeDecorator (loc, partialDecorator') next = makeTerm loc (partialDecorator' next) - partialDecorator = (,) <$> symbol Decorator <*> children decorator' - decorator' = Declaration.Decorator <$> expression <*> many expression + decorator = makeTerm <$> symbol Decorator <*> (children (Declaration.Decorator <$> expression <*> many expression) <*> term (decorator <|> functionDefinition <|> classDefinition)) argumentList :: Assignment argumentList = symbol ArgumentList *> children expressions