Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 942802c

Browse files
committed
Add some line numbers missing in the native AST
1 parent b8ccf14 commit 942802c

31 files changed

+183
-178
lines changed

driver/normalizer/parser.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ var ToNoder = &native.ObjectToNoder{
7575
// FIXME: test[ast_type=Compare].comparators is a list?? (should be "right")
7676
}
7777

78-
// transUASTParserBuilder creates a parser that transform source code files into *uast.Node
79-
// and calculates the offset from the position
8078
func transformationParser(opts driver.UASTParserOptions) (tr driver.UASTParser, err error) {
8179
parser, err := native.ExecParser(ToNoder, opts.NativeBin)
8280
if err != nil {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
msgpack-python==0.4.8
2-
pydetector==0.8.0
2+
pydetector==0.8.1
33
-e git+git://github.com/python/mypy.git@0bb2d1680e8b9522108b38d203cb73021a617e64#egg=mypy-lang
44
typed-ast==1.0.1

native/python_package/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
install_requires=[
3434
"msgpack-python==0.4.8",
35-
"pydetector==0.8.0"
35+
"pydetector==0.8.1"
3636
],
3737
classifiers=[
3838
"Development Status :: 4 - Beta",

tests/bitwise.py.native

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
"lineno": 6,
188188
"op": {
189189
"ast_type": "BitAnd",
190-
"col_offset": 2,
190+
"col_offset": 1,
191191
"lineno": 6
192192
},
193193
"right": {
@@ -201,7 +201,7 @@
201201
"lineno": 6,
202202
"op": {
203203
"ast_type": "BitOr",
204-
"col_offset": 2,
204+
"col_offset": 1,
205205
"lineno": 6
206206
},
207207
"right": {

tests/bitwise.py.uast

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ Module {
417417
. . . . . . . . . Roles: BinaryExpressionOp,OpBitwiseAnd
418418
. . . . . . . . . TOKEN "&"
419419
. . . . . . . . . StartPosition: {
420-
. . . . . . . . . . Offset: 33
420+
. . . . . . . . . . Offset: 32
421421
. . . . . . . . . . Line: 6
422-
. . . . . . . . . . Col: 2
422+
. . . . . . . . . . Col: 1
423423
. . . . . . . . . }
424424
. . . . . . . . . Properties: {
425425
. . . . . . . . . . internalRole: op
@@ -444,9 +444,9 @@ Module {
444444
. . . . . . . Roles: BinaryExpressionOp,OpBitwiseOr
445445
. . . . . . . TOKEN "|"
446446
. . . . . . . StartPosition: {
447-
. . . . . . . . Offset: 33
447+
. . . . . . . . Offset: 32
448448
. . . . . . . . Line: 6
449-
. . . . . . . . Col: 2
449+
. . . . . . . . Col: 1
450450
. . . . . . . }
451451
. . . . . . . Properties: {
452452
. . . . . . . . internalRole: op

tests/booleanop.py.native

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"ops": [
3333
{
3434
"ast_type": "Eq",
35-
"col_offset": 2,
35+
"col_offset": 1,
3636
"lineno": 1
3737
}
3838
]
@@ -65,7 +65,7 @@
6565
"ops": [
6666
{
6767
"ast_type": "NotEq",
68-
"col_offset": 2,
68+
"col_offset": 1,
6969
"lineno": 2
7070
}
7171
]
@@ -127,12 +127,12 @@
127127
"ops": [
128128
{
129129
"ast_type": "Eq",
130-
"col_offset": 2,
130+
"col_offset": 1,
131131
"lineno": 4
132132
},
133133
{
134134
"ast_type": "Eq",
135-
"col_offset": 2,
135+
"col_offset": 1,
136136
"lineno": 4
137137
}
138138
]
@@ -172,12 +172,12 @@
172172
"ops": [
173173
{
174174
"ast_type": "Lt",
175-
"col_offset": 2,
175+
"col_offset": 1,
176176
"lineno": 5
177177
},
178178
{
179179
"ast_type": "Gt",
180-
"col_offset": 2,
180+
"col_offset": 1,
181181
"lineno": 5
182182
}
183183
]
@@ -217,12 +217,12 @@
217217
"ops": [
218218
{
219219
"ast_type": "Lt",
220-
"col_offset": 2,
220+
"col_offset": 1,
221221
"lineno": 6
222222
},
223223
{
224224
"ast_type": "NotEq",
225-
"col_offset": 2,
225+
"col_offset": 1,
226226
"lineno": 6
227227
}
228228
]

tests/booleanop.py.uast

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ Module {
7171
. . . . . . . . . Roles: OpEqual
7272
. . . . . . . . . TOKEN "=="
7373
. . . . . . . . . StartPosition: {
74-
. . . . . . . . . . Offset: 1
74+
. . . . . . . . . . Offset: 0
7575
. . . . . . . . . . Line: 1
76-
. . . . . . . . . . Col: 2
76+
. . . . . . . . . . Col: 1
7777
. . . . . . . . . }
7878
. . . . . . . . }
7979
. . . . . . . }
@@ -144,9 +144,9 @@ Module {
144144
. . . . . . . . . Roles: OpNotEqual
145145
. . . . . . . . . TOKEN "!="
146146
. . . . . . . . . StartPosition: {
147-
. . . . . . . . . . Offset: 8
147+
. . . . . . . . . . Offset: 7
148148
. . . . . . . . . . Line: 2
149-
. . . . . . . . . . Col: 2
149+
. . . . . . . . . . Col: 1
150150
. . . . . . . . . }
151151
. . . . . . . . }
152152
. . . . . . . }
@@ -280,18 +280,18 @@ Module {
280280
. . . . . . . . . Roles: OpEqual
281281
. . . . . . . . . TOKEN "=="
282282
. . . . . . . . . StartPosition: {
283-
. . . . . . . . . . Offset: 21
283+
. . . . . . . . . . Offset: 20
284284
. . . . . . . . . . Line: 4
285-
. . . . . . . . . . Col: 2
285+
. . . . . . . . . . Col: 1
286286
. . . . . . . . . }
287287
. . . . . . . . }
288288
. . . . . . . . 1: Eq {
289289
. . . . . . . . . Roles: OpEqual
290290
. . . . . . . . . TOKEN "=="
291291
. . . . . . . . . StartPosition: {
292-
. . . . . . . . . . Offset: 21
292+
. . . . . . . . . . Offset: 20
293293
. . . . . . . . . . Line: 4
294-
. . . . . . . . . . Col: 2
294+
. . . . . . . . . . Col: 1
295295
. . . . . . . . . }
296296
. . . . . . . . }
297297
. . . . . . . }
@@ -374,18 +374,18 @@ Module {
374374
. . . . . . . . . Roles: OpLessThan
375375
. . . . . . . . . TOKEN "<"
376376
. . . . . . . . . StartPosition: {
377-
. . . . . . . . . . Offset: 33
377+
. . . . . . . . . . Offset: 32
378378
. . . . . . . . . . Line: 5
379-
. . . . . . . . . . Col: 2
379+
. . . . . . . . . . Col: 1
380380
. . . . . . . . . }
381381
. . . . . . . . }
382382
. . . . . . . . 1: Gt {
383383
. . . . . . . . . Roles: OpGreaterThan
384384
. . . . . . . . . TOKEN ">"
385385
. . . . . . . . . StartPosition: {
386-
. . . . . . . . . . Offset: 33
386+
. . . . . . . . . . Offset: 32
387387
. . . . . . . . . . Line: 5
388-
. . . . . . . . . . Col: 2
388+
. . . . . . . . . . Col: 1
389389
. . . . . . . . . }
390390
. . . . . . . . }
391391
. . . . . . . }
@@ -468,18 +468,18 @@ Module {
468468
. . . . . . . . . Roles: OpLessThan
469469
. . . . . . . . . TOKEN "<"
470470
. . . . . . . . . StartPosition: {
471-
. . . . . . . . . . Offset: 43
471+
. . . . . . . . . . Offset: 42
472472
. . . . . . . . . . Line: 6
473-
. . . . . . . . . . Col: 2
473+
. . . . . . . . . . Col: 1
474474
. . . . . . . . . }
475475
. . . . . . . . }
476476
. . . . . . . . 1: NotEq {
477477
. . . . . . . . . Roles: OpNotEqual
478478
. . . . . . . . . TOKEN "!="
479479
. . . . . . . . . StartPosition: {
480-
. . . . . . . . . . Offset: 43
480+
. . . . . . . . . . Offset: 42
481481
. . . . . . . . . . Line: 6
482-
. . . . . . . . . . Col: 2
482+
. . . . . . . . . . Col: 1
483483
. . . . . . . . . }
484484
. . . . . . . . }
485485
. . . . . . . }

tests/classdef_metaclass_py3.py.native

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"arg": "metaclass",
2323
"ast_type": "keyword",
24-
"col_offset": 2,
24+
"col_offset": 1,
2525
"lineno": 1,
2626
"value": {
2727
"ast_type": "Name",
@@ -73,7 +73,7 @@
7373
{
7474
"arg": "metaclass",
7575
"ast_type": "keyword",
76-
"col_offset": 2,
76+
"col_offset": 19,
7777
"lineno": 4,
7878
"value": {
7979
"ast_type": "Name",

tests/classdef_metaclass_py3.py.uast

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Module {
4545
. . . . . . 0: keyword {
4646
. . . . . . . TOKEN "metaclass"
4747
. . . . . . . StartPosition: {
48-
. . . . . . . . Offset: 1
48+
. . . . . . . . Offset: 0
4949
. . . . . . . . Line: 1
50-
. . . . . . . . Col: 2
50+
. . . . . . . . Col: 1
5151
. . . . . . . }
5252
. . . . . . . Children: {
5353
. . . . . . . . 0: Name {
@@ -154,9 +154,9 @@ Module {
154154
. . . . . . 0: keyword {
155155
. . . . . . . TOKEN "metaclass"
156156
. . . . . . . StartPosition: {
157-
. . . . . . . . Offset: 51
157+
. . . . . . . . Offset: 68
158158
. . . . . . . . Line: 4
159-
. . . . . . . . Col: 2
159+
. . . . . . . . Col: 19
160160
. . . . . . . }
161161
. . . . . . . Children: {
162162
. . . . . . . . 0: Name {

tests/comprehension_dict.py.native

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"generators": [
1616
{
1717
"ast_type": "comprehension",
18-
"col_offset": 2,
18+
"col_offset": 5,
1919
"ifs": [
2020
{
2121
"ast_type": "Compare",
@@ -40,7 +40,7 @@
4040
"ops": [
4141
{
4242
"ast_type": "Gt",
43-
"col_offset": 2,
43+
"col_offset": 30,
4444
"lineno": 1
4545
}
4646
]
@@ -54,6 +54,7 @@
5454
"id": "somelist",
5555
"lineno": 1
5656
},
57+
"lineno": 1,
5758
"target": {
5859
"ast_type": "Name",
5960
"col_offset": 13,

0 commit comments

Comments
 (0)