X Tutup
Skip to content

Commit 59552a5

Browse files
author
Johan Brichau
committed
Ported all transformation Slime rules
1 parent 1ec525d commit 59552a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+364
-9
lines changed

repository/Grease-Pharo110-Slime.package/GRAnsiCollectionsRule.class/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
group
3+
4+
^ 'ANSI Compatibility'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
initialization
2+
initialize
3+
super initialize.
4+
self
5+
replace: '``@collection withIndexDo: [ :`each :`index | | `@temps | ``@.body ]'
6+
with: '``@collection keysAndValuesDo: [ :`index :`each | | `@temps | ``@.body ]';
7+
replace: '``@collection doWithIndex: [ :`each :`index | | `@temps | ``@.body ]'
8+
with: '``@collection keysAndValuesDo: [ :`index :`each | | `@temps | ``@.body ]';
9+
replace: '``@collection collect: ``@block1 thenDo: ``@block2'
10+
with: '(``@collection collect: ``@block1) do: ``@block2';
11+
replace: '``@collection collect: ``@block1 thenSelect: ``@block2'
12+
with: '(``@collection collect: ``@block1) select: ``@block2';
13+
replace: '``@collection pairsDo: [ :`t1 :`t2 | ``@.statements ]'
14+
with: '1 to: ``@collection size by: 2 do: [ :index | | `t1 `t2 | `t1 := ``@collection at: index. `t2 := ``@collection at: index + 1. ``@.statements ]';
15+
replace: '``@collection reject: ``@block1 thenDo: ``@block2'
16+
with: '(``@collection reject: ``@block1) do: ``@block2';
17+
replace: '``@collection select: ``@block1 thenCollect: ``@block2'
18+
with: '(``@collection select: ``@block1) collect: ``@block2';
19+
replace: '``@collection select: ``@block1 thenDo: ``@block2'
20+
with: '(``@collection select: ``@block1) do: ``@block2';
21+
replace: '``@collection detectSum: [ :`t1 | ``@.statements. `.last ]'
22+
with: '``@collection inject: 0 into: [ :sum :`t1 | ``@.statements. sum + (`.last) ]';
23+
replace: '``@collection valuesDo: ``@block'
24+
with: '``@collection do: ``@block';
25+
replace: '``@collection reversed'
26+
with: '``@collection reverse';
27+
replace: '``@dictionary keysSortedSafely'
28+
with: '``@dictionary keys asSortedCollection';
29+
replace: '``@collectionClass new: ``@size withAll: ``@character'
30+
with: '(``@collectionClass new: ``@size) atAllPut: ``@character'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
name
3+
4+
^ 'Collections'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
rationale
3+
4+
^ 'Some collection methods are not ANSI compatible: #pairsDo:, #collect:thenDo:, #reject:thenDo:, #detectSum:, #valuesDo:, #keysSortedSafely, #new:withAll:, etc.'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "",
3+
"super" : "GRReSlimeTransformationRule",
4+
"category" : "Grease-Pharo110-Slime",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "GRAnsiCollectionsRule",
10+
"type" : "normal"
11+
}

repository/Grease-Pharo110-Slime.package/GRAnsiConditionalsRule.class/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
group
3+
4+
^ 'ANSI Compatibility'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
initialization
2+
initialize
3+
4+
super initialize.
5+
self
6+
replace: '``@boolean ifNotNilDo: ``@block'
7+
with: '``@boolean ifNotNil: ``@block';
8+
replace: '``@boolean ifNotNilDo: ``@block1 ifNil: ``@block2'
9+
with: '``@boolean ifNotNil: ``@block1 ifNil: ``@block2';
10+
replace: '``@boolean ifNil: ``@block1 ifNotNilDo: ``@block2'
11+
with: '``@boolean ifNil: ``@block1 ifNotNil: ``@block2';
12+
replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ]'
13+
with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ]';
14+
replace: '``@boolean ifNotNil: [ | `@temps | ``@.body ] ifNil: ``@block '
15+
with: '``@boolean ifNotNil: [ :arg | | `@temps | ``@.body ] ifNil: ``@block';
16+
replace: '``@boolean ifNil: ``@block ifNotNil: [ | `@temps | ``@.body ]'
17+
with: '``@boolean ifNil: ``@block ifNotNil: [ :arg | | `@temps | ``@.body ]'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
accessing
2+
name
3+
4+
^ 'Conditionals'

0 commit comments

Comments
 (0)
X Tutup