Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit eb72442

Browse files
committed
Split out instances for PrimaryExpression.
1 parent c15bbcb commit eb72442

File tree

1 file changed

+28
-1
lines changed
  • semantic-python/src/Language/Python

1 file changed

+28
-1
lines changed

semantic-python/src/Language/Python/Core.hs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,39 @@ defaultCompile t = fail $ "compilation unimplemented for " <> show t
2121
instance (Compile l, Compile r) => Compile (Either l r) where compile = compileSum
2222

2323
instance Compile Py.AssertStatement
24+
instance Compile Py.Attribute
2425
instance Compile Py.Await
26+
instance Compile Py.BinaryOperator
2527
instance Compile Py.Block
2628
instance Compile Py.BooleanOperator
2729
instance Compile Py.BreakStatement
30+
instance Compile Py.Call
2831
instance Compile Py.ClassDefinition
2932
instance Compile Py.ComparisonOperator
3033

3134
instance Compile Py.CompoundStatement where compile = compileSum
3235

36+
instance Compile Py.ConcatenatedString
3337
instance Compile Py.ConditionalExpression
3438
instance Compile Py.ContinueStatement
3539
instance Compile Py.DecoratedDefinition
3640
instance Compile Py.DeleteStatement
41+
instance Compile Py.Dictionary
42+
instance Compile Py.DictionaryComprehension
43+
instance Compile Py.Ellipsis
3744
instance Compile Py.ExecStatement
3845

3946
instance Compile Py.Expression where compile = compileSum
4047

4148
instance Compile Py.ExpressionStatement
49+
instance Compile Py.False
50+
instance Compile Py.Float
4251
instance Compile Py.ForStatement
4352
instance Compile Py.FunctionDefinition
4453
instance Compile Py.FutureImportStatement
54+
instance Compile Py.GeneratorExpression
4555
instance Compile Py.GlobalStatement
56+
instance Compile Py.Identifier
4657

4758
instance Compile Py.IfStatement where
4859
compile IfStatement{..} = If <$> compile condition <*> compile consequence <*> case alternative of
@@ -53,24 +64,39 @@ instance Compile Py.IfStatement where
5364

5465
instance Compile Py.ImportFromStatement
5566
instance Compile Py.ImportStatement
67+
instance Compile Py.Integer
68+
instance Compile Py.KeywordIdentifier
5669
instance Compile Py.Lambda
70+
instance Compile Py.List
71+
instance Compile Py.ListComprehension
5772

5873
instance Compile Py.Module where
5974
compile (Module Nothing) = pure Unit
6075
compile (Module (Just statements)) = block <$> traverse compile statements
6176

6277
instance Compile Py.NamedExpression
78+
instance Compile Py.None
6379
instance Compile Py.NonlocalStatement
6480
instance Compile Py.NotOperator
81+
instance Compile Py.ParenthesizedExpression
6582
instance Compile Py.PassStatement
66-
instance Compile Py.PrimaryExpression
83+
84+
instance Compile Py.PrimaryExpression where compile = compileSum
85+
6786
instance Compile Py.PrintStatement
6887
instance Compile Py.ReturnStatement
6988
instance Compile Py.RaiseStatement
89+
instance Compile Py.Set
90+
instance Compile Py.SetComprehension
7091

7192
instance Compile Py.SimpleStatement where compile = compileSum
7293

94+
instance Compile Py.String
95+
instance Compile Py.Subscript
96+
instance Compile Py.True
7397
instance Compile Py.TryStatement
98+
instance Compile Py.Tuple
99+
instance Compile Py.UnaryOperator
74100
instance Compile Py.WhileStatement
75101
instance Compile Py.WithStatement
76102

@@ -95,4 +121,5 @@ instance Compile t => GCompileSum (M1 C c (M1 S s (K1 R t))) where
95121
-- FIXME: depend on https://github.com/tree-sitter/haskell-tree-sitter/pull/90 so we can get rid of these orphan instances
96122
deriving instance Generic Py.CompoundStatement
97123
deriving instance Generic Py.Expression
124+
deriving instance Generic Py.PrimaryExpression
98125
deriving instance Generic Py.SimpleStatement

0 commit comments

Comments
 (0)