From bfdf50b67a31960480b2dd69f3014703dbdf44e5 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Tue, 30 Jan 2018 12:39:10 -0800 Subject: [PATCH] Parse out ImportSymbols for Python --- src/Language/Python/Assignment.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Language/Python/Assignment.hs b/src/Language/Python/Assignment.hs index 656d9f55e..7b07ba6a9 100644 --- a/src/Language/Python/Assignment.hs +++ b/src/Language/Python/Assignment.hs @@ -372,8 +372,12 @@ comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source) import' :: Assignment import' = makeTerm'' <$> symbol ImportStatement <*> children (manyTerm (aliasedImport <|> plainImport)) - <|> makeTerm <$> symbol ImportFromStatement <*> children (Declaration.Import <$> expression <*> emptyTerm <*> (pure <$> (wildCard <|> expressions))) + -- <|> makeTerm <$> symbol ImportFromStatement <*> children (Declaration.Import <$> expression <*> emptyTerm <*> (pure <$> (wildCard <|> expressions))) + <|> makeTerm <$> symbol ImportFromStatement <*> children (Declaration.Import <$> expression <*> emptyTerm <*> ((pure <$> wildCard <|> importSymbols))) where + importSymbols = many (makeTerm <$> location <*> (Declaration.ImportSymbol <$> expression <*> emptyTerm)) + -- importSymbols = makeTerm'' <$> location <*> fmap (\e -> Declaration.ImportSymbol e emptyTerm) (manyTerm expression) + -- expressions = makeTerm'' <$> location <*> manyTerm expression aliasedImport = makeTerm <$> symbol AliasedImport <*> children (Declaration.Import <$> expression <*> expression <*> pure []) plainImport = makeTerm <$> symbol DottedName <*> children (Declaration.Import <$> expression <*> emptyTerm <*> pure []) wildCard = makeTerm <$> symbol WildcardImport <*> (Syntax.Identifier <$> source)