Skip to content

Commit 468e721

Browse files
committed
Manage List, set and tuples
1 parent 24f2a70 commit 468e721

17 files changed

Lines changed: 214 additions & 60 deletions

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ Class {
142142
'tInvocation',
143143
'tStatementBlock',
144144
'tReturnStatement',
145-
'tStatement'
145+
'tStatement',
146+
'collectionInitializer'
146147
],
147148
#category : 'FAST-Python-Model-Generator',
148149
#package : 'FAST-Python-Model-Generator'
@@ -184,6 +185,7 @@ FASTPythonMetamodelGenerator >> defineClasses [
184185
boolean := builder ensureClassNamed: #Boolean.
185186
booleanOperator := builder ensureClassNamed: #BooleanOperator.
186187
breakStatement := builder ensureClassNamed: #BreakStatement."Todo"
188+
collectionInitializer := builder ensureClassNamed: #CollectionInitializer.
187189
call := builder ensureClassNamed: #Call."Todo"
188190
caseClause := builder ensureClassNamed: #CaseClause."Todo"
189191
casePattern := builder ensureClassNamed: #CasePattern."Todo"
@@ -243,7 +245,7 @@ FASTPythonMetamodelGenerator >> defineClasses [
243245
lambda := builder ensureClassNamed: #Lambda."Todo"
244246
lambdaParameters := builder ensureClassNamed: #LambdaParameters."Todo"
245247
lineContinuation := builder ensureClassNamed: #LineContinuation."Todo"
246-
list := builder ensureClassNamed: #List."Todo"
248+
list := builder ensureClassNamed: #List.
247249
listComprehension := builder ensureClassNamed: #ListComprehension."Todo"
248250
listPattern := builder ensureClassNamed: #ListPattern."Todo"
249251
listSplat := builder ensureClassNamed: #ListSplat."Todo"
@@ -268,7 +270,7 @@ FASTPythonMetamodelGenerator >> defineClasses [
268270
printStatement := builder ensureClassNamed: #PrintStatement."Todo"
269271
raiseStatement := builder ensureClassNamed: #RaiseStatement."Todo"
270272
returnStatement := builder ensureClassNamed: #ReturnStatement."Todo"
271-
set := builder ensureClassNamed: #Set."Todo"
273+
set := builder ensureClassNamed: #Set.
272274
setComprehension := builder ensureClassNamed: #SetComprehension."Todo"
273275
slice := builder ensureClassNamed: #Slice."Todo"
274276
splatPattern := builder ensureClassNamed: #SplatPattern."Todo"
@@ -277,7 +279,7 @@ FASTPythonMetamodelGenerator >> defineClasses [
277279
structuralEntity := builder ensureClassNamed: #StructuralEntity.
278280
subscript := builder ensureClassNamed: #Subscript."Todo"
279281
tryStatement := builder ensureClassNamed: #TryStatement."Todo"
280-
tuple := builder ensureClassNamed: #Tuple."Todo"
282+
tuple := builder ensureClassNamed: #Tuple."To Review"
281283
tupleExpression := builder ensureClassNamed: #TupleExpression."Todo"
282284
tuplePattern := builder ensureClassNamed: #TuplePattern."Todo"
283285
type := builder ensureClassNamed: #Type."Todo"
@@ -327,6 +329,8 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
327329

328330
classDefinition --|> tNamedEntity.
329331

332+
collectionInitializer --|> expression.
333+
330334
comment --|> tComment.
331335

332336
comparisonOperator --|> operator.
@@ -346,7 +350,7 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
346350

347351
integer --|> literal.
348352

349-
list --|> expression.
353+
list --|> collectionInitializer.
350354

351355
literal --|> tLiteral.
352356

@@ -365,11 +369,15 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
365369

366370
returnStatement --|> tReturnStatement.
367371

372+
set --|> collectionInitializer.
373+
368374
string --|> literal.
369375
string --|> tStringLiteral.
370376

371377
structuralEntity --|> tVariableEntity.
372378

379+
tuple --|> collectionInitializer.
380+
373381
unaryOperator --|> operator.
374382
unaryOperator --|> tUnaryOperator.
375383

@@ -418,7 +426,7 @@ FASTPythonMetamodelGenerator >> defineRelations [
418426
'Module in which the imported entities should be looked for. `from datetime import date` has `datetime` as fromModule..')
419427
<>- ((fromModule property: #import) comment: 'Import declaring me as from import module.').
420428

421-
((list property: #initializers) comment: 'Each initializer defines one element.')
429+
((collectionInitializer property: #initializers) comment: 'Each initializer defines one element.')
422430
<>-* ((tExpression property: #collectionInitializers) comment: 'The owner of the expression').
423431

424432
((tUnaryOperator property: #argument) comment: 'Expression influanced by the unary operator..')
@@ -430,12 +438,13 @@ FASTPythonMetamodelGenerator >> defineTraits [
430438

431439
super defineTraits.
432440

433-
"From FAST"
441+
"Entity"
434442
tEntity := self remoteTrait: #TEntity withPrefix: #FAST.
435443

436-
444+
"FAST-Python"
437445
tUnaryOperator := builder newTraitNamed: #TUnaryOperator.
438-
446+
447+
"Remotes"
439448
tAssignment := self remoteTrait: #TAssignment withPrefix: #FAST.
440449
tBinaryExpression := self remoteTrait: #TBinaryExpression withPrefix: #FAST.
441450
tBooleanLiteral := self remoteTrait: #TBooleanLiteral withPrefix: #FAST.

‎src/FAST-Python-Model/FASTPyAssignment.class.st‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|---|
88
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
99
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
10-
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyList` | The owner of the expression|
10+
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyCollectionInitializer` | The owner of the expression|
1111
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
1212
| `parentComparisonOperator` | `FASTTExpression` | `operands` | `FASTPyComparisonOperator` | Parent comparison expression of which I am.|
1313
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|

‎src/FAST-Python-Model/FASTPyBinaryOperator.class.st‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|---|
88
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
99
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
10-
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyList` | The owner of the expression|
10+
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyCollectionInitializer` | The owner of the expression|
1111
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
1212
| `parentComparisonOperator` | `FASTTExpression` | `operands` | `FASTPyComparisonOperator` | Parent comparison expression of which I am.|
1313
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|

‎src/FAST-Python-Model/FASTPyBoolean.class.st‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|---|
88
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
99
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
10-
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyList` | The owner of the expression|
10+
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyCollectionInitializer` | The owner of the expression|
1111
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
1212
| `parentComparisonOperator` | `FASTTExpression` | `operands` | `FASTPyComparisonOperator` | Parent comparison expression of which I am.|
1313
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|

‎src/FAST-Python-Model/FASTPyBooleanOperator.class.st‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|---|
88
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
99
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
10-
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyList` | The owner of the expression|
10+
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyCollectionInitializer` | The owner of the expression|
1111
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
1212
| `parentComparisonOperator` | `FASTTExpression` | `operands` | `FASTPyComparisonOperator` | Parent comparison expression of which I am.|
1313
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|---|
88
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
99
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
10-
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyList` | The owner of the expression|
10+
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyCollectionInitializer` | The owner of the expression|
1111
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
1212
| `parentComparisonOperator` | `FASTTExpression` | `operands` | `FASTPyComparisonOperator` | Parent comparison expression of which I am.|
1313
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"
2+
## Relations
3+
======================
4+
5+
### Children
6+
| Relation | Origin | Opposite | Type | Comment |
7+
|---|
8+
| `initializers` | `FASTPyCollectionInitializer` | `collectionInitializers` | `FASTTExpression` | Each initializer defines one element.|
9+
10+
11+
12+
"
13+
Class {
14+
#name : 'FASTPyCollectionInitializer',
15+
#superclass : 'FASTPyExpression',
16+
#category : 'FAST-Python-Model-Entities',
17+
#package : 'FAST-Python-Model',
18+
#tag : 'Entities'
19+
}
20+
21+
{ #category : 'meta' }
22+
FASTPyCollectionInitializer class >> annotation [
23+
24+
<FMClass: #CollectionInitializer super: #FASTPyExpression>
25+
<package: #'FAST-Python-Model'>
26+
<generated>
27+
^ self
28+
]
29+
30+
{ #category : 'adding' }
31+
FASTPyCollectionInitializer >> addInitializer: anObject [
32+
<generated>
33+
^ self initializers add: anObject
34+
]
35+
36+
{ #category : 'accessing' }
37+
FASTPyCollectionInitializer >> initializers [
38+
"Relation named: #initializers type: #FASTTExpression opposite: #collectionInitializers"
39+
40+
<generated>
41+
<FMComment: 'Each initializer defines one element.'>
42+
<derived>
43+
<FMProperty: #initializers type: #FASTTExpression opposite: #collectionInitializers>
44+
<multivalued>
45+
^ self attributeAt: #initializers ifAbsentPut: [ FMMultivalueLink on: self opposite: #collectionInitializers: ]
46+
]
47+
48+
{ #category : 'accessing' }
49+
FASTPyCollectionInitializer >> initializers: anObject [
50+
51+
<generated>
52+
self initializers value: anObject
53+
]
54+
55+
{ #category : 'navigation' }
56+
FASTPyCollectionInitializer >> initializersGroup [
57+
<generated>
58+
<navigation: 'Initializers'>
59+
^ MooseSpecializedGroup withAll: self initializers asSet
60+
]

‎src/FAST-Python-Model/FASTPyEntity.class.st‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|---|
88
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
99
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
10-
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyList` | The owner of the expression|
10+
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyCollectionInitializer` | The owner of the expression|
1111
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
1212
| `genericParent` | `FASTPyEntity` | `genericChildren` | `FASTPyEntity` | |
1313
| `parentComparisonOperator` | `FASTTExpression` | `operands` | `FASTPyComparisonOperator` | Parent comparison expression of which I am.|

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|---|
88
| `argumentOwner` | `FASTTExpression` | `arguments` | `FASTTWithArguments` | my owner|
99
| `assignedIn` | `FASTTExpression` | `expression` | `FASTTAssignment` | Optional assignment where this expression is used|
10-
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyList` | The owner of the expression|
10+
| `collectionInitializers` | `FASTTExpression` | `initializers` | `FASTPyCollectionInitializer` | The owner of the expression|
1111
| `expressionStatementOwner` | `FASTTExpression` | `expression` | `FASTTExpressionStatement` | The expression statement that own me (if it's the case|
1212
| `parentComparisonOperator` | `FASTTExpression` | `operands` | `FASTPyComparisonOperator` | Parent comparison expression of which I am.|
1313
| `parentConditionalStatement` | `FASTTExpression` | `condition` | `FASTTConditionalStatement` | Optional condition statement where this expression is used|

‎src/FAST-Python-Model/FASTPyList.class.st‎

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
### Children
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
8-
| `initializers` | `FASTPyList` | `collectionInitializers` | `FASTTExpression` | Each initializer defines one element.|
8+
| `initializers` | `FASTPyTCollectionInitializer` | `collectionInitializers` | `FASTTExpression` | Each initializer defines one element.|
99
1010
1111
1212
"
1313
Class {
1414
#name : 'FASTPyList',
15-
#superclass : 'FASTPyExpression',
15+
#superclass : 'FASTPyCollectionInitializer',
1616
#category : 'FAST-Python-Model-Entities',
1717
#package : 'FAST-Python-Model',
1818
#tag : 'Entities'
@@ -21,40 +21,8 @@ Class {
2121
{ #category : 'meta' }
2222
FASTPyList class >> annotation [
2323

24-
<FMClass: #List super: #FASTPyExpression>
24+
<FMClass: #List super: #FASTPyCollectionInitializer>
2525
<package: #'FAST-Python-Model'>
2626
<generated>
2727
^ self
2828
]
29-
30-
{ #category : 'adding' }
31-
FASTPyList >> addInitializer: anObject [
32-
<generated>
33-
^ self initializers add: anObject
34-
]
35-
36-
{ #category : 'accessing' }
37-
FASTPyList >> initializers [
38-
"Relation named: #initializers type: #FASTTExpression opposite: #collectionInitializers"
39-
40-
<generated>
41-
<FMComment: 'Each initializer defines one element.'>
42-
<derived>
43-
<FMProperty: #initializers type: #FASTTExpression opposite: #collectionInitializers>
44-
<multivalued>
45-
^ self attributeAt: #initializers ifAbsentPut: [ FMMultivalueLink on: self opposite: #collectionInitializers: ]
46-
]
47-
48-
{ #category : 'accessing' }
49-
FASTPyList >> initializers: anObject [
50-
51-
<generated>
52-
self initializers value: anObject
53-
]
54-
55-
{ #category : 'navigation' }
56-
FASTPyList >> initializersGroup [
57-
<generated>
58-
<navigation: 'Initializers'>
59-
^ MooseSpecializedGroup withAll: self initializers asSet
60-
]

0 commit comments

Comments
 (0)