This commit is contained in:
Mark Shannon 2019-01-17 11:21:59 +00:00
Родитель 7b8468d81b
Коммит 73095c53b8
3 изменённых файлов: 365 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,257 @@
| test.py:0:0 | Module test | test.py:5:1 | ClassDef |
| test.py:0:0 | Module test | test.py:11:1 | FunctionDef |
| test.py:0:0 | Module test | test.py:14:1 | FunctionDef |
| test.py:0:0 | Module test | test.py:17:1 | FunctionDef |
| test.py:0:0 | Module test | test.py:51:1 | FunctionDef |
| test.py:2:2 | deco1() | test.py:2:2 | deco1 |
| test.py:2:2 | deco1() | test.py:3:1 | deco2()() |
| test.py:3:1 | deco2() | test.py:3:2 | deco2 |
| test.py:3:1 | deco2()() | test.py:3:1 | deco2() |
| test.py:3:1 | deco2()() | test.py:4:2 | Attribute() |
| test.py:4:2 | Attribute | test.py:4:2 | Attribute |
| test.py:4:2 | Attribute | test.py:4:2 | deco3 |
| test.py:4:2 | Attribute() | test.py:4:2 | Attribute |
| test.py:4:2 | Attribute() | test.py:5:1 | ClassExpr |
| test.py:5:1 | Class C | test.py:7:5 | FunctionDef |
| test.py:5:1 | ClassDef | test.py:2:2 | deco1() |
| test.py:5:1 | ClassDef | test.py:5:7 | C |
| test.py:5:1 | ClassExpr | test.py:5:1 | Class C |
| test.py:5:1 | ClassExpr | test.py:5:9 | Base |
| test.py:7:5 | Function __init__ | test.py:7:18 | self |
| test.py:7:5 | Function __init__ | test.py:8:9 | Pass |
| test.py:7:5 | FunctionDef | test.py:7:5 | FunctionExpr |
| test.py:7:5 | FunctionDef | test.py:7:9 | __init__ |
| test.py:7:5 | FunctionExpr | test.py:7:5 | Function __init__ |
| test.py:10:1 | Attribute() | test.py:10:2 | Attribute |
| test.py:10:1 | Attribute()() | test.py:10:1 | Attribute() |
| test.py:10:1 | Attribute()() | test.py:11:1 | FunctionExpr |
| test.py:10:2 | Attribute | test.py:10:2 | deco4 |
| test.py:11:1 | Function f | test.py:12:5 | Pass |
| test.py:11:1 | FunctionDef | test.py:10:1 | Attribute()() |
| test.py:11:1 | FunctionDef | test.py:11:5 | f |
| test.py:11:1 | FunctionExpr | test.py:11:1 | Function f |
| test.py:14:1 | Function f | test.py:14:7 | pos0 |
| test.py:14:1 | Function f | test.py:14:13 | pos1 |
| test.py:14:1 | Function f | test.py:14:20 | args |
| test.py:14:1 | Function f | test.py:14:28 | kwargs |
| test.py:14:1 | Function f | test.py:15:5 | Pass |
| test.py:14:1 | FunctionDef | test.py:14:1 | FunctionExpr |
| test.py:14:1 | FunctionDef | test.py:14:5 | f |
| test.py:14:1 | FunctionExpr | test.py:14:1 | Function f |
| test.py:17:1 | Function simple_stmts | test.py:18:5 | Pass |
| test.py:17:1 | Function simple_stmts | test.py:19:5 | ExprStmt |
| test.py:17:1 | Function simple_stmts | test.py:19:13 | Delete |
| test.py:17:1 | Function simple_stmts | test.py:19:20 | Pass |
| test.py:17:1 | Function simple_stmts | test.py:20:5 | If |
| test.py:17:1 | Function simple_stmts | test.py:24:5 | AssignStmt |
| test.py:17:1 | Function simple_stmts | test.py:44:5 | ExprStmt |
| test.py:17:1 | Function simple_stmts | test.py:45:5 | ExprStmt |
| test.py:17:1 | Function simple_stmts | test.py:46:5 | ExprStmt |
| test.py:17:1 | Function simple_stmts | test.py:47:5 | ExprStmt |
| test.py:17:1 | Function simple_stmts | test.py:48:5 | ExprStmt |
| test.py:17:1 | Function simple_stmts | test.py:49:5 | ExprStmt |
| test.py:17:1 | FunctionDef | test.py:17:1 | FunctionExpr |
| test.py:17:1 | FunctionDef | test.py:17:5 | simple_stmts |
| test.py:17:1 | FunctionExpr | test.py:17:1 | Function simple_stmts |
| test.py:19:5 | ExprStmt | test.py:19:5 | foo() |
| test.py:19:5 | foo() | test.py:19:5 | foo |
| test.py:19:13 | Delete | test.py:19:17 | x |
| test.py:20:5 | If | test.py:20:8 | thing |
| test.py:20:5 | If | test.py:21:9 | For |
| test.py:21:9 | For | test.py:21:13 | a |
| test.py:21:9 | For | test.py:21:18 | b |
| test.py:21:9 | For | test.py:22:13 | Pass |
| test.py:24:5 | AssignStmt | test.py:24:5 | tmp |
| test.py:24:5 | AssignStmt | test.py:25:9 | Yield |
| test.py:25:9 | Yield | test.py:25:15 | Tuple |
| test.py:25:15 | Tuple | test.py:25:15 | IntegerLiteral |
| test.py:25:15 | Tuple | test.py:26:9 | name |
| test.py:25:15 | Tuple | test.py:27:9 | Attribute |
| test.py:25:15 | Tuple | test.py:28:9 | BinaryExpr |
| test.py:25:15 | Tuple | test.py:29:9 | BinaryExpr |
| test.py:25:15 | Tuple | test.py:30:9 | BinaryExpr |
| test.py:25:15 | Tuple | test.py:31:9 | Attribute |
| test.py:25:15 | Tuple | test.py:32:9 | Subscript |
| test.py:25:15 | Tuple | test.py:33:9 | Lambda |
| test.py:25:15 | Tuple | test.py:34:9 | BoolExpr |
| test.py:25:15 | Tuple | test.py:35:9 | Compare |
| test.py:25:15 | Tuple | test.py:36:9 | DictComp |
| test.py:25:15 | Tuple | test.py:37:9 | SetComp |
| test.py:25:15 | Tuple | test.py:38:9 | ListComp |
| test.py:25:15 | Tuple | test.py:39:9 | List |
| test.py:25:15 | Tuple | test.py:40:9 | Dict |
| test.py:25:15 | Tuple | test.py:41:9 | Tuple |
| test.py:25:15 | Tuple | test.py:42:10 | Tuple |
| test.py:27:9 | Attribute | test.py:27:9 | attr |
| test.py:28:9 | BinaryExpr | test.py:28:9 | a |
| test.py:28:9 | BinaryExpr | test.py:28:13 | b |
| test.py:29:9 | BinaryExpr | test.py:29:9 | IntegerLiteral |
| test.py:29:9 | BinaryExpr | test.py:29:13 | IntegerLiteral |
| test.py:30:9 | BinaryExpr | test.py:30:9 | FloatLiteral |
| test.py:30:9 | BinaryExpr | test.py:30:15 | IntegerLiteral |
| test.py:31:9 | Attribute | test.py:31:9 | Attribute |
| test.py:31:9 | Attribute | test.py:31:9 | a |
| test.py:32:9 | Attribute | test.py:32:9 | a() |
| test.py:32:9 | Subscript | test.py:32:9 | Attribute |
| test.py:32:9 | Subscript | test.py:32:15 | c |
| test.py:32:9 | a() | test.py:32:9 | a |
| test.py:33:9 | Function lambda | test.py:33:16 | x |
| test.py:33:9 | Function lambda | test.py:33:19 | Return |
| test.py:33:9 | Lambda | test.py:33:9 | Function lambda |
| test.py:33:19 | BinaryExpr | test.py:33:19 | x |
| test.py:33:19 | BinaryExpr | test.py:33:21 | IntegerLiteral |
| test.py:33:19 | Return | test.py:33:19 | BinaryExpr |
| test.py:34:9 | BoolExpr | test.py:34:9 | p |
| test.py:34:9 | BoolExpr | test.py:34:14 | BoolExpr |
| test.py:34:14 | BoolExpr | test.py:34:14 | q |
| test.py:34:14 | BoolExpr | test.py:34:20 | BinaryExpr |
| test.py:34:20 | BinaryExpr | test.py:34:20 | r |
| test.py:34:20 | BinaryExpr | test.py:34:24 | s |
| test.py:35:9 | Compare | test.py:35:9 | a |
| test.py:35:9 | Compare | test.py:35:13 | b |
| test.py:35:9 | Compare | test.py:35:17 | c |
| test.py:35:9 | Compare | test.py:35:22 | IntegerLiteral |
| test.py:36:9 | DictComp | test.py:36:9 | Function dictcomp |
| test.py:36:9 | DictComp | test.py:36:26 | x |
| test.py:36:9 | For | test.py:36:9 | .0 |
| test.py:36:9 | For | test.py:36:9 | For |
| test.py:36:9 | For | test.py:36:11 | ExprStmt |
| test.py:36:9 | For | test.py:36:21 | z |
| test.py:36:9 | For | test.py:36:32 | y |
| test.py:36:9 | For | test.py:36:37 | z |
| test.py:36:9 | Function dictcomp | test.py:36:9 | .0 |
| test.py:36:9 | Function dictcomp | test.py:36:9 | For |
| test.py:36:11 | ExprStmt | test.py:36:11 | Yield |
| test.py:36:11 | Tuple | test.py:36:11 | IntegerLiteral |
| test.py:36:11 | Tuple | test.py:36:15 | y |
| test.py:36:11 | Yield | test.py:36:11 | Tuple |
| test.py:37:9 | For | test.py:37:9 | .0 |
| test.py:37:9 | For | test.py:37:9 | For |
| test.py:37:9 | For | test.py:37:12 | ExprStmt |
| test.py:37:9 | For | test.py:37:22 | z |
| test.py:37:9 | For | test.py:37:33 | y |
| test.py:37:9 | For | test.py:37:38 | z |
| test.py:37:9 | Function setcomp | test.py:37:9 | .0 |
| test.py:37:9 | Function setcomp | test.py:37:9 | For |
| test.py:37:9 | SetComp | test.py:37:9 | Function setcomp |
| test.py:37:9 | SetComp | test.py:37:27 | x |
| test.py:37:12 | ExprStmt | test.py:37:12 | Yield |
| test.py:37:12 | Tuple | test.py:37:12 | IntegerLiteral |
| test.py:37:12 | Tuple | test.py:37:15 | y |
| test.py:37:12 | Yield | test.py:37:12 | Tuple |
| test.py:38:9 | For | test.py:38:9 | .0 |
| test.py:38:9 | For | test.py:38:11 | ExprStmt |
| test.py:38:9 | For | test.py:38:20 | y |
| test.py:38:9 | Function listcomp | test.py:38:9 | .0 |
| test.py:38:9 | Function listcomp | test.py:38:9 | For |
| test.py:38:9 | ListComp | test.py:38:9 | Function listcomp |
| test.py:38:9 | ListComp | test.py:38:25 | z |
| test.py:38:11 | BinaryExpr | test.py:38:11 | y |
| test.py:38:11 | BinaryExpr | test.py:38:14 | IntegerLiteral |
| test.py:38:11 | ExprStmt | test.py:38:11 | Yield |
| test.py:38:11 | Yield | test.py:38:11 | BinaryExpr |
| test.py:42:10 | Tuple | test.py:42:10 | IntegerLiteral |
| test.py:44:5 | ExprStmt | test.py:44:5 | foo() |
| test.py:44:5 | foo() | test.py:44:5 | foo |
| test.py:44:5 | foo() | test.py:44:9 | IntegerLiteral |
| test.py:45:5 | ExprStmt | test.py:45:5 | foo() |
| test.py:45:5 | foo() | test.py:45:5 | foo |
| test.py:45:5 | foo() | test.py:45:9 | Keyword |
| test.py:45:9 | Keyword | test.py:45:11 | IntegerLiteral |
| test.py:46:5 | ExprStmt | test.py:46:5 | foo() |
| test.py:46:5 | foo() | test.py:46:5 | foo |
| test.py:46:5 | foo() | test.py:46:9 | IntegerLiteral |
| test.py:46:5 | foo() | test.py:46:11 | IntegerLiteral |
| test.py:46:5 | foo() | test.py:46:13 | Starred |
| test.py:46:13 | Starred | test.py:46:14 | t |
| test.py:47:5 | ExprStmt | test.py:47:5 | foo() |
| test.py:47:5 | foo() | test.py:47:5 | foo |
| test.py:47:5 | foo() | test.py:47:9 | IntegerLiteral |
| test.py:47:5 | foo() | test.py:47:11 | Keyword |
| test.py:47:5 | foo() | test.py:47:15 | Starred |
| test.py:47:11 | Keyword | test.py:47:13 | IntegerLiteral |
| test.py:47:15 | Starred | test.py:47:16 | t |
| test.py:48:5 | ExprStmt | test.py:48:5 | foo() |
| test.py:48:5 | foo() | test.py:48:5 | foo |
| test.py:48:5 | foo() | test.py:48:9 | IntegerLiteral |
| test.py:48:5 | foo() | test.py:48:11 | Keyword |
| test.py:48:5 | foo() | test.py:48:15 | Starred |
| test.py:48:5 | foo() | test.py:48:18 | DictUnpacking |
| test.py:48:11 | Keyword | test.py:48:13 | IntegerLiteral |
| test.py:48:15 | Starred | test.py:48:16 | t |
| test.py:48:18 | DictUnpacking | test.py:48:20 | d |
| test.py:49:5 | ExprStmt | test.py:49:5 | f() |
| test.py:49:5 | f() | test.py:49:5 | f |
| test.py:49:5 | f() | test.py:49:7 | DictUnpacking |
| test.py:49:7 | DictUnpacking | test.py:49:9 | d |
| test.py:51:1 | Function compound_stmts | test.py:52:5 | If |
| test.py:51:1 | Function compound_stmts | test.py:56:5 | While |
| test.py:51:1 | Function compound_stmts | test.py:61:5 | For |
| test.py:51:1 | Function compound_stmts | test.py:63:5 | With |
| test.py:51:1 | Function compound_stmts | test.py:65:5 | Try |
| test.py:51:1 | Function compound_stmts | test.py:69:5 | Try |
| test.py:51:1 | Function compound_stmts | test.py:73:5 | Try |
| test.py:51:1 | Function compound_stmts | test.py:77:5 | Try |
| test.py:51:1 | Function compound_stmts | test.py:81:5 | Try |
| test.py:51:1 | Function compound_stmts | test.py:87:5 | Try |
| test.py:51:1 | FunctionDef | test.py:51:1 | FunctionExpr |
| test.py:51:1 | FunctionDef | test.py:51:5 | compound_stmts |
| test.py:51:1 | FunctionExpr | test.py:51:1 | Function compound_stmts |
| test.py:52:5 | If | test.py:52:8 | cond |
| test.py:52:5 | If | test.py:53:9 | Return |
| test.py:52:5 | If | test.py:55:9 | Raise |
| test.py:53:9 | Return | test.py:53:16 | x |
| test.py:55:9 | Raise | test.py:55:15 | y |
| test.py:56:5 | While | test.py:56:11 | True |
| test.py:56:5 | While | test.py:57:9 | If |
| test.py:57:9 | If | test.py:57:12 | cond |
| test.py:57:9 | If | test.py:58:13 | Break |
| test.py:57:9 | If | test.py:60:13 | Continue |
| test.py:61:5 | For | test.py:61:9 | x |
| test.py:61:5 | For | test.py:61:14 | y |
| test.py:61:5 | For | test.py:62:9 | Pass |
| test.py:63:5 | With | test.py:63:5 | With |
| test.py:63:5 | With | test.py:63:10 | a |
| test.py:63:5 | With | test.py:63:15 | b |
| test.py:63:5 | With | test.py:63:18 | c |
| test.py:63:5 | With | test.py:63:23 | d |
| test.py:63:5 | With | test.py:64:9 | ExprStmt |
| test.py:64:9 | ExprStmt | test.py:64:9 | body |
| test.py:65:5 | Try | test.py:66:9 | ExprStmt |
| test.py:65:5 | Try | test.py:67:5 | ExceptStmt |
| test.py:66:9 | ExprStmt | test.py:66:9 | t1 |
| test.py:67:5 | ExceptStmt | test.py:68:9 | ExprStmt |
| test.py:68:9 | ExprStmt | test.py:68:9 | e1 |
| test.py:69:5 | Try | test.py:70:9 | ExprStmt |
| test.py:69:5 | Try | test.py:71:5 | ExceptStmt |
| test.py:70:9 | ExprStmt | test.py:70:9 | t2 |
| test.py:71:5 | ExceptStmt | test.py:71:12 | Exception |
| test.py:71:5 | ExceptStmt | test.py:72:9 | ExprStmt |
| test.py:72:9 | ExprStmt | test.py:72:9 | e2 |
| test.py:73:5 | Try | test.py:74:9 | ExprStmt |
| test.py:73:5 | Try | test.py:75:5 | ExceptStmt |
| test.py:74:9 | ExprStmt | test.py:74:9 | t3 |
| test.py:75:5 | ExceptStmt | test.py:75:12 | Exception |
| test.py:75:5 | ExceptStmt | test.py:75:25 | ex |
| test.py:75:5 | ExceptStmt | test.py:76:9 | ExprStmt |
| test.py:76:9 | ExprStmt | test.py:76:9 | e3 |
| test.py:77:5 | Try | test.py:78:9 | ExprStmt |
| test.py:77:5 | Try | test.py:80:9 | ExprStmt |
| test.py:78:9 | ExprStmt | test.py:78:9 | t4 |
| test.py:80:9 | ExprStmt | test.py:80:9 | f4 |
| test.py:81:5 | Try | test.py:82:9 | ExprStmt |
| test.py:81:5 | Try | test.py:83:5 | ExceptStmt |
| test.py:81:5 | Try | test.py:86:9 | ExprStmt |
| test.py:82:9 | ExprStmt | test.py:82:9 | t5 |
| test.py:83:5 | ExceptStmt | test.py:83:12 | Exception |
| test.py:83:5 | ExceptStmt | test.py:83:25 | ex |
| test.py:83:5 | ExceptStmt | test.py:84:9 | ExprStmt |
| test.py:84:9 | ExprStmt | test.py:84:9 | e5 |
| test.py:86:9 | ExprStmt | test.py:86:9 | f5 |
| test.py:87:5 | Try | test.py:88:9 | ExprStmt |
| test.py:87:5 | Try | test.py:90:9 | Try |
| test.py:88:9 | ExprStmt | test.py:88:9 | t6 |
| test.py:90:9 | Try | test.py:91:13 | ExprStmt |
| test.py:90:9 | Try | test.py:93:13 | ExprStmt |
| test.py:91:13 | ExprStmt | test.py:91:13 | t7 |
| test.py:93:13 | ExprStmt | test.py:93:13 | f7 |

Просмотреть файл

@ -0,0 +1,14 @@
import python
string loc(AstNode a) {
exists(Location l |
l = a.getLocation() |
result = l.getFile().getBaseName() + ":" + l.getStartLine() + ":" + l.getStartColumn()
)
}
from AstNode p, AstNode c
where p.getAChildNode() = c
select loc(p), p.toString(), loc(c), c.toString()

Просмотреть файл

@ -0,0 +1,94 @@
@deco1
@deco2()
@deco3.attr1.attr2
class C(Base):
def __init__(self):
pass
@deco4.attr()
def f():
pass
def f(pos0, pos1, *args, **kwargs):
pass
def simple_stmts():
pass
foo() ; del x; pass
if thing:
for a in b:
pass
#Expressions
tmp = (
yield 3,
name,
attr.attrname,
a + b,
3 & 4,
3.0 * 4,
a.b.c.d,
a().b[c],
lambda x: x+1,
p or q and r ^ s,
a < b > c in 5,
{ 1 : y for z in x for y in z},
{ (1, y) for z in x for y in z},
[ y**2 for y in z ],
[],
{},
(),
(1,),
)
foo(1)
foo(a=1)
foo(1,2,*t)
foo(1,a=1,*t)
foo(1,a=1,*t,**d)
f(**d)
def compound_stmts():
if cond:
return x
else:
raise y
while True:
if cond:
break
else:
continue
for x in y:
pass
with a as b, c as d:
body
try:
t1
except:
e1
try:
t2
except Exception:
e2
try:
t3
except Exception as ex:
e3
try:
t4
finally:
f4
try:
t5
except Exception as ex:
e5
finally:
f5
try:
t6
finally:
try:
t7
finally:
f7