Skip to content

Commit ae5dfc3

Browse files
committed
Manage delete statement (done)
1 parent 2a7c7c0 commit ae5dfc3

11 files changed

Lines changed: 275 additions & 73 deletions

src/FAST-Python-Model-Generator/FASTPythonMetamodelGenerator.class.st

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ Class {
153153
'dictionarySplatParameter',
154154
'tPattern',
155155
'tClassPatternElement',
156-
'tUnionMember'
156+
'tUnionMember',
157+
'tDeletable'
157158
],
158159
#category : 'FAST-Python-Model-Generator',
159160
#package : 'FAST-Python-Model-Generator'
@@ -528,12 +529,14 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
528529
tReturnReferenceable --|> tAsPatternSource.
529530
tReturnReferenceable --|> tSplatExpression.
530531
tReturnReferenceable --|> tDecoratorExpression.
532+
tReturnReferenceable --|> tDeletable.
531533

532534
thenClause --|> block.
533535

534536
tuple --|> collectionInitializer.
535537
tuple --|> tAsPatternTarget.
536538
tuple --|> tAssignable.
539+
tuple --|> tDeletable.
537540

538541
tryStatement --|> statement.
539542
tryStatement --|> tStatementBlock.
@@ -642,7 +645,7 @@ FASTPythonMetamodelGenerator >> defineRelations [
642645
(decorator property: #expression) <>- (tDecoratorExpression property: #parentDeclarator).
643646

644647
((deleteStatement property: #expression) comment: 'The expression to apply the delete on')
645-
<>- ((expression property: #deleteOwner) comment: 'The delete statement that own the expression (if it''s the case)').
648+
<>- ((tDeletable property: #parentDeleteStatement) comment: 'The delete statement that own the expression (if it''s the case)').
646649

647650
(forInClause property: #left) <>- (expression property: #forInClauseLeftOwner).
648651

@@ -755,10 +758,12 @@ FASTPythonMetamodelGenerator >> defineTraits [
755758
(tClassPatternElement := builder newTraitNamed: #TClassPatternElement) comment: 'I represent the elements of a class pattern in python pattern matcher. The first element is the class name, the others the arguments.'.
756759

757760
tComprehension := builder newTraitNamed: #TComprehension.
761+
762+
(tDecoratorExpression := builder newTraitNamed: #TDecoratorExpression) comment: 'I represent an entity that *can* be the expression of a decorator.'.
758763

759764
tDefinition := builder newTraitNamed: #TDefinition.
760765

761-
(tDecoratorExpression := builder newTraitNamed: #TDecoratorExpression) comment: 'I represent an entity that *can* be the expression of a decorator.'.
766+
(tDeletable := builder newTraitNamed: #TDeletable) comment: 'I represent an expression that can be in a delete statement.'.
762767

763768
(tPattern := builder newTraitNamed: #TPattern) comment: 'I represent an entity that can be the pattern of a case clause in a match statement..'.
764769

src/FAST-Python-Model/FASTPyAttributeAccess.class.st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| `parentAsPatternTarget` | `FASTPyTAsPatternTarget` | `target` | `FASTPyAsPattern` | |
1010
| `parentAssignmentLeft` | `FASTPyTAssignable` | `left` | `FASTPyAssignment` | |
1111
| `parentDeclarator` | `FASTPyTDecoratorExpression` | `expression` | `FASTPyDecorator` | |
12+
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1213
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
1314
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
1415
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPyTSplatParameter` | |

src/FAST-Python-Model/FASTPyCall.class.st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| `parentAssignmentLeft` | `FASTPyTAssignable` | `left` | `FASTPyAssignment` | |
1313
| `parentConditional` | `FASTTExpression` | `condition` | `FASTTWithCondition` | Optional condition statement/expression where this expression is used|
1414
| `parentDeclarator` | `FASTPyTDecoratorExpression` | `expression` | `FASTPyDecorator` | |
15+
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1516
| `parentExpression` | `FASTTExpression` | `expression` | `FASTTUnaryExpression` | Parent (unary) expression|
1617
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1718
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|

src/FAST-Python-Model/FASTPyDeleteStatement.class.st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Children
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
8-
| `expression` | `FASTPyDeleteStatement` | `deleteOwner` | `FASTPyExpression` | The expression to apply the delete on|
8+
| `expression` | `FASTPyDeleteStatement` | `parentDeleteStatement` | `FASTPyTDeletable` | The expression to apply the delete on|
99
1010
1111
@@ -14,7 +14,7 @@ Class {
1414
#name : 'FASTPyDeleteStatement',
1515
#superclass : 'FASTPyStatement',
1616
#instVars : [
17-
'#expression => FMOne type: #FASTPyExpression opposite: #deleteOwner'
17+
'#expression => FMOne type: #FASTPyTDeletable opposite: #parentDeleteStatement'
1818
],
1919
#category : 'FAST-Python-Model-Entities',
2020
#package : 'FAST-Python-Model',
@@ -32,7 +32,7 @@ FASTPyDeleteStatement class >> annotation [
3232

3333
{ #category : 'accessing' }
3434
FASTPyDeleteStatement >> expression [
35-
"Relation named: #expression type: #FASTPyExpression opposite: #deleteOwner"
35+
"Relation named: #expression type: #FASTPyTDeletable opposite: #parentDeleteStatement"
3636

3737
<generated>
3838
<FMComment: 'The expression to apply the delete on'>

src/FAST-Python-Model/FASTPyExpression.class.st

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
| `comprehensionClauseOwner` | `FASTPyExpression` | `clauses` | `FASTPyTComprehension` | |
1515
| `conditionalExpressionElseOwner` | `FASTPyExpression` | `elseExpression` | `FASTPyConditionalExpression` | |
1616
| `conditionalExpressionThenOwner` | `FASTPyExpression` | `thenExpression` | `FASTPyConditionalExpression` | |
17-
| `deleteOwner` | `FASTPyExpression` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1817
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
1918
| `forInClauseLeftOwner` | `FASTPyExpression` | `left` | `FASTPyForInClause` | |
2019
| `forInClauseRightOwner` | `FASTPyExpression` | `right` | `FASTPyForInClause` | |
@@ -68,7 +67,6 @@ Class {
6867
'#comprehensionClauseOwner => FMOne type: #FASTPyTComprehension opposite: #clauses',
6968
'#conditionalExpressionElseOwner => FMOne type: #FASTPyConditionalExpression opposite: #elseExpression',
7069
'#conditionalExpressionThenOwner => FMOne type: #FASTPyConditionalExpression opposite: #thenExpression',
71-
'#deleteOwner => FMOne type: #FASTPyDeleteStatement opposite: #expression',
7270
'#forInClauseLeftOwner => FMOne type: #FASTPyForInClause opposite: #left',
7371
'#forInClauseRightOwner => FMOne type: #FASTPyForInClause opposite: #right',
7472
'#forStatementLeftOwner => FMOne type: #FASTPyForStatement opposite: #right',
@@ -276,31 +274,6 @@ FASTPyExpression >> conditionalExpressionThenOwnerGroup [
276274
^ MooseSpecializedGroup with: self conditionalExpressionThenOwner
277275
]
278276

279-
{ #category : 'accessing' }
280-
FASTPyExpression >> deleteOwner [
281-
"Relation named: #deleteOwner type: #FASTPyDeleteStatement opposite: #expression"
282-
283-
<generated>
284-
<FMComment: 'The delete statement that own the expression (if it''s the case)'>
285-
<container>
286-
<derived>
287-
^ deleteOwner
288-
]
289-
290-
{ #category : 'accessing' }
291-
FASTPyExpression >> deleteOwner: anObject [
292-
293-
<generated>
294-
deleteOwner := anObject
295-
]
296-
297-
{ #category : 'navigation' }
298-
FASTPyExpression >> deleteOwnerGroup [
299-
<generated>
300-
<navigation: 'DeleteOwner'>
301-
^ MooseSpecializedGroup with: self deleteOwner
302-
]
303-
304277
{ #category : 'accessing' }
305278
FASTPyExpression >> forInClauseLeftOwner [
306279
"Relation named: #forInClauseLeftOwner type: #FASTPyForInClause opposite: #left"

src/FAST-Python-Model/FASTPyIdentifier.class.st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
| `parentAsPatternTarget` | `FASTPyTAsPatternTarget` | `target` | `FASTPyAsPattern` | |
1111
| `parentAssignmentLeft` | `FASTPyTAssignable` | `left` | `FASTPyAssignment` | |
1212
| `parentDeclarator` | `FASTPyTDecoratorExpression` | `expression` | `FASTPyDecorator` | |
13+
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1314
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
1415
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
1516
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPyTSplatParameter` | |

src/FAST-Python-Model/FASTPySubscript.class.st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| `parentAsPatternTarget` | `FASTPyTAsPatternTarget` | `target` | `FASTPyAsPattern` | |
1010
| `parentAssignmentLeft` | `FASTPyTAssignable` | `left` | `FASTPyAssignment` | |
1111
| `parentDeclarator` | `FASTPyTDecoratorExpression` | `expression` | `FASTPyDecorator` | |
12+
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1213
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
1314
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
1415
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"
2+
I represent an expression that can be in a delete statement.
3+
4+
## Relations
5+
======================
6+
7+
### Parents
8+
| Relation | Origin | Opposite | Type | Comment |
9+
|---|
10+
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
11+
12+
13+
14+
"
15+
Trait {
16+
#name : 'FASTPyTDeletable',
17+
#instVars : [
18+
'#parentDeleteStatement => FMOne type: #FASTPyDeleteStatement opposite: #expression'
19+
],
20+
#category : 'FAST-Python-Model-Traits',
21+
#package : 'FAST-Python-Model',
22+
#tag : 'Traits'
23+
}
24+
25+
{ #category : 'meta' }
26+
FASTPyTDeletable classSide >> annotation [
27+
28+
<FMClass: #TDeletable super: #Object>
29+
<package: #'FAST-Python-Model'>
30+
<generated>
31+
^ self
32+
]
33+
34+
{ #category : 'accessing' }
35+
FASTPyTDeletable >> parentDeleteStatement [
36+
"Relation named: #parentDeleteStatement type: #FASTPyDeleteStatement opposite: #expression"
37+
38+
<generated>
39+
<FMComment: 'The delete statement that own the expression (if it''s the case)'>
40+
<container>
41+
<derived>
42+
^ parentDeleteStatement
43+
]
44+
45+
{ #category : 'accessing' }
46+
FASTPyTDeletable >> parentDeleteStatement: anObject [
47+
48+
<generated>
49+
parentDeleteStatement := anObject
50+
]
51+
52+
{ #category : 'navigation' }
53+
FASTPyTDeletable >> parentDeleteStatementGroup [
54+
<generated>
55+
<navigation: 'ParentDeleteStatement'>
56+
^ MooseSpecializedGroup with: self parentDeleteStatement
57+
]

src/FAST-Python-Model/FASTPyTReturnReferenceable.trait.st

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Lot of relations in python points to references. And some nodes can return lot o
1010
| `parentAsPatternSource` | `FASTPyTAsPatternSource` | `source` | `FASTPyAsPattern` | |
1111
| `parentAssignmentLeft` | `FASTPyTAssignable` | `left` | `FASTPyAssignment` | |
1212
| `parentDeclarator` | `FASTPyTDecoratorExpression` | `expression` | `FASTPyDecorator` | |
13+
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1314
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
1415
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
1516
@@ -18,8 +19,8 @@ Lot of relations in python points to references. And some nodes can return lot o
1819
"
1920
Trait {
2021
#name : 'FASTPyTReturnReferenceable',
21-
#traits : 'FASTPyTAsPatternSource + FASTPyTAssignable + FASTPyTDecoratorExpression + FASTPyTRaised + FASTPyTSplatExpression',
22-
#classTraits : 'FASTPyTAsPatternSource classTrait + FASTPyTAssignable classTrait + FASTPyTDecoratorExpression classTrait + FASTPyTRaised classTrait + FASTPyTSplatExpression classTrait',
22+
#traits : 'FASTPyTAsPatternSource + FASTPyTAssignable + FASTPyTDecoratorExpression + FASTPyTDeletable + FASTPyTRaised + FASTPyTSplatExpression',
23+
#classTraits : 'FASTPyTAsPatternSource classTrait + FASTPyTAssignable classTrait + FASTPyTDecoratorExpression classTrait + FASTPyTDeletable classTrait + FASTPyTRaised classTrait + FASTPyTSplatExpression classTrait',
2324
#category : 'FAST-Python-Model-Traits',
2425
#package : 'FAST-Python-Model',
2526
#tag : 'Traits'

src/FAST-Python-Model/FASTPyTuple.class.st

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
| `parentAsPatternSource` | `FASTPyTAsPatternSource` | `source` | `FASTPyAsPattern` | |
99
| `parentAsPatternTarget` | `FASTPyTAsPatternTarget` | `target` | `FASTPyAsPattern` | |
1010
| `parentAssignmentLeft` | `FASTPyTAssignable` | `left` | `FASTPyAssignment` | |
11+
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1112
1213
1314
1415
"
1516
Class {
1617
#name : 'FASTPyTuple',
1718
#superclass : 'FASTPyCollectionInitializer',
18-
#traits : 'FASTPyTAsPatternTarget + FASTPyTAssignable',
19-
#classTraits : 'FASTPyTAsPatternTarget classTrait + FASTPyTAssignable classTrait',
19+
#traits : 'FASTPyTAsPatternTarget + FASTPyTAssignable + FASTPyTDeletable',
20+
#classTraits : 'FASTPyTAsPatternTarget classTrait + FASTPyTAssignable classTrait + FASTPyTDeletable classTrait',
2021
#category : 'FAST-Python-Model-Entities',
2122
#package : 'FAST-Python-Model',
2223
#tag : 'Entities'

0 commit comments

Comments
 (0)