From 4b33f7e32c699a26b44e0d292f109a7cf7473f00 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Fri, 29 Sep 2017 14:09:31 +0200 Subject: [PATCH 1/4] Fix None nodes having token --- driver/normalizer/tonode.go | 46 ++++++++++++++++++ fixtures/functiondef_defaultparams.py.native | 2 +- fixtures/functiondef_defaultparams.py.uast | 15 +++--- fixtures/issue58.py.native | 2 +- fixtures/issue58.py.uast | 11 +++-- fixtures/literals_assign.py.native | 2 +- fixtures/literals_assign.py.uast | 47 ++++++++++--------- .../python_driver/astimprove.py | 8 ++-- 8 files changed, 91 insertions(+), 42 deletions(-) diff --git a/driver/normalizer/tonode.go b/driver/normalizer/tonode.go index 449715b3..e2d8e6e6 100644 --- a/driver/normalizer/tonode.go +++ b/driver/normalizer/tonode.go @@ -71,6 +71,52 @@ var ToNode = &uast.ObjectToNode{ "While": "while", "With": "with", "Yield": "yield", + "Add": "+", + "Assert": "assert", + "AugAssign": "?=", + "BitAnd": "&", + "BitOr": "|", + "BitXor": "^", + "Break": "break", + "Continue": "continue", + "Delete": "delete", + "Div": "/", + "Ellipsis": "...", + "Eq": "==", + "False": "false", + "For": "for", + "FloorDiv": "//", + "Global": "global", + "Gt": ">", + "GtE": ">=", + "If": "if", + "In": "in", + "Invert": "~", + "Is": "is", + "IsNot": "not is", + "LShift": "<<", + "Lt": "<", + "LtE": "<=", + "Mod": "%%", + "Mult": "*", + "NoneLiteral": "None", + "Nonlocal": "nonlocal", + "Not": "!", + "NotEq": "!=", + "NotIn": "not in", + "Pass": "pass", + "Pow": "**", + "Print": "print", + "Raise": "raise", + "Return": "return", + "RShift": ">>", + "Sub": "-", + "True": "true", + "UAdd": "+", + "USub": "-", + "While": "while", + "With": "with", + "Yield": "yield", }, PromoteAllPropertyLists: false, PromotedPropertyLists: map[string]map[string]bool{ diff --git a/fixtures/functiondef_defaultparams.py.native b/fixtures/functiondef_defaultparams.py.native index ef2ca67f..678e6cbe 100644 --- a/fixtures/functiondef_defaultparams.py.native +++ b/fixtures/functiondef_defaultparams.py.native @@ -73,7 +73,7 @@ "s": "polompos" }, { - "LiteralValue": null, + "LiteralValue": "None", "ast_type": "NoneLiteral", "col_offset": 56, "end_col_offset": 59, diff --git a/fixtures/functiondef_defaultparams.py.uast b/fixtures/functiondef_defaultparams.py.uast index 992c351c..71d51152 100644 --- a/fixtures/functiondef_defaultparams.py.uast +++ b/fixtures/functiondef_defaultparams.py.uast @@ -2,7 +2,7 @@ Status: ok Errors: UAST: Module { -. Roles: File,Module +. Roles: File . Children: { . . 0: FunctionDef { . . . Roles: Function,Declaration,Name,Identifier @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Function,Declaration,Incomplete,Argument +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -127,7 +127,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 30 @@ -141,7 +141,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Str { -. . . . . . . . . Roles: Literal,String,Expression,Primitive +. . . . . . . . . Roles: Literal,String,Expression . . . . . . . . . TOKEN "polompos" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 38 @@ -155,7 +155,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: NoneLiteral { -. . . . . . . . . Roles: Literal,Null,Expression,Primitive +. . . . . . . . . Roles: Literal,Null,Expression . . . . . . . . . TOKEN "" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 55 @@ -218,14 +218,14 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Function,Declaration,Incomplete,Argument +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 92 @@ -306,3 +306,4 @@ Module { . } } + diff --git a/fixtures/issue58.py.native b/fixtures/issue58.py.native index 60a565b0..7178ff74 100644 --- a/fixtures/issue58.py.native +++ b/fixtures/issue58.py.native @@ -51,7 +51,7 @@ "n": 0 }, { - "LiteralValue": null, + "LiteralValue": "None", "ast_type": "NoneLiteral", "col_offset": 11, "end_col_offset": 14, diff --git a/fixtures/issue58.py.uast b/fixtures/issue58.py.uast index 560d5cfd..ed9f5b1c 100644 --- a/fixtures/issue58.py.uast +++ b/fixtures/issue58.py.uast @@ -2,7 +2,7 @@ Status: ok Errors: UAST: Module { -. Roles: File,Module +. Roles: File . Children: { . . 0: Assign { . . . Roles: Binary,Assignment,Expression @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Tuple { -. . . . . Roles: Literal,Tuple,Expression,Primitive,Left +. . . . . Roles: Literal,Tuple,Expression,Left . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -66,7 +66,7 @@ Module { . . . . . } . . . . } . . . . 1: Tuple { -. . . . . Roles: Literal,Tuple,Expression,Primitive,Right +. . . . . Roles: Literal,Tuple,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 7 . . . . . . Line: 1 @@ -78,7 +78,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "0" . . . . . . . StartPosition: { . . . . . . . . Offset: 7 @@ -95,7 +95,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: NoneLiteral { -. . . . . . . Roles: Literal,Null,Expression,Primitive +. . . . . . . Roles: Literal,Null,Expression . . . . . . . TOKEN "" . . . . . . . StartPosition: { . . . . . . . . Offset: 10 @@ -119,3 +119,4 @@ Module { . } } + diff --git a/fixtures/literals_assign.py.native b/fixtures/literals_assign.py.native index 352f6364..4e1309d9 100644 --- a/fixtures/literals_assign.py.native +++ b/fixtures/literals_assign.py.native @@ -125,7 +125,7 @@ } ], "value": { - "LiteralValue": null, + "LiteralValue": "None", "ast_type": "NoneLiteral", "col_offset": 5, "end_col_offset": 8, diff --git a/fixtures/literals_assign.py.uast b/fixtures/literals_assign.py.uast index 2cebd0b9..49f5befb 100644 --- a/fixtures/literals_assign.py.uast +++ b/fixtures/literals_assign.py.uast @@ -2,7 +2,7 @@ Status: ok Errors: UAST: Module { -. Roles: File,Module +. Roles: File . Children: { . . 0: Assign { . . . Roles: Binary,Assignment,Expression @@ -53,7 +53,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: Literal,Number,Expression,Primitive,Right +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "3" . . . . . StartPosition: { . . . . . . Offset: 4 @@ -120,7 +120,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: Literal,Number,Expression,Primitive,Right +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "3.14" . . . . . StartPosition: { . . . . . . Offset: 16 @@ -187,7 +187,7 @@ Module { . . . . . } . . . . } . . . . 1: Str { -. . . . . Roles: Literal,String,Expression,Primitive,Right +. . . . . Roles: Literal,String,Expression,Right . . . . . TOKEN "somestring" . . . . . StartPosition: { . . . . . . Offset: 33 @@ -254,7 +254,7 @@ Module { . . . . . } . . . . } . . . . 1: NoneLiteral { -. . . . . Roles: Literal,Null,Expression,Primitive,Right +. . . . . Roles: Literal,Null,Expression,Right . . . . . TOKEN "" . . . . . StartPosition: { . . . . . . Offset: 59 @@ -322,7 +322,7 @@ Module { . . . . . } . . . . } . . . . 1: List { -. . . . . Roles: Literal,List,Expression,Primitive,Right +. . . . . Roles: Literal,List,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 75 . . . . . . Line: 5 @@ -334,7 +334,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 76 @@ -351,7 +351,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 79 @@ -368,7 +368,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 82 @@ -437,7 +437,7 @@ Module { . . . . . } . . . . } . . . . 1: Tuple { -. . . . . Roles: Literal,Tuple,Expression,Primitive,Right +. . . . . Roles: Literal,Tuple,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 105 . . . . . . Line: 6 @@ -449,7 +449,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 105 @@ -466,7 +466,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 108 @@ -483,7 +483,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 111 @@ -552,7 +552,7 @@ Module { . . . . . } . . . . } . . . . 1: Set { -. . . . . Roles: Literal,Set,Expression,Primitive,Right +. . . . . Roles: Literal,Set,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 134 . . . . . . Line: 7 @@ -563,7 +563,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 135 @@ -580,7 +580,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 138 @@ -597,7 +597,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 141 @@ -666,7 +666,7 @@ Module { . . . . . } . . . . } . . . . 1: Dict { -. . . . . Roles: Literal,Map,Expression,Primitive,Right +. . . . . Roles: Literal,Map,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 162 . . . . . . Line: 8 @@ -677,7 +677,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Primitive,Map,Key +. . . . . . . Roles: Literal,String,Expression,Map,Key . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 163 @@ -694,7 +694,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Str { -. . . . . . . Roles: Literal,String,Expression,Primitive,Map,Key +. . . . . . . Roles: Literal,String,Expression,Map,Key . . . . . . . TOKEN "b" . . . . . . . StartPosition: { . . . . . . . . Offset: 171 @@ -711,7 +711,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive,Map,Value +. . . . . . . Roles: Literal,Number,Expression,Map,Value . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 168 @@ -728,7 +728,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: Num { -. . . . . . . Roles: Literal,Number,Expression,Primitive,Map,Value +. . . . . . . Roles: Literal,Number,Expression,Map,Value . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 176 @@ -875,7 +875,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Identifier,Expression +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . TOKEN "d" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 210 @@ -926,3 +926,4 @@ Module { . } } + diff --git a/native/python_package/python_driver/astimprove.py b/native/python_package/python_driver/astimprove.py index 21a9e69b..d94a4c27 100644 --- a/native/python_package/python_driver/astimprove.py +++ b/native/python_package/python_driver/astimprove.py @@ -483,13 +483,13 @@ def _promote_names(self, node): return node def visit_NameConstant(self, node): - if 'value' in node: + if "value" in node: repr_val = repr(node["value"]) - if repr_val in ('True', 'False'): + if repr_val in ("True", "False"): node.update({"LiteralValue": node["value"], "ast_type": "BoolLiteral"}) - elif repr_val == 'None': - node.update({"LiteralValue": node["value"], + elif repr_val == "None": + node.update({"LiteralValue": "None", "ast_type": "NoneLiteral"}) else: node["ast_type"] = "NameConstant" From c8d83a6dbaf8f98437165deb678b8c915bf3733c Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Fri, 29 Sep 2017 14:16:51 +0200 Subject: [PATCH 2/4] Fix Boolean nodes having lowercased token --- driver/normalizer/tonode.go | 2 -- fixtures/assert_constant.py.native | 6 +++--- fixtures/assert_constant.py.uast | 11 ++++++----- fixtures/if.py.native | 6 +++--- native/python_package/python_driver/astimprove.py | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/driver/normalizer/tonode.go b/driver/normalizer/tonode.go index e2d8e6e6..155fd48c 100644 --- a/driver/normalizer/tonode.go +++ b/driver/normalizer/tonode.go @@ -83,7 +83,6 @@ var ToNode = &uast.ObjectToNode{ "Div": "/", "Ellipsis": "...", "Eq": "==", - "False": "false", "For": "for", "FloorDiv": "//", "Global": "global", @@ -111,7 +110,6 @@ var ToNode = &uast.ObjectToNode{ "Return": "return", "RShift": ">>", "Sub": "-", - "True": "true", "UAdd": "+", "USub": "-", "While": "while", diff --git a/fixtures/assert_constant.py.native b/fixtures/assert_constant.py.native index 48eba256..8c6d757b 100644 --- a/fixtures/assert_constant.py.native +++ b/fixtures/assert_constant.py.native @@ -13,7 +13,7 @@ "lineno": 1, "msg": null, "test": { - "LiteralValue": true, + "LiteralValue": "True", "ast_type": "BoolLiteral", "col_offset": 8, "end_col_offset": 11, @@ -30,7 +30,7 @@ "lineno": 2, "msg": null, "test": { - "LiteralValue": true, + "LiteralValue": "True", "ast_type": "BoolLiteral", "col_offset": 8, "end_col_offset": 11, @@ -54,7 +54,7 @@ "s": "assert message" }, "test": { - "LiteralValue": true, + "LiteralValue": "True", "ast_type": "BoolLiteral", "col_offset": 8, "end_col_offset": 11, diff --git a/fixtures/assert_constant.py.uast b/fixtures/assert_constant.py.uast index d503bb29..342dfb60 100644 --- a/fixtures/assert_constant.py.uast +++ b/fixtures/assert_constant.py.uast @@ -2,7 +2,7 @@ Status: ok Errors: UAST: Module { -. Roles: File,Module +. Roles: File . Children: { . . 0: Assert { . . . Roles: Assert,Statement @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: BoolLiteral { -. . . . . Roles: Literal,Boolean,Expression,Primitive +. . . . . Roles: Literal,Boolean,Expression . . . . . TOKEN "true" . . . . . StartPosition: { . . . . . . Offset: 7 @@ -61,7 +61,7 @@ Module { . . . } . . . Children: { . . . . 0: BoolLiteral { -. . . . . Roles: Literal,Boolean,Expression,Primitive +. . . . . Roles: Literal,Boolean,Expression . . . . . TOKEN "true" . . . . . StartPosition: { . . . . . . Offset: 20 @@ -98,7 +98,7 @@ Module { . . . } . . . Children: { . . . . 0: Str { -. . . . . Roles: Literal,String,Expression,Primitive +. . . . . Roles: Literal,String,Expression . . . . . TOKEN "assert message" . . . . . StartPosition: { . . . . . . Offset: 38 @@ -115,7 +115,7 @@ Module { . . . . . } . . . . } . . . . 1: BoolLiteral { -. . . . . Roles: Literal,Boolean,Expression,Primitive +. . . . . Roles: Literal,Boolean,Expression . . . . . TOKEN "true" . . . . . StartPosition: { . . . . . . Offset: 32 @@ -137,3 +137,4 @@ Module { . } } + diff --git a/fixtures/if.py.native b/fixtures/if.py.native index b258112f..e9bdb728 100644 --- a/fixtures/if.py.native +++ b/fixtures/if.py.native @@ -15,7 +15,7 @@ "value": { "args": [ { - "LiteralValue": true, + "LiteralValue": "True", "ast_type": "BoolLiteral", "col_offset": 11, "end_col_offset": 14, @@ -46,7 +46,7 @@ "lineno": 1, "orelse": [], "test": { - "LiteralValue": true, + "LiteralValue": "True", "ast_type": "BoolLiteral", "col_offset": 4, "end_col_offset": 7, @@ -65,7 +65,7 @@ "value": { "args": [ { - "LiteralValue": true, + "LiteralValue": "True", "ast_type": "BoolLiteral", "col_offset": 11, "end_col_offset": 14, diff --git a/native/python_package/python_driver/astimprove.py b/native/python_package/python_driver/astimprove.py index d94a4c27..5d4bf70d 100644 --- a/native/python_package/python_driver/astimprove.py +++ b/native/python_package/python_driver/astimprove.py @@ -486,7 +486,7 @@ def visit_NameConstant(self, node): if "value" in node: repr_val = repr(node["value"]) if repr_val in ("True", "False"): - node.update({"LiteralValue": node["value"], + node.update({"LiteralValue": "True" if node["value"] else "False", "ast_type": "BoolLiteral"}) elif repr_val == "None": node.update({"LiteralValue": "None", From d24551d3a4c65bea36da86307687dadc3b6847d6 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Fri, 29 Sep 2017 14:32:36 +0200 Subject: [PATCH 3/4] Remove now unneeded parser.go entry for None --- driver/normalizer/tonode.go | 47 ------------------------------------- 1 file changed, 47 deletions(-) diff --git a/driver/normalizer/tonode.go b/driver/normalizer/tonode.go index 155fd48c..c29c156c 100644 --- a/driver/normalizer/tonode.go +++ b/driver/normalizer/tonode.go @@ -37,7 +37,6 @@ var ToNode = &uast.ObjectToNode{ "Div": "/", "Ellipsis": "...", "Eq": "==", - "False": "false", "For": "for", "FloorDiv": "//", "Global": "global", @@ -53,7 +52,6 @@ var ToNode = &uast.ObjectToNode{ "LtE": "<=", "Mod": "%%", "Mult": "*", - "None": "None", "Nonlocal": "nonlocal", "Not": "!", "NotEq": "!=", @@ -65,56 +63,11 @@ var ToNode = &uast.ObjectToNode{ "Return": "return", "RShift": ">>", "Sub": "-", - "True": "true", "UAdd": "+", "USub": "-", "While": "while", "With": "with", "Yield": "yield", - "Add": "+", - "Assert": "assert", - "AugAssign": "?=", - "BitAnd": "&", - "BitOr": "|", - "BitXor": "^", - "Break": "break", - "Continue": "continue", - "Delete": "delete", - "Div": "/", - "Ellipsis": "...", - "Eq": "==", - "For": "for", - "FloorDiv": "//", - "Global": "global", - "Gt": ">", - "GtE": ">=", - "If": "if", - "In": "in", - "Invert": "~", - "Is": "is", - "IsNot": "not is", - "LShift": "<<", - "Lt": "<", - "LtE": "<=", - "Mod": "%%", - "Mult": "*", - "NoneLiteral": "None", - "Nonlocal": "nonlocal", - "Not": "!", - "NotEq": "!=", - "NotIn": "not in", - "Pass": "pass", - "Pow": "**", - "Print": "print", - "Raise": "raise", - "Return": "return", - "RShift": ">>", - "Sub": "-", - "UAdd": "+", - "USub": "-", - "While": "while", - "With": "with", - "Yield": "yield", }, PromoteAllPropertyLists: false, PromotedPropertyLists: map[string]map[string]bool{ From fa8d081717843fe1dce02e8799d58c6402fa24a1 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Tue, 3 Oct 2017 14:19:40 +0200 Subject: [PATCH 4/4] Rebased to SDK v1.1 --- fixtures/assert_constant.py.uast | 17 ++++---- fixtures/functiondef_defaultparams.py.uast | 17 ++++---- fixtures/if.py.uast | 6 +-- fixtures/issue58.py.uast | 13 +++--- fixtures/literals_assign.py.uast | 49 +++++++++++----------- 5 files changed, 49 insertions(+), 53 deletions(-) diff --git a/fixtures/assert_constant.py.uast b/fixtures/assert_constant.py.uast index 342dfb60..892141ce 100644 --- a/fixtures/assert_constant.py.uast +++ b/fixtures/assert_constant.py.uast @@ -2,7 +2,7 @@ Status: ok Errors: UAST: Module { -. Roles: File +. Roles: File,Module . Children: { . . 0: Assert { . . . Roles: Assert,Statement @@ -23,8 +23,8 @@ Module { . . . } . . . Children: { . . . . 0: BoolLiteral { -. . . . . Roles: Literal,Boolean,Expression -. . . . . TOKEN "true" +. . . . . Roles: Literal,Boolean,Expression,Primitive +. . . . . TOKEN "True" . . . . . StartPosition: { . . . . . . Offset: 7 . . . . . . Line: 1 @@ -61,8 +61,8 @@ Module { . . . } . . . Children: { . . . . 0: BoolLiteral { -. . . . . Roles: Literal,Boolean,Expression -. . . . . TOKEN "true" +. . . . . Roles: Literal,Boolean,Expression,Primitive +. . . . . TOKEN "True" . . . . . StartPosition: { . . . . . . Offset: 20 . . . . . . Line: 2 @@ -98,7 +98,7 @@ Module { . . . } . . . Children: { . . . . 0: Str { -. . . . . Roles: Literal,String,Expression +. . . . . Roles: Literal,String,Expression,Primitive . . . . . TOKEN "assert message" . . . . . StartPosition: { . . . . . . Offset: 38 @@ -115,8 +115,8 @@ Module { . . . . . } . . . . } . . . . 1: BoolLiteral { -. . . . . Roles: Literal,Boolean,Expression -. . . . . TOKEN "true" +. . . . . Roles: Literal,Boolean,Expression,Primitive +. . . . . TOKEN "True" . . . . . StartPosition: { . . . . . . Offset: 32 . . . . . . Line: 3 @@ -137,4 +137,3 @@ Module { . } } - diff --git a/fixtures/functiondef_defaultparams.py.uast b/fixtures/functiondef_defaultparams.py.uast index 71d51152..2db0209b 100644 --- a/fixtures/functiondef_defaultparams.py.uast +++ b/fixtures/functiondef_defaultparams.py.uast @@ -2,7 +2,7 @@ Status: ok Errors: UAST: Module { -. Roles: File +. Roles: File,Module . Children: { . . 0: FunctionDef { . . . Roles: Function,Declaration,Name,Identifier @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Function,Declaration,Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Incomplete,Argument . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -127,7 +127,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: Literal,Number,Expression +. . . . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 30 @@ -141,7 +141,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Str { -. . . . . . . . . Roles: Literal,String,Expression +. . . . . . . . . Roles: Literal,String,Expression,Primitive . . . . . . . . . TOKEN "polompos" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 38 @@ -155,8 +155,8 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: NoneLiteral { -. . . . . . . . . Roles: Literal,Null,Expression -. . . . . . . . . TOKEN "" +. . . . . . . . . Roles: Literal,Null,Expression,Primitive +. . . . . . . . . TOKEN "None" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 55 . . . . . . . . . . Line: 1 @@ -218,14 +218,14 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Function,Declaration,Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Incomplete,Argument . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 92 @@ -306,4 +306,3 @@ Module { . } } - diff --git a/fixtures/if.py.uast b/fixtures/if.py.uast index a468be2f..374f7074 100644 --- a/fixtures/if.py.uast +++ b/fixtures/if.py.uast @@ -48,7 +48,7 @@ Module { . . . . . . . . . Children: { . . . . . . . . . . 0: BoolLiteral { . . . . . . . . . . . Roles: Literal,Boolean,Expression,Primitive,Function,Call,Positional,Argument,Name -. . . . . . . . . . . TOKEN "true" +. . . . . . . . . . . TOKEN "True" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 19 . . . . . . . . . . . . Line: 2 @@ -90,7 +90,7 @@ Module { . . . . } . . . . 1: BoolLiteral { . . . . . Roles: Literal,Boolean,Expression,Primitive,If,Condition -. . . . . TOKEN "true" +. . . . . TOKEN "True" . . . . . StartPosition: { . . . . . . Offset: 3 . . . . . . Line: 1 @@ -152,7 +152,7 @@ Module { . . . . . . . . . Children: { . . . . . . . . . . 0: BoolLiteral { . . . . . . . . . . . Roles: Literal,Boolean,Expression,Primitive,Function,Call,Positional,Argument,Name -. . . . . . . . . . . TOKEN "true" +. . . . . . . . . . . TOKEN "True" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 55 . . . . . . . . . . . . Line: 5 diff --git a/fixtures/issue58.py.uast b/fixtures/issue58.py.uast index ed9f5b1c..fb2c1c14 100644 --- a/fixtures/issue58.py.uast +++ b/fixtures/issue58.py.uast @@ -2,7 +2,7 @@ Status: ok Errors: UAST: Module { -. Roles: File +. Roles: File,Module . Children: { . . 0: Assign { . . . Roles: Binary,Assignment,Expression @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Tuple { -. . . . . Roles: Literal,Tuple,Expression,Left +. . . . . Roles: Literal,Tuple,Expression,Primitive,Left . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -66,7 +66,7 @@ Module { . . . . . } . . . . } . . . . 1: Tuple { -. . . . . Roles: Literal,Tuple,Expression,Right +. . . . . Roles: Literal,Tuple,Expression,Primitive,Right . . . . . StartPosition: { . . . . . . Offset: 7 . . . . . . Line: 1 @@ -78,7 +78,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "0" . . . . . . . StartPosition: { . . . . . . . . Offset: 7 @@ -95,8 +95,8 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: NoneLiteral { -. . . . . . . Roles: Literal,Null,Expression -. . . . . . . TOKEN "" +. . . . . . . Roles: Literal,Null,Expression,Primitive +. . . . . . . TOKEN "None" . . . . . . . StartPosition: { . . . . . . . . Offset: 10 . . . . . . . . Line: 1 @@ -119,4 +119,3 @@ Module { . } } - diff --git a/fixtures/literals_assign.py.uast b/fixtures/literals_assign.py.uast index 49f5befb..7361f6fc 100644 --- a/fixtures/literals_assign.py.uast +++ b/fixtures/literals_assign.py.uast @@ -2,7 +2,7 @@ Status: ok Errors: UAST: Module { -. Roles: File +. Roles: File,Module . Children: { . . 0: Assign { . . . Roles: Binary,Assignment,Expression @@ -53,7 +53,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: Literal,Number,Expression,Right +. . . . . Roles: Literal,Number,Expression,Primitive,Right . . . . . TOKEN "3" . . . . . StartPosition: { . . . . . . Offset: 4 @@ -120,7 +120,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: Literal,Number,Expression,Right +. . . . . Roles: Literal,Number,Expression,Primitive,Right . . . . . TOKEN "3.14" . . . . . StartPosition: { . . . . . . Offset: 16 @@ -187,7 +187,7 @@ Module { . . . . . } . . . . } . . . . 1: Str { -. . . . . Roles: Literal,String,Expression,Right +. . . . . Roles: Literal,String,Expression,Primitive,Right . . . . . TOKEN "somestring" . . . . . StartPosition: { . . . . . . Offset: 33 @@ -254,8 +254,8 @@ Module { . . . . . } . . . . } . . . . 1: NoneLiteral { -. . . . . Roles: Literal,Null,Expression,Right -. . . . . TOKEN "" +. . . . . Roles: Literal,Null,Expression,Primitive,Right +. . . . . TOKEN "None" . . . . . StartPosition: { . . . . . . Offset: 59 . . . . . . Line: 4 @@ -322,7 +322,7 @@ Module { . . . . . } . . . . } . . . . 1: List { -. . . . . Roles: Literal,List,Expression,Right +. . . . . Roles: Literal,List,Expression,Primitive,Right . . . . . StartPosition: { . . . . . . Offset: 75 . . . . . . Line: 5 @@ -334,7 +334,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 76 @@ -351,7 +351,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 79 @@ -368,7 +368,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 82 @@ -437,7 +437,7 @@ Module { . . . . . } . . . . } . . . . 1: Tuple { -. . . . . Roles: Literal,Tuple,Expression,Right +. . . . . Roles: Literal,Tuple,Expression,Primitive,Right . . . . . StartPosition: { . . . . . . Offset: 105 . . . . . . Line: 6 @@ -449,7 +449,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 105 @@ -466,7 +466,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 108 @@ -483,7 +483,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 111 @@ -552,7 +552,7 @@ Module { . . . . . } . . . . } . . . . 1: Set { -. . . . . Roles: Literal,Set,Expression,Right +. . . . . Roles: Literal,Set,Expression,Primitive,Right . . . . . StartPosition: { . . . . . . Offset: 134 . . . . . . Line: 7 @@ -563,7 +563,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 135 @@ -580,7 +580,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 138 @@ -597,7 +597,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: Literal,Number,Expression +. . . . . . . Roles: Literal,Number,Expression,Primitive . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 141 @@ -666,7 +666,7 @@ Module { . . . . . } . . . . } . . . . 1: Dict { -. . . . . Roles: Literal,Map,Expression,Right +. . . . . Roles: Literal,Map,Expression,Primitive,Right . . . . . StartPosition: { . . . . . . Offset: 162 . . . . . . Line: 8 @@ -677,7 +677,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Map,Key +. . . . . . . Roles: Literal,String,Expression,Primitive,Map,Key . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 163 @@ -694,7 +694,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Str { -. . . . . . . Roles: Literal,String,Expression,Map,Key +. . . . . . . Roles: Literal,String,Expression,Primitive,Map,Key . . . . . . . TOKEN "b" . . . . . . . StartPosition: { . . . . . . . . Offset: 171 @@ -711,7 +711,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: Literal,Number,Expression,Map,Value +. . . . . . . Roles: Literal,Number,Expression,Primitive,Map,Value . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 168 @@ -728,7 +728,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: Num { -. . . . . . . Roles: Literal,Number,Expression,Map,Value +. . . . . . . Roles: Literal,Number,Expression,Primitive,Map,Value . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 176 @@ -875,7 +875,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . Roles: Function,Call,Positional,Argument,Name,Identifier,Expression . . . . . . . . . TOKEN "d" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 210 @@ -926,4 +926,3 @@ Module { . } } -