mirror of
https://github.com/github/semantic.git
synced 2025-01-03 21:16:12 +03:00
Parse out ImportSymbols for Python
This commit is contained in:
parent
9e977ebb71
commit
bfdf50b67a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user