Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions driver/normalizer/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ var ToNoder = &native.ObjectToNoder{
EndColumnKey: "end_col_offset",

TokenKeys: map[string]bool{
"module": true, // Module on ImportFrom
"name": true,
"name": true,
//"asname": true, // Alias from ImportFrom
"id": true, // Name nodes
"attr": true, // something.attr
Expand Down Expand Up @@ -63,13 +62,13 @@ var ToNoder = &native.ObjectToNoder{
"Compare": {"comparators": true, "ops": true},
// FIXME: check call.keywords
//"Call" : { "args": true, "keywords": true},
"With": {"body": true, "items": true},
"FunctionDef": {"body": true, "decorator_list": true},
"Lambda": {"body": true},
"arguments": {"defaults": true},
"Try": {"body": true, "orelse": true, "finalbody": true, "handlers": true},
"Raise": {"args": true},
"ClassDef": {"body": true, "bases": true, "decorator_list": true, "keywords": true},
"With": {"body": true, "items": true},
"FunctionDef": {"body": true, "decorator_list": true},
"Lambda": {"body": true},
"arguments": {"defaults": true},
"Try": {"body": true, "orelse": true, "finalbody": true, "handlers": true},
"Raise": {"args": true},
"ClassDef": {"body": true, "bases": true, "decorator_list": true, "keywords": true},
},
PromotedPropertyStrings: map[string]map[string]bool{
"alias": {"asname": true},
Expand Down
4 changes: 2 additions & 2 deletions tests/import.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ Module {
. . }
. . 2: ImportFrom {
. . . Roles: ImportDeclaration,Statement
. . . TOKEN "os"
. . . StartPosition: {
. . . . Offset: 31
. . . . Line: 3
Expand All @@ -120,6 +119,7 @@ Module {
. . . Properties: {
. . . . internalRole: body
. . . . level: 0
. . . . module: os
. . . }
. . . Children: {
. . . . 0: alias {
Expand Down Expand Up @@ -151,7 +151,6 @@ Module {
. . }
. . 3: ImportFrom {
. . . Roles: ImportDeclaration,Statement
. . . TOKEN "os.path"
. . . StartPosition: {
. . . . Offset: 46
. . . . Line: 4
Expand All @@ -165,6 +164,7 @@ Module {
. . . Properties: {
. . . . internalRole: body
. . . . level: 0
. . . . module: os.path
. . . }
. . . Children: {
. . . . 0: alias {
Expand Down
2 changes: 1 addition & 1 deletion tests/issue62.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Module {
. Children: {
. . 0: ImportFrom {
. . . Roles: ImportDeclaration,Statement
. . . TOKEN "os"
. . . StartPosition: {
. . . . Offset: 5
. . . . Line: 1
Expand All @@ -30,6 +29,7 @@ Module {
. . . Properties: {
. . . . internalRole: body
. . . . level: 0
. . . . module: os
. . . }
. . . Children: {
. . . . 0: alias {
Expand Down
6 changes: 3 additions & 3 deletions tests/issue62_b.py.uast
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Module {
. Children: {
. . 0: ImportFrom {
. . . Roles: ImportDeclaration,Statement
. . . TOKEN "collections"
. . . StartPosition: {
. . . . Offset: 5
. . . . Line: 1
Expand All @@ -30,6 +29,7 @@ Module {
. . . Properties: {
. . . . internalRole: body
. . . . level: 0
. . . . module: collections
. . . }
. . . Children: {
. . . . 0: alias {
Expand Down Expand Up @@ -61,7 +61,6 @@ Module {
. . }
. . 1: ImportFrom {
. . . Roles: ImportDeclaration,Statement
. . . TOKEN "ast2vec.bblfsh_roles"
. . . StartPosition: {
. . . . Offset: 33
. . . . Line: 3
Expand All @@ -75,6 +74,7 @@ Module {
. . . Properties: {
. . . . internalRole: body
. . . . level: 0
. . . . module: ast2vec.bblfsh_roles
. . . }
. . . Children: {
. . . . 0: alias {
Expand Down Expand Up @@ -137,7 +137,6 @@ Module {
. . }
. . 2: ImportFrom {
. . . Roles: ImportDeclaration,Statement
. . . TOKEN "ast2vec.repo2.base"
. . . StartPosition: {
. . . . Offset: 84
. . . . Line: 4
Expand All @@ -151,6 +150,7 @@ Module {
. . . Properties: {
. . . . internalRole: body
. . . . level: 0
. . . . module: ast2vec.repo2.base
. . . }
. . . Children: {
. . . . 0: alias {
Expand Down