diff --git a/src/Data/Syntax/Expression.hs b/src/Data/Syntax/Expression.hs index c3e07f15c..5c980bf85 100644 --- a/src/Data/Syntax/Expression.hs +++ b/src/Data/Syntax/Expression.hs @@ -85,10 +85,10 @@ data Subscript a instance Eq1 Subscript where liftEq = genericLiftEq instance Show1 Subscript where liftShowsPrec = genericLiftShowsPrec --- | Dotted Name (e.g. a.b in Python) -data DottedName a - = DottedName ![a] +-- | ScopeResolution (e.g. import a.b in Python or a::b in C++) +data ScopeResolution a + = ScopeResolution ![a] deriving (Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable) -instance Eq1 DottedName where liftEq = genericLiftEq -instance Show1 DottedName where liftShowsPrec = genericLiftShowsPrec +instance Eq1 ScopeResolution where liftEq = genericLiftEq +instance Show1 ScopeResolution where liftShowsPrec = genericLiftShowsPrec diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index 24c6969a4..673f21b16 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -33,7 +33,7 @@ type Syntax' = , Expression.Bitwise , Expression.Call , Expression.Comparison - , Expression.DottedName + , Expression.ScopeResolution , Expression.MemberAccess , Expression.Subscript , Literal.Array @@ -103,7 +103,7 @@ expression = statement <|> await dottedName :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) -dottedName = makeTerm <$> symbol DottedName <*> children (Expression.DottedName <$> many expression) +dottedName = makeTerm <$> symbol DottedName <*> children (Expression.ScopeResolution <$> many expression) ellipsis :: HasCallStack => Assignment (Node Grammar) (Term Syntax Location) ellipsis = makeTerm <$> symbol Ellipsis <*> (Syntax.Ellipsis <$> source)