mirror of
https://github.com/github/semantic.git
synced 2025-01-03 13:02:37 +03:00
Use makeTerm'' in python import assignment
This commit is contained in:
parent
9cc2ec1db3
commit
621ae92edc
@ -12,7 +12,7 @@ import Data.Functor (void)
|
|||||||
import Data.List.NonEmpty (some1)
|
import Data.List.NonEmpty (some1)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import Data.Record
|
import Data.Record
|
||||||
import Data.Syntax (contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm1, parseError, postContextualize)
|
import Data.Syntax (contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm'', makeTerm1, parseError, postContextualize)
|
||||||
import qualified Data.Syntax as Syntax
|
import qualified Data.Syntax as Syntax
|
||||||
import qualified Data.Syntax.Comment as Comment
|
import qualified Data.Syntax.Comment as Comment
|
||||||
import qualified Data.Syntax.Declaration as Declaration
|
import qualified Data.Syntax.Declaration as Declaration
|
||||||
@ -374,14 +374,12 @@ comment :: Assignment
|
|||||||
comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source)
|
comment = makeTerm <$> symbol Comment <*> (Comment.Comment <$> source)
|
||||||
|
|
||||||
import' :: Assignment
|
import' :: Assignment
|
||||||
import' = mk <$> symbol ImportStatement <*> children (manyTerm (aliasedImport <|> plainImport))
|
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)))
|
||||||
where
|
where
|
||||||
aliasedImport = makeTerm <$> symbol AliasedImport <*> children (Declaration.Import <$> expression <*> expression <*> pure [])
|
aliasedImport = makeTerm <$> symbol AliasedImport <*> children (Declaration.Import <$> expression <*> expression <*> pure [])
|
||||||
plainImport = makeTerm <$> symbol DottedName <*> children (Declaration.Import <$> expression <*> emptyTerm <*> pure [])
|
plainImport = makeTerm <$> symbol DottedName <*> children (Declaration.Import <$> expression <*> emptyTerm <*> pure [])
|
||||||
wildCard = makeTerm <$> symbol WildcardImport <*> (Syntax.Identifier <$> source)
|
wildCard = makeTerm <$> symbol WildcardImport <*> (Syntax.Identifier <$> source)
|
||||||
mk _ [child] = child
|
|
||||||
mk location children = makeTerm location children
|
|
||||||
|
|
||||||
assertStatement :: Assignment
|
assertStatement :: Assignment
|
||||||
assertStatement = makeTerm <$> symbol AssertStatement <*> children (Expression.Call <$> pure [] <*> (makeTerm <$> symbol AnonAssert <*> (Syntax.Identifier <$> source)) <*> manyTerm expression <*> emptyTerm)
|
assertStatement = makeTerm <$> symbol AssertStatement <*> children (Expression.Call <$> pure [] <*> (makeTerm <$> symbol AnonAssert <*> (Syntax.Identifier <$> source)) <*> manyTerm expression <*> emptyTerm)
|
||||||
|
Loading…
Reference in New Issue
Block a user