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

Commit 5eca4f8

Browse files
authored
Merge pull request #78 from abeaumont/fix/incorrect-duplicated-tokens
Fix incorrect duplicated tokens
2 parents 0a9f716 + 6f0f62b commit 5eca4f8

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

driver/normalizer/parser.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ var ToNoder = &native.ObjectToNoder{
1313
EndColumnKey: "end_col_offset",
1414

1515
TokenKeys: map[string]bool{
16-
"module": true, // Module on ImportFrom
17-
"name": true,
16+
"name": true,
1817
//"asname": true, // Alias from ImportFrom
1918
"id": true, // Name nodes
2019
"attr": true, // something.attr
@@ -63,13 +62,13 @@ var ToNoder = &native.ObjectToNoder{
6362
"Compare": {"comparators": true, "ops": true},
6463
// FIXME: check call.keywords
6564
//"Call" : { "args": true, "keywords": true},
66-
"With": {"body": true, "items": true},
67-
"FunctionDef": {"body": true, "decorator_list": true},
68-
"Lambda": {"body": true},
69-
"arguments": {"defaults": true},
70-
"Try": {"body": true, "orelse": true, "finalbody": true, "handlers": true},
71-
"Raise": {"args": true},
72-
"ClassDef": {"body": true, "bases": true, "decorator_list": true, "keywords": true},
65+
"With": {"body": true, "items": true},
66+
"FunctionDef": {"body": true, "decorator_list": true},
67+
"Lambda": {"body": true},
68+
"arguments": {"defaults": true},
69+
"Try": {"body": true, "orelse": true, "finalbody": true, "handlers": true},
70+
"Raise": {"args": true},
71+
"ClassDef": {"body": true, "bases": true, "decorator_list": true, "keywords": true},
7372
},
7473
PromotedPropertyStrings: map[string]map[string]bool{
7574
"alias": {"asname": true},

tests/import.py.uast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ Module {
106106
. . }
107107
. . 2: ImportFrom {
108108
. . . Roles: ImportDeclaration,Statement
109-
. . . TOKEN "os"
110109
. . . StartPosition: {
111110
. . . . Offset: 31
112111
. . . . Line: 3
@@ -120,6 +119,7 @@ Module {
120119
. . . Properties: {
121120
. . . . internalRole: body
122121
. . . . level: 0
122+
. . . . module: os
123123
. . . }
124124
. . . Children: {
125125
. . . . 0: alias {
@@ -151,7 +151,6 @@ Module {
151151
. . }
152152
. . 3: ImportFrom {
153153
. . . Roles: ImportDeclaration,Statement
154-
. . . TOKEN "os.path"
155154
. . . StartPosition: {
156155
. . . . Offset: 46
157156
. . . . Line: 4
@@ -165,6 +164,7 @@ Module {
165164
. . . Properties: {
166165
. . . . internalRole: body
167166
. . . . level: 0
167+
. . . . module: os.path
168168
. . . }
169169
. . . Children: {
170170
. . . . 0: alias {

tests/issue62.py.uast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Module {
1616
. Children: {
1717
. . 0: ImportFrom {
1818
. . . Roles: ImportDeclaration,Statement
19-
. . . TOKEN "os"
2019
. . . StartPosition: {
2120
. . . . Offset: 5
2221
. . . . Line: 1
@@ -30,6 +29,7 @@ Module {
3029
. . . Properties: {
3130
. . . . internalRole: body
3231
. . . . level: 0
32+
. . . . module: os
3333
. . . }
3434
. . . Children: {
3535
. . . . 0: alias {

tests/issue62_b.py.uast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Module {
1616
. Children: {
1717
. . 0: ImportFrom {
1818
. . . Roles: ImportDeclaration,Statement
19-
. . . TOKEN "collections"
2019
. . . StartPosition: {
2120
. . . . Offset: 5
2221
. . . . Line: 1
@@ -30,6 +29,7 @@ Module {
3029
. . . Properties: {
3130
. . . . internalRole: body
3231
. . . . level: 0
32+
. . . . module: collections
3333
. . . }
3434
. . . Children: {
3535
. . . . 0: alias {
@@ -61,7 +61,6 @@ Module {
6161
. . }
6262
. . 1: ImportFrom {
6363
. . . Roles: ImportDeclaration,Statement
64-
. . . TOKEN "ast2vec.bblfsh_roles"
6564
. . . StartPosition: {
6665
. . . . Offset: 33
6766
. . . . Line: 3
@@ -75,6 +74,7 @@ Module {
7574
. . . Properties: {
7675
. . . . internalRole: body
7776
. . . . level: 0
77+
. . . . module: ast2vec.bblfsh_roles
7878
. . . }
7979
. . . Children: {
8080
. . . . 0: alias {
@@ -137,7 +137,6 @@ Module {
137137
. . }
138138
. . 2: ImportFrom {
139139
. . . Roles: ImportDeclaration,Statement
140-
. . . TOKEN "ast2vec.repo2.base"
141140
. . . StartPosition: {
142141
. . . . Offset: 84
143142
. . . . Line: 4
@@ -151,6 +150,7 @@ Module {
151150
. . . Properties: {
152151
. . . . internalRole: body
153152
. . . . level: 0
153+
. . . . module: ast2vec.repo2.base
154154
. . . }
155155
. . . Children: {
156156
. . . . 0: alias {

0 commit comments

Comments
 (0)