Skip to content

Commit bc88524

Browse files
committed
Merge list and dicitonary splat
1 parent 3877b94 commit bc88524

22 files changed

Lines changed: 119 additions & 176 deletions

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Class {
3232
'dictPattern',
3333
'dictionary',
3434
'dictionaryComprehension',
35-
'dictionarySplat',
3635
'dottedName',
3736
'elifClause',
3837
'ellipsis',
@@ -65,7 +64,6 @@ Class {
6564
'list',
6665
'listComprehension',
6766
'listPattern',
68-
'listSplat',
6967
'matchStatement',
7068
'memberType',
7169
'module',
@@ -138,7 +136,6 @@ Class {
138136
'tDecoratorExpression',
139137
'tWithElseClause',
140138
'tWithComment',
141-
'collectionSplat',
142139
'tAsPatternTarget',
143140
'tAsPatternSource',
144141
'tWithStatementItem',
@@ -156,7 +153,8 @@ Class {
156153
'tDeletable',
157154
'tTypeContent',
158155
'typeParameter',
159-
'tWithTypeParameters'
156+
'tWithTypeParameters',
157+
'splat'
160158
],
161159
#category : 'FAST-Python-Model-Generator',
162160
#package : 'FAST-Python-Model-Generator'
@@ -203,7 +201,6 @@ FASTPythonMetamodelGenerator >> defineClasses [
203201
classDefinition withTesting.
204202
classPattern := builder ensureClassNamed: #ClassPattern."Todo"
205203
collectionInitializer := builder ensureClassNamed: #CollectionInitializer.
206-
(collectionSplat := builder ensureClassNamed: #CollectionSplat) comment: 'In Python a collection (list or dictionary) splat is the unpacking of a collection in a call or in the definition of another definition like `[ *list , 4 ]` or `func(*list)`'.
207204
comment := builder ensureClassNamed: #Comment."Todo"
208205
comparisonOperator := builder ensureClassNamed: #ComparisonOperator.
209206
complex := builder ensureClassNamed: #Complex.
@@ -215,7 +212,6 @@ FASTPythonMetamodelGenerator >> defineClasses [
215212
deleteStatement := builder ensureClassNamed: #DeleteStatement.
216213
dictionary := builder ensureClassNamed: #Dictionary."To Review"
217214
dictionaryComprehension := builder ensureClassNamed: #DictionaryComprehension."Todo"
218-
dictionarySplat := builder ensureClassNamed: #DictionarySplat."Todo"
219215
dictionarySplatParameter := builder ensureClassNamed: #DictionarySplatParameter."Todo"
220216
dottedName := builder ensureClassNamed: #DottedName."Todo"
221217
elifClause := builder ensureClassNamed: #ElifClause."Todo"
@@ -252,7 +248,6 @@ FASTPythonMetamodelGenerator >> defineClasses [
252248
lambdaParameters := builder ensureClassNamed: #LambdaParameters."Todo"
253249
list := builder ensureClassNamed: #List.
254250
listComprehension := builder ensureClassNamed: #ListComprehension."Todo"
255-
listSplat := builder ensureClassNamed: #ListSplat."To Review"
256251
listSplatParameter := builder ensureClassNamed: #ListSplatParameter."Todo"
257252
literal := builder ensureClassNamed: #Literal.
258253
matchStatement := builder ensureClassNamed: #MatchStatement."Todo"
@@ -275,6 +270,7 @@ FASTPythonMetamodelGenerator >> defineClasses [
275270
set := builder ensureClassNamed: #Set.
276271
setComprehension := builder ensureClassNamed: #SetComprehension."Todo"
277272
slice := builder ensureClassNamed: #Slice. "To review"
273+
(splat := builder ensureClassNamed: #Splat) comment: 'In Python a collection (list or dictionary) splat is the unpacking of a collection in a call or in the definition of another definition like `[ *list , 4 ]` or `func(*list)`'.
278274
splatType := builder ensureClassNamed: #SplatType."Todo"
279275
statement := builder ensureClassNamed: #Statement.
280276
string := builder ensureClassNamed: #String.
@@ -358,9 +354,6 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
358354
collectionInitializer --|> tSplatExpression.
359355
collectionInitializer --|> tPattern.
360356

361-
collectionSplat --|> expression.
362-
collectionSplat --|> tPattern.
363-
364357
comment --|> tComment.
365358

366359
comparisonOperator --|> operator.
@@ -384,8 +377,6 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
384377
dictionaryComprehension --|> expression.
385378
dictionaryComprehension --|> tComprehension.
386379

387-
dictionarySplat --|> collectionSplat.
388-
389380
dictionarySplatParameter --|> parameter.
390381
dictionarySplatParameter --|> tSplatParameter.
391382

@@ -471,8 +462,6 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
471462

472463
listComprehension --|> expression.
473464
listComprehension --|> tComprehension.
474-
475-
listSplat --|> collectionSplat.
476465

477466
listSplatParameter --|> parameter.
478467
listSplatParameter --|> tSplatParameter.
@@ -525,6 +514,9 @@ FASTPythonMetamodelGenerator >> defineHierarchy [
525514

526515
slice --|> expression.
527516

517+
splat --|> expression.
518+
splat --|> tPattern.
519+
528520
splatType --|> tTypeContent.
529521
splatType --|> tNamedEntity.
530522

@@ -665,8 +657,6 @@ FASTPythonMetamodelGenerator >> defineRelations [
665657
((collectionInitializer property: #initializers) comment: 'Each initializer defines one element.')
666658
<>-* ((expression property: #collectionInitializer) comment: 'The owner of the expression').
667659

668-
(collectionSplat property: #expression) <>- (tSplatExpression property: #parentSplat).
669-
670660
((comparisonOperator property: #operands) comment:
671661
'List of the operands of the comparison operands. For example if we have `a == b != c`, it will be a, b and c.')
672662
<>-* ((expression property: #parentComparisonOperator) comment: 'Parent comparison expression of which I am.').
@@ -749,6 +739,8 @@ FASTPythonMetamodelGenerator >> defineRelations [
749739

750740
(raiseStatement property: #exception) <>- (tRaised property: #parentRaiseStatement).
751741

742+
(splat property: #expression) <>- (tSplatExpression property: #parentSplat).
743+
752744
((slice property: #components) comment: 'The components are the expressions between the `:` of a slice.')
753745
<>-* ((expression property: #sliceOwner) comment: 'Slice in which I am a component (start, end or step) (If it''s the case)'''). "Originally, I created a trait for Slice content because the python syntax does not allow all expressions. But multiple libraries are changing the syntax to accept other objects such as float, list or even string. So now I point FASTPyExpression to not fail on all those cases."
754746

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
| `parentDeclarator` | `FASTPyTDecoratorExpression` | `expression` | `FASTPyDecorator` | |
1212
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1313
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
14-
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
14+
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
1515
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPyTSplatParameter` | |
1616
1717
### Children

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1515
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
1616
| `parentKeywordPatternValue` | `FASTPyTPattern` | `value` | `FASTPyKeywordPattern` | |
17-
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
17+
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
1818
| `parentUnionPattern` | `FASTPyTPattern` | `members` | `FASTPyUnionPattern` | |
1919
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
2020

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1414
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
1515
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
16-
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
16+
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
1717
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
1818
1919
### Children

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
| `parentExpressionLeft` | `FASTTExpression` | `leftOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am left side|
1818
| `parentExpressionRight` | `FASTTExpression` | `rightOperand` | `FASTTBinaryExpression` | Parent (binary) expression of which I am right side|
1919
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
20-
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
20+
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
2121
| `parentWithStatementItem` | `FASTPyTWithStatementItem` | `items` | `FASTPyWithStatement` | |
2222
| `returnOwner` | `FASTTExpression` | `expression` | `FASTTReturnStatement` | The return statement that own the expression (if it's the case)|
2323

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
|---|
88
| `parentCaseClause` | `FASTPyTPattern` | `pattern` | `FASTPyCaseClause` | |
99
| `parentKeywordPatternValue` | `FASTPyTPattern` | `value` | `FASTPyKeywordPattern` | |
10-
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
10+
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
1111
| `parentUnionPattern` | `FASTPyTPattern` | `members` | `FASTPyUnionPattern` | |
1212
1313
### Children

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Parents
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
8-
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
8+
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
99
1010
### Children
1111
| Relation | Origin | Opposite | Type | Comment |

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

Lines changed: 0 additions & 16 deletions
This file was deleted.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Parents
66
| Relation | Origin | Opposite | Type | Comment |
77
|---|
8-
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
8+
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
99
1010
### Children
1111
| Relation | Origin | Opposite | Type | Comment |

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| `parentDeclarator` | `FASTPyTDecoratorExpression` | `expression` | `FASTPyDecorator` | |
1313
| `parentDeleteStatement` | `FASTPyTDeletable` | `expression` | `FASTPyDeleteStatement` | The delete statement that own the expression (if it's the case)|
1414
| `parentRaiseStatement` | `FASTPyTRaised` | `exception` | `FASTPyRaiseStatement` | |
15-
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPyCollectionSplat` | |
15+
| `parentSplat` | `FASTPyTSplatExpression` | `expression` | `FASTPySplat` | |
1616
| `parentSplatParameter` | `FASTPyTSplatParameterTarget` | `target` | `FASTPyTSplatParameter` | |
1717
1818

0 commit comments

Comments
 (0)