tdd this shit
This commit is contained in:
parent
f0f71075f1
commit
e576ade39b
30 changed files with 103 additions and 0 deletions
1
test/parser/02.in
Normal file
1
test/parser/02.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
5 + 3
|
||||||
5
test/parser/02.out
Normal file
5
test/parser/02.out
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
BinOp(+)
|
||||||
|
Number(5)
|
||||||
|
Number(3)
|
||||||
2
test/parser/03.in
Normal file
2
test/parser/03.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
42
|
||||||
|
17
|
||||||
5
test/parser/03.out
Normal file
5
test/parser/03.out
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Number(42)
|
||||||
|
ExprStmt
|
||||||
|
Number(17)
|
||||||
1
test/parser/04.in
Normal file
1
test/parser/04.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
x
|
||||||
3
test/parser/04.out
Normal file
3
test/parser/04.out
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Identifier(x)
|
||||||
1
test/parser/05.in
Normal file
1
test/parser/05.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
x = 5
|
||||||
4
test/parser/05.out
Normal file
4
test/parser/05.out
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Module
|
||||||
|
Assign
|
||||||
|
Identifier(x)
|
||||||
|
Number(5)
|
||||||
1
test/parser/06.in
Normal file
1
test/parser/06.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
2 + 3 * 4
|
||||||
7
test/parser/06.out
Normal file
7
test/parser/06.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
BinOp(+)
|
||||||
|
Number(2)
|
||||||
|
BinOp(*)
|
||||||
|
Number(3)
|
||||||
|
Number(4)
|
||||||
1
test/parser/07.in
Normal file
1
test/parser/07.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
(2 + 3) * 4
|
||||||
7
test/parser/07.out
Normal file
7
test/parser/07.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
BinOp(*)
|
||||||
|
BinOp(+)
|
||||||
|
Number(2)
|
||||||
|
Number(3)
|
||||||
|
Number(4)
|
||||||
1
test/parser/08.in
Normal file
1
test/parser/08.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
foo()
|
||||||
4
test/parser/08.out
Normal file
4
test/parser/08.out
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Call
|
||||||
|
Identifier(foo)
|
||||||
1
test/parser/09.in
Normal file
1
test/parser/09.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
foo(1, 2)
|
||||||
6
test/parser/09.out
Normal file
6
test/parser/09.out
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Call
|
||||||
|
Identifier(foo)
|
||||||
|
Number(1)
|
||||||
|
Number(2)
|
||||||
1
test/parser/10.in
Normal file
1
test/parser/10.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
obj.method
|
||||||
4
test/parser/10.out
Normal file
4
test/parser/10.out
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
Attribute(.method)
|
||||||
|
Identifier(obj)
|
||||||
2
test/parser/11.in
Normal file
2
test/parser/11.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
if x:
|
||||||
|
y = 5
|
||||||
6
test/parser/11.out
Normal file
6
test/parser/11.out
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
Module
|
||||||
|
If
|
||||||
|
Identifier(x)
|
||||||
|
Assign
|
||||||
|
Identifier(y)
|
||||||
|
Number(5)
|
||||||
4
test/parser/12.in
Normal file
4
test/parser/12.in
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
if x:
|
||||||
|
y = 5
|
||||||
|
else:
|
||||||
|
y = 10
|
||||||
10
test/parser/12.out
Normal file
10
test/parser/12.out
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
Module
|
||||||
|
If
|
||||||
|
Identifier(x)
|
||||||
|
Assign
|
||||||
|
Identifier(y)
|
||||||
|
Number(5)
|
||||||
|
Else
|
||||||
|
Assign
|
||||||
|
Identifier(y)
|
||||||
|
Number(10)
|
||||||
2
test/parser/13.in
Normal file
2
test/parser/13.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
for i in items:
|
||||||
|
print(i)
|
||||||
7
test/parser/13.out
Normal file
7
test/parser/13.out
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Module
|
||||||
|
For(i)
|
||||||
|
Identifier(items)
|
||||||
|
ExprStmt
|
||||||
|
Call
|
||||||
|
Identifier(print)
|
||||||
|
Identifier(i)
|
||||||
2
test/parser/14.in
Normal file
2
test/parser/14.in
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
def add(a, b):
|
||||||
|
return a + b
|
||||||
8
test/parser/14.out
Normal file
8
test/parser/14.out
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
Module
|
||||||
|
FunctionDef(add)
|
||||||
|
Param(a)
|
||||||
|
Param(b)
|
||||||
|
Return
|
||||||
|
BinOp(+)
|
||||||
|
Identifier(a)
|
||||||
|
Identifier(b)
|
||||||
1
test/parser/15.in
Normal file
1
test/parser/15.in
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
[1, 2, 3]
|
||||||
6
test/parser/15.out
Normal file
6
test/parser/15.out
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
Module
|
||||||
|
ExprStmt
|
||||||
|
List
|
||||||
|
Number(1)
|
||||||
|
Number(2)
|
||||||
|
Number(3)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue