Skip to content

Commit 3c6c584

Browse files
Integrated P3GLambda, its test and P3GTuple from Python3Bridge project to P3Generator project with the help of alejandroinfante.
1 parent cc7ad1e commit 3c6c584

19 files changed

+101
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I am a Python 3 lambda.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
as yet unclassified
2+
argument: anIdentifier expression: aPythonExpression
3+
^ self arguments: (Array with: anIdentifier) expression: aPythonExpression
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
as yet unclassified
2+
arguments: listOfP3GI expression: aPythonExpression
3+
^ self new
4+
arguments: listOfP3GI;
5+
expression: aPythonExpression;
6+
yourself
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
as yet unclassified
2+
expression: aPythonExpression
3+
^ self arguments: #() expression: aPythonExpression
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
accessing
2+
arguments: anObject
3+
arguments := anObject
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
accessing
2+
arguments
3+
^ arguments
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
accessing
2+
expression: anObject
3+
expression := anObject
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
accessing
2+
expression
3+
^ expression
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
accessing
2+
writePython3On: aStream
3+
aStream << '(lambda '.
4+
arguments
5+
do: [ :arg | arg writePython3On: aStream ]
6+
separatedBy: [ aStream << ', ' ].
7+
aStream << ': '.
8+
expression writePython3On: aStream.
9+
aStream << ')'.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"classtraitcomposition" : "P3GCallable classTrait + P3GBinaryOperationSupport classTrait",
3+
"classvars" : [ ],
4+
"instvars" : [
5+
"arguments",
6+
"expression"
7+
],
8+
"name" : "P3GLambda",
9+
"commentStamp" : "JulienDelplanque 3/19/2019 21:16",
10+
"super" : "P3GGenerable",
11+
"traitcomposition" : "P3GCallable + P3GBinaryOperationSupport",
12+
"type" : "normal",
13+
"classinstvars" : [ ],
14+
"pools" : [ ],
15+
"category" : "Python3Generator-Core"
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A P3GLambdaTest is a test class for testing the behavior of P3GLambda
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tests
2+
assertCode: expr equals: targetStr
3+
| string |
4+
string := String streamContents: [ :s | expr writePython3On: s ].
5+
self assert: string equals: targetStr
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tests
2+
testMultipleArguments
3+
| lambda |
4+
lambda := P3GLambda
5+
arguments: (Array with: #a asP3GI with: #b asP3GI with: #c asP3GI)
6+
expression: #a asP3GI + (#b asP3GI callWith: (Array with: #c asP3GI)).
7+
self assertCode: lambda equals: '(lambda a, b, c: a+b(c))'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tests
2+
testReturn1
3+
self assertCode: (P3GLambda expression: 1) equals: '(lambda : 1)'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tests
2+
testSingleArgument
3+
self assertCode: (P3GLambda argument: #a asP3GI expression: #a asP3GI + 1) equals: '(lambda a: a+1)'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "JulienDelplanque 3/19/2019 21:18",
3+
"super" : "TestCase",
4+
"category" : "Python3Generator-Tests",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "P3GLambdaTest",
10+
"type" : "normal"
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
I model a Python 3 typle.
2+
That is to say, I will be written as a Python 3 tuple when serialized as source code.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
writing
2+
writePython3On: aStream
3+
aStream << '('.
4+
self
5+
do: [ :elem |
6+
elem writePython3On: aStream.
7+
aStream << ',' ].
8+
aStream << ')'.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "JulienDelplanque 3/19/2019 21:17",
3+
"super" : "OrderedCollection",
4+
"category" : "Python3Generator-Core",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "P3GTuple",
10+
"type" : "normal"
11+
}

0 commit comments

Comments
 (0)