From 4392d60d8bdd00b83b966a4e7ef29815ddd64d9f Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Wed, 13 Sep 2017 18:40:55 +0200 Subject: [PATCH 1/3] Upgrades for UAST/SDK v1 - Migrated annotations to the new UAST format. - Fixed some Incomplete annotations that now can be better represented. - Fixed some missing annotations and a couple bugs. - Updated integrated tests, added some new ones. - Versioned imports to v1. --- .travis.yml | 2 +- ANNOTATION.md | 301 ++++++----- driver/main.go | 2 +- driver/normalizer/annotation.go | 486 +++++++++--------- driver/normalizer/annotation_test.go | 2 +- driver/normalizer/parser.go | 4 +- driver/normalizer/pyast/pyast.go | 293 ++++++----- tests/annotations.py.uast | 32 +- tests/aritmeticops.py.uast | 56 +- tests/assert_constant.py.uast | 8 +- tests/augassign.py.uast | 32 +- tests/bitwise.py.uast | 80 +-- tests/classdef.py.uast | 114 ++-- tests/classdef_decorated.py.native | 39 ++ tests/classdef_decorated.py.source | 3 + tests/classdef_decorated.py.uast | 70 +++ tests/classdef_inheritance.py.uast | 18 +- tests/classdef_metaclass_py2.py.uast | 14 +- tests/classdef_metaclass_py3.py.uast | 20 +- tests/comments.py.uast | 6 +- ...eanop.py.native => comparisonop.py.native} | 0 ...eanop.py.source => comparisonop.py.source} | 0 ...booleanop.py.uast => comparisonop.py.uast} | 78 +-- tests/complex.py.native | 53 ++ tests/complex.py.source | 1 + tests/complex.py.uast | 102 ++++ tests/comprehension_dict.py.uast | 30 +- tests/comprehension_list.py.uast | 50 +- tests/comprehension_set.py.uast | 28 +- tests/continue_break.py.native | 169 ++++++ tests/continue_break.py.source | 6 + tests/continue_break.py.uast | 356 +++++++++++++ tests/declarations_annotated.py.uast | 16 +- tests/ellipsis.py.uast | 6 +- tests/except.py.uast | 42 +- tests/exec.py.uast | 6 +- tests/for.py.uast | 28 +- tests/functioncalls.py.uast | 56 +- tests/functiondef_annotated.py.uast | 20 +- tests/functiondef_decorated.py.uast | 28 +- tests/functiondef_defaultparams.py.native | 55 ++ tests/functiondef_defaultparams.py.source | 1 + tests/functiondef_defaultparams.py.uast | 128 ++++- tests/functiondef_docstring.py.uast | 8 +- tests/functiondef_kwarg.py.uast | 26 +- tests/functiondef_simple.py.uast | 42 +- tests/functiondef_vararg.py.uast | 12 +- tests/hello.py.uast | 6 +- tests/if.py.uast | 112 ++-- tests/ifexpression.py.uast | 22 +- tests/import.py.uast | 24 +- tests/issue30.py.uast | 14 +- tests/issue51.py.uast | 6 +- tests/issue58.py.uast | 14 +- tests/issue62.py.uast | 16 +- tests/issue62_b.py.uast | 226 ++++---- tests/issue76.py.native | 185 +++++++ tests/issue76.py.source | 2 + tests/issue76.py.uast | 371 +++++++++++++ tests/lambda.py.uast | 14 +- tests/literals_assign.py.uast | 96 ++-- tests/loop_if.py.uast | 16 +- tests/other_statements.py.uast | 32 +- tests/pass.py.uast | 12 +- tests/print.py.uast | 8 +- tests/qualified.py.uast | 28 +- tests/repr.py.uast | 6 +- tests/sameline.py.uast | 12 +- tests/sorting.py.uast | 8 +- tests/string_fstring.py.uast | 100 ++-- tests/string_normal.py.uast | 4 +- tests/string_triple.py.uast | 4 +- tests/test.py.uast | 14 +- tests/unary.py.uast | 18 +- tests/while.py.uast | 28 +- tests/with.py.uast | 18 +- 76 files changed, 2931 insertions(+), 1414 deletions(-) create mode 100644 tests/classdef_decorated.py.native create mode 100644 tests/classdef_decorated.py.source create mode 100644 tests/classdef_decorated.py.uast rename tests/{booleanop.py.native => comparisonop.py.native} (100%) rename tests/{booleanop.py.source => comparisonop.py.source} (100%) rename tests/{booleanop.py.uast => comparisonop.py.uast} (85%) create mode 100644 tests/complex.py.native create mode 100644 tests/complex.py.source create mode 100644 tests/complex.py.uast create mode 100644 tests/continue_break.py.native create mode 100644 tests/continue_break.py.source create mode 100644 tests/continue_break.py.uast create mode 100644 tests/issue76.py.native create mode 100644 tests/issue76.py.source create mode 100644 tests/issue76.py.uast diff --git a/.travis.yml b/.travis.yml index fbe98f75..2ad1e368 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ services: - docker before_script: - - go get -v gopkg.in/bblfsh/sdk.v0/... + - go get -v gopkg.in/bblfsh/sdk.v1/... - bblfsh-sdk prepare-build . - go get -v -t ./... diff --git a/ANNOTATION.md b/ANNOTATION.md index 811dbec9..f4864d58 100644 --- a/ANNOTATION.md +++ b/ANNOTATION.md @@ -2,183 +2,180 @@ |------|--------| | /self::\*\[not\(@InternalType='Module'\)\] | Error | | /self::\*\[@InternalType='Module'\] | File | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\] | BinaryExpression, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='op'\] | BinaryExpressionOp | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='left'\] | BinaryExpressionLeft | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='right'\] | BinaryExpressionRight | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Eq'\] | OpEqual | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NotEq'\] | OpNotEqual | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lt'\] | OpLessThan | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='LtE'\] | OpLessThanEqual | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Gt'\] | OpGreaterThan | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='GtE'\] | OpGreaterThanEqual | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Is'\] | OpSame | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IsNot'\] | OpNotSame | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='In'\] | OpContains | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NotIn'\] | OpNotContains | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Add'\] | OpAdd | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Sub'\] | OpSubstract | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Mult'\] | OpMultiply | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Div'\] | OpDivide | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Mod'\] | OpMod | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FloorDiv'\] | OpDivide, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\] | Expression, Binary | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='op'\] | Expression, Binary, Operator | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='left'\] | Expression, Binary, Left | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='right'\] | Expression, Binary, Right | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Eq'\] | Operator, Equal | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NotEq'\] | Operator, Equal, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lt'\] | Operator, LessThan | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='LtE'\] | Operator, LessThanOrEqual | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Gt'\] | Operator, GreaterThan | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='GtE'\] | Operator, GreaterThanOrEqual | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Is'\] | Operator, Identical | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IsNot'\] | Operator, Identical, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='In'\] | Operator, Contains | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NotIn'\] | Operator, Contains, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Add'\] | Add | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Sub'\] | Substract | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Mult'\] | Multiply | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Div'\] | Divide | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Mod'\] | Modulo | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FloorDiv'\] | Divide, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Pow'\] | Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='MatMult'\] | OpMultiply, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='LShift'\] | OpBitwiseLeftShift | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='RShift'\] | OpBitwiseRightShift | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitOr'\] | OpBitwiseOr | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitXor'\] | OpBitwiseXor | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitAnd'\] | OpBitwiseAnd | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='And'\] | OpBooleanAnd | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Or'\] | OpBooleanOr | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Not'\] | OpBooleanNot | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='UnaryOp'\] | Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Invert'\] | OpBitwiseComplement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='UAdd'\] | OpPositive | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='USub'\] | OpNegative | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Str'\] | StringLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Bytes'\] | ByteStringLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Num'\] | NumberLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BoolLiteral'\] | BooleanLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='JoinedStr'\] | StringLiteral, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='MatMult'\] | Multiply, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='LShift'\] | Bitwise, LeftShift | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='RShift'\] | Bitwise, RightShift | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitOr'\] | Bitwise, Or | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitXor'\] | Bitwise, Xor | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitAnd'\] | Bitwise, And | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='And'\] | Operator, Boolean, And | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Or'\] | Operator, Boolean, Or | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Not'\] | Operator, Boolean, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='UnaryOp'\] | Operator, Unary, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Invert'\] | Operator, Unary, Bitwise, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='UAdd'\] | Operator, Unary, Positive | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='USub'\] | Operator, Unary, Negative | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Str'\] | Literal, String, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='StringLiteral'\] | Literal, String, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Bytes'\] | Literal, ByteString, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Num'\] | Literal, Number, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Num'\]/\*\[@internalRole\]\[@internalRole='n'\] | Literal, Number, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BoolLiteral'\] | Literal, Boolean, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='JoinedStr'\] | Literal, String, Expression | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='JoinedStr'\]/\*\[@InternalType='FormattedValue'\] | Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NoneLiteral'\] | NullLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Set'\] | SetLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='List'\] | ListLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Dict'\] | MapLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Dict'\]/\*\[@internalRole\]\[@internalRole='keys'\] | MapKey | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Dict'\]/\*\[@internalRole\]\[@internalRole='values'\] | MapValue | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Tuple'\] | TupleLiteral, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\] | FunctionDeclaration, FunctionDeclarationName, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef'\] | FunctionDeclaration, FunctionDeclarationName, SimpleIdentifier, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.decorator\_list'\] | Call, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.body'\] | FunctionDeclarationBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments'\] | FunctionDeclarationArgument, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='args'\] | FunctionDeclarationArgument, FunctionDeclarationArgumentName, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='vararg'\] | FunctionDeclarationArgument, FunctionDeclarationVarArgsList, FunctionDeclarationArgumentName, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='kwarg'\] | FunctionDeclarationArgument, FunctionDeclarationVarArgsList, FunctionDeclarationArgumentName, Incomplete, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments'\]/\*\[@InternalType='arguments\.defaults'\] | FunctionDeclarationArgumentDefaultValue, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments'\]/\*\[@InternalType='arguments\.keywords'\] | FunctionDeclarationArgumentDefaultValue, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments'\]/\*\[@InternalType='AsyncFunctionDef\.decorator\_list'\] | Call, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments'\]/\*\[@InternalType='AsyncFunctionDef\.body'\] | FunctionDeclarationBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\] | FunctionDeclaration, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='Lambda\.body'\] | FunctionDeclarationBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='arguments'\] | FunctionDeclarationArgument, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='args'\] | FunctionDeclarationArgument, FunctionDeclarationArgumentName, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='vararg'\] | FunctionDeclarationArgument, FunctionDeclarationVarArgsList, FunctionDeclarationArgumentName, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='arguments'\]/\*\[@internalRole\]\[@internalRole='kwarg'\] | FunctionDeclarationArgument, FunctionDeclarationVarArgsList, FunctionDeclarationArgumentName, Incomplete, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='arguments'\]/\*\[@InternalType='arguments\.defaults'\] | FunctionDeclarationArgumentDefaultValue, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='arguments'\]/\*\[@InternalType='arguments\.keywords'\] | FunctionDeclarationArgumentDefaultValue, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Attribute'\] | SimpleIdentifier, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Attribute'\]/\*\[@InternalType='Name'\] | QualifiedIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\] | Call, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='args'\] | CallPositionalArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\] | CallNamedArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\]/\*\[@internalRole\]\[@internalRole='value'\] | CallNamedArgumentValue | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Name'\] | CallCallee | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Attribute'\] | CallCallee | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Attribute'\]/\*\[@internalRole\]\[@internalRole='value'\] | CallReceiver | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assign'\] | Assignment, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assign'\]/\*\[@internalRole\]\[@internalRole='targets'\] | AssignmentVariable | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assign'\]/\*\[@internalRole\]\[@internalRole='value'\] | AssignmentValue | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AugAssign'\] | AugmentedAssignment, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AugAssign'\]/\*\[@internalRole\]\[@internalRole='op'\] | AugmentedAssignmentOperator | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AugAssign'\]/\*\[@internalRole\]\[@internalRole='target'\] | AugmentedAssignmentVariable | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AugAssign'\]/\*\[@internalRole\]\[@internalRole='value'\] | AugmentedAssignmentValue | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NoneLiteral'\] | Literal, Null, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Set'\] | Literal, Set, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='List'\] | Literal, List, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Dict'\] | Literal, Map, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Dict'\]/\*\[@internalRole\]\[@internalRole='keys'\] | Map, Key | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Dict'\]/\*\[@internalRole\]\[@internalRole='values'\] | Map, Value | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Tuple'\] | Literal, Tuple, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\] | Function, Declaration, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef'\] | Function, Declaration, Name, Identifier, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.decorator\_list'\] | Function, Call, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.body'\] | Function, Declaration, Body | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='arguments'\] | Argument, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='args'\] | Argument, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='vararg'\] | Argument, ArgsList, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='kwarg'\] | Argument, ArgsList, Map, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='kwonlyargs'\] | Argument, ArgsList, Map, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments\.defaults'\] | Function, Declaration, Argument, Value, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef\.decorator\_list'\] | Function, Call, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef\.body'\] | Function, Declaration, Body | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\] | Function, Declaration, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='Lambda\.body'\] | Function, Declaration, Body | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Attribute'\] | Identifier, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Attribute'\]/\*\[@InternalType='Name'\] | Identifier, Qualified | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\] | Function, Call, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='args'\] | Call, Argument, Positional | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\] | Call, Argument, Name | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='keywords'\]/\*\[@internalRole\]\[@internalRole='value'\] | Call, Argument, Value | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Name'\] | Call, Callee | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Attribute'\] | Call, Callee | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Call'\]/\*\[@internalRole\]\[@internalRole='func'\]/self::\*\[@InternalType='Attribute'\]/\*\[@internalRole\]\[@internalRole='value'\] | Call, Receiver | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assign'\] | Binary, Assignment, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assign'\]/\*\[@internalRole\]\[@internalRole='targets'\] | Left | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assign'\]/\*\[@internalRole\]\[@internalRole='value'\] | Right | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AugAssign'\] | Operator, Binary, Assignment, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AugAssign'\]/\*\[@internalRole\]\[@internalRole='op'\] | Operator, Binary | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AugAssign'\]/\*\[@internalRole\]\[@internalRole='target'\] | Left | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AugAssign'\]/\*\[@internalRole\]\[@internalRole='value'\] | Right | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Expression'\] | Expression | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Expr'\] | Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Name'\] | SimpleIdentifier, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Name'\] | Identifier, Expression | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='SameLineNoops'\] | Comment | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='PreviousNoops'\] | Whitespace | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='PreviousNoops'\]/\*\[@internalRole\]\[@internalRole='lines'\] | Comment | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='RemainderNoops'\] | Whitespace | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='RemainderNoops'\]/\*\[@internalRole\]\[@internalRole='lines'\] | Comment | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Constant'\] | SimpleIdentifier, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Constant'\] | Identifier, Expression | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\] | Try, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.body'\] | TryBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.finalbody'\] | TryFinally | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.handlers'\] | TryCatch | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.orelse'\] | IfElse | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='TryExcept'\] | TryCatch, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ExceptHandler'\] | TryCatch, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ExceptHandler\.name'\] | SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='TryFinally'\] | TryFinally, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.body'\] | Try, Body | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.finalbody'\] | Try, Finally | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.handlers'\] | Try, Catch | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.orelse'\] | Try, Body, Else | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='TryExcept'\] | Try, Catch, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ExceptHandler'\] | Try, Catch, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ExceptHandler\.name'\] | Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='TryFinally'\] | Try, Finally, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Raise'\] | Throw, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='With'\] | BlockScope, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='With\.body'\] | BlockScope, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='With\.items'\] | SimpleIdentifier, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncWith'\] | BlockScope, Statement, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='withitem'\] | SimpleIdentifier, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='With'\] | Block, Scope, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='With\.body'\] | Block, Scope, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='With\.items'\] | Identifier, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncWith'\] | Block, Scope, Statement, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='withitem'\] | Identifier, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Return'\] | Return, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Break'\] | Break, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Continue'\] | Continue, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Compare'\] | BinaryExpression, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Compare'\]/\*\[@InternalType='Compare\.ops'\] | BinaryExpressionOp | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Compare'\]/\*\[@internalRole\]\[@internalRole='left'\] | BinaryExpressionLeft | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Compare\.comparators'\] | BinaryExpressionRight | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Compare'\] | Expression, Binary | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Compare'\]/\*\[@InternalType='Compare\.ops'\] | Expression, Binary, Operator | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Compare'\]/\*\[@internalRole\]\[@internalRole='left'\] | Expression, Binary, Left | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Compare\.comparators'\] | Expression, Binary, Right | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='If'\] | If, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='If'\]/\*\[@InternalType='If\.body'\] | IfBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='If'\]/\*\[@internalRole\]\[@internalRole='test'\] | IfCondition | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='If'\]/\*\[@InternalType='If\.orelse'\] | IfElse | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='If'\]/\*\[@InternalType='If\.body'\] | If, Body, Then | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='If'\]/\*\[@internalRole\]\[@internalRole='test'\] | If, Condition | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='If'\]/\*\[@InternalType='If\.orelse'\] | If, Body, Else | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IfExp'\] | If, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IfExp'\]/\*\[@internalRole\]\[@internalRole='body'\] | IfBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IfExp'\]/\*\[@internalRole\]\[@internalRole='test'\] | IfCondition | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IfExp'\]/\*\[@internalRole\]\[@internalRole='orelse'\] | IfElse | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Import'\] | ImportDeclaration, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='alias'\] | ImportPath, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ImportFrom\.module'\] | ImportPath, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='alias\.asname'\] | ImportAlias, SimpleIdentifier | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ImportFrom'\] | ImportDeclaration, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\] | TypeDeclaration, SimpleIdentifier, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\]/\*\[@InternalType='ClassDef\.body'\] | TypeDeclarationBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\]/\*\[@InternalType='ClassDef\.bases'\] | TypeDeclarationBases | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IfExp'\]/\*\[@internalRole\]\[@internalRole='body'\] | If, Body, Then | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IfExp'\]/\*\[@internalRole\]\[@internalRole='test'\] | If, Condition | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IfExp'\]/\*\[@internalRole\]\[@internalRole='orelse'\] | If, Body, Else | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Import'\] | Import, Declaration, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='alias'\] | Import, Pathname, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ImportFrom\.module'\] | Import, Pathname, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='alias\.asname'\] | Import, Alias, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ImportFrom'\] | Import, Declaration, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\] | Type, Declaration, Identifier, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\]/\*\[@InternalType='ClassDef\.decorator\_list'\] | Type, Call, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\]/\*\[@InternalType='ClassDef\.body'\] | Type, Declaration, Body | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\]/\*\[@InternalType='ClassDef\.bases'\] | Type, Declaration, Base | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\]/\*\[@InternalType='ClassDef\.keywords'\] | Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\]/\*\[@InternalType='ClassDef\.keywords'\]/\*\[@InternalType='keyword'\] | SimpleIdentifier, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\] | ForEach, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\]/\*\[@InternalType='For\.body'\] | ForBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\]/\*\[@internalRole\]\[@internalRole='iter'\] | ForExpression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\]/\*\[@internalRole\]\[@internalRole='target'\] | ForUpdate | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\]/\*\[@InternalType='For\.orelse'\] | IfElse | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\] | ForEach, Statement, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\]/\*\[@InternalType='AsyncFor\.body'\] | ForBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\]/\*\[@internalRole\]\[@internalRole='iter'\] | ForExpression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\]/\*\[@internalRole\]\[@internalRole='target'\] | ForUpdate | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\]/\*\[@InternalType='AsyncFor\.orelse'\] | IfElse | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ClassDef'\]/\*\[@InternalType='ClassDef\.keywords'\]/\*\[@InternalType='keyword'\] | Identifier, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\] | For, Iterator, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\]/\*\[@InternalType='For\.body'\] | For, Body | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\]/\*\[@internalRole\]\[@internalRole='iter'\] | For, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\]/\*\[@internalRole\]\[@internalRole='target'\] | For, Update | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='For'\]/\*\[@InternalType='For\.orelse'\] | For, Body, Else | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\] | For, Iterator, Statement, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\]/\*\[@InternalType='AsyncFor\.body'\] | For, Body | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\]/\*\[@internalRole\]\[@internalRole='iter'\] | For, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\]/\*\[@internalRole\]\[@internalRole='target'\] | For, Update | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFor'\]/\*\[@InternalType='AsyncFor\.orelse'\] | For, Body, Else | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='While'\] | While, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='While'\]/\*\[@InternalType='While\.body'\] | WhileBody | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='While'\]/\*\[@internalRole\]\[@internalRole='test'\] | WhileCondition | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='While'\]/\*\[@InternalType='While\.orelse'\] | IfElse | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='While'\]/\*\[@InternalType='While\.body'\] | While, Body | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='While'\]/\*\[@internalRole\]\[@internalRole='test'\] | While, Condition | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='While'\]/\*\[@InternalType='While\.orelse'\] | While, Body, Else | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Pass'\] | Noop, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Assert'\] | Assert, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Exec'\] | Call, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Exec'\]/\*\[@internalRole\]\[@internalRole='body'\] | CallPositionalArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Exec'\]/\*\[@internalRole\]\[@internalRole='globals'\] | CallPositionalArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Exec'\]/\*\[@internalRole\]\[@internalRole='locals'\] | CallPositionalArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\] | Call, CallCallee, SimpleIdentifier, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\]/\*\[@internalRole\]\[@internalRole='dest'\] | CallPositionalArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\]/\*\[@internalRole\]\[@internalRole='nl'\] | CallPositionalArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\]/\*\[@internalRole\]\[@internalRole='values'\] | CallPositionalArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\]/\*\[@internalRole\]\[@internalRole='values'\]/\*\[\*\] | CallPositionalArgument | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AnnAssign'\] | Assignment, Comment, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Annotation'\] | Comment, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Exec'\] | Function, Call, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Exec'\]/\*\[@internalRole\]\[@internalRole='body'\] | Call, Argument, Positional | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Exec'\]/\*\[@internalRole\]\[@internalRole='globals'\] | Call, Argument, Positional | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Exec'\]/\*\[@internalRole\]\[@internalRole='locals'\] | Call, Argument, Positional | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\] | Function, Call, Callee, Identifier, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\]/\*\[@internalRole\]\[@internalRole='dest'\] | Call, Argument, Positional | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\]/\*\[@internalRole\]\[@internalRole='nl'\] | Call, Argument, Positional | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\]/\*\[@internalRole\]\[@internalRole='values'\] | Call, Argument, Positional | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Print'\]/\*\[@internalRole\]\[@internalRole='values'\]/\*\[\*\] | Call, Argument, Positional | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AnnAssign'\] | Operator, Binary, Assignment, Comment, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='annotation'\] | Comment, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='returns'\] | Comment, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Ellipsis'\] | SimpleIdentifier, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\] | ForEach, Expression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@internalRole\]\[@internalRole='iter'\] | ForUpdate, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@internalRole\]\[@internalRole='target'\] | ForExpression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@InternalType='Compare'\] | IfCondition, BinaryExpression | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@InternalType='Compare'\]/\*\[@InternalType='Compare\.ops'\] | BinaryExpressionOp | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@InternalType='Compare'\]/\*\[@internalRole\]\[@internalRole='left'\] | BinaryExpressionLeft | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ListComp'\] | ListLiteral, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='DictComp'\] | MapLiteral, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='SetComp'\] | SetLiteral, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Ellipsis'\] | Identifier, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ListComp'\] | Literal, List, For, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='DictComp'\] | Literal, Map, For, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='SetComp'\] | Literal, Set, For, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\] | For, Iterator, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@internalRole\]\[@internalRole='iter'\] | For, Update, Statement | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@internalRole\]\[@internalRole='target'\] | For, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@InternalType='Compare'\] | If, Condition, Expression, Binary | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@InternalType='Compare'\]/\*\[@InternalType='Compare\.ops'\] | Expression, Binary, Operator | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@InternalType='Compare'\]/\*\[@internalRole\]\[@internalRole='left'\] | Expression, Binary, Left | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Delete'\] | Statement, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Await'\] | Statement, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Global'\] | Statement, VisibleFromWorld, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Nonlocal'\] | Statement, VisibleFromModule, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Global'\] | Statement, Visibility, World, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Nonlocal'\] | Statement, Visibility, Module, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Yield'\] | Return, Statement, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='YieldFrom'\] | Return, Statement, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Yield'\] | ListLiteral, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Yield'\] | Literal, List, Expression, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Subscript'\] | Expression, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Index'\] | Expression, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Slice'\] | Expression, Incomplete | diff --git a/driver/main.go b/driver/main.go index 03755fdc..062cfc6f 100644 --- a/driver/main.go +++ b/driver/main.go @@ -1,7 +1,7 @@ package main import ( - "gopkg.in/bblfsh/sdk.v0/protocol/driver" + "gopkg.in/bblfsh/sdk.v1/protocol/driver" "github.com/bblfsh/python-driver/driver/normalizer" ) diff --git a/driver/normalizer/annotation.go b/driver/normalizer/annotation.go index 57dfae58..7711cb43 100644 --- a/driver/normalizer/annotation.go +++ b/driver/normalizer/annotation.go @@ -5,8 +5,8 @@ import ( "github.com/bblfsh/python-driver/driver/normalizer/pyast" - . "gopkg.in/bblfsh/sdk.v0/uast" - . "gopkg.in/bblfsh/sdk.v0/uast/ann" + "gopkg.in/bblfsh/sdk.v1/uast" + . "gopkg.in/bblfsh/sdk.v1/uast/ann" ) /* @@ -17,7 +17,7 @@ import ( */ /* -For a description of Python AST nodes: +uast.For a description of Python AST nodes: https://greentreesnakes.readthedocs.io/en/latest/nodes.html @@ -31,325 +31,299 @@ Unmarked nodes or nodes needing new features from the SDK: BoolOp arguments.defaults - arguments.keywords: same Compare.comparators Compare.ops - IfCondition.left + uast.Ifuast.Condition.left (see: https://greentreesnakes.readthedocs.io/en/latest/nodes.html#Compare) */ +// AnnotationRules for the Python driver var AnnotationRules = On(Any).Self( - On(Not(HasInternalType(pyast.Module))).Error(errors.New("root must be Module")), - On(HasInternalType(pyast.Module)).Roles(File).Descendants( + On(Not(pyast.Module)).Error(errors.New("root must be uast.Module")), + On(pyast.Module).Roles(uast.File).Descendants( + // Binary Expressions - On(HasInternalType(pyast.BinOp)).Roles(BinaryExpression, Expression).Children( - On(HasInternalRole("op")).Roles(BinaryExpressionOp), - On(HasInternalRole("left")).Roles(BinaryExpressionLeft), - On(HasInternalRole("right")).Roles(BinaryExpressionRight), + On(pyast.BinOp).Roles(uast.Expression, uast.Binary).Children( + On(HasInternalRole("op")).Roles(uast.Expression, uast.Binary, uast.Operator), + On(HasInternalRole("left")).Roles(uast.Expression, uast.Binary, uast.Left), + On(HasInternalRole("right")).Roles(uast.Expression, uast.Binary, uast.Right), ), + // Comparison operators - On(HasInternalType(pyast.Eq)).Roles(OpEqual), - On(HasInternalType(pyast.NotEq)).Roles(OpNotEqual), - On(HasInternalType(pyast.Lt)).Roles(OpLessThan), - On(HasInternalType(pyast.LtE)).Roles(OpLessThanEqual), - On(HasInternalType(pyast.Gt)).Roles(OpGreaterThan), - On(HasInternalType(pyast.GtE)).Roles(OpGreaterThanEqual), - On(HasInternalType(pyast.Is)).Roles(OpSame), - On(HasInternalType(pyast.IsNot)).Roles(OpNotSame), - On(HasInternalType(pyast.In)).Roles(OpContains), - On(HasInternalType(pyast.NotIn)).Roles(OpNotContains), + On(pyast.Eq).Roles(uast.Operator, uast.Equal), + On(pyast.NotEq).Roles(uast.Operator, uast.Equal, uast.Not), + On(pyast.Lt).Roles(uast.Operator, uast.LessThan), + On(pyast.LtE).Roles(uast.Operator, uast.LessThanOrEqual), + On(pyast.Gt).Roles(uast.Operator, uast.GreaterThan), + On(pyast.GtE).Roles(uast.Operator, uast.GreaterThanOrEqual), + On(pyast.Is).Roles(uast.Operator, uast.Identical), + On(pyast.IsNot).Roles(uast.Operator, uast.Identical, uast.Not), + On(pyast.In).Roles(uast.Operator, uast.Contains), + On(pyast.NotIn).Roles(uast.Operator, uast.Contains, uast.Not), // Aritmetic operators - On(HasInternalType(pyast.Add)).Roles(OpAdd), - On(HasInternalType(pyast.Sub)).Roles(OpSubstract), - On(HasInternalType(pyast.Mult)).Roles(OpMultiply), - On(HasInternalType(pyast.Div)).Roles(OpDivide), - On(HasInternalType(pyast.Mod)).Roles(OpMod), - On(HasInternalType(pyast.FloorDiv)).Roles(OpDivide, Incomplete), - On(HasInternalType(pyast.Pow)).Roles(Incomplete), - On(HasInternalType(pyast.MatMult)).Roles(OpMultiply, Incomplete), + On(pyast.Add).Roles(uast.Add), + On(pyast.Sub).Roles(uast.Substract), + On(pyast.Mult).Roles(uast.Multiply), + On(pyast.Div).Roles(uast.Divide), + On(pyast.Mod).Roles(uast.Modulo), + On(pyast.FloorDiv).Roles(uast.Divide, uast.Incomplete), + On(pyast.Pow).Roles(uast.Incomplete), + On(pyast.MatMult).Roles(uast.Multiply, uast.Incomplete), // Bitwise operators - On(HasInternalType(pyast.LShift)).Roles(OpBitwiseLeftShift), - On(HasInternalType(pyast.RShift)).Roles(OpBitwiseRightShift), - On(HasInternalType(pyast.BitOr)).Roles(OpBitwiseOr), - On(HasInternalType(pyast.BitXor)).Roles(OpBitwiseXor), - On(HasInternalType(pyast.BitAnd)).Roles(OpBitwiseAnd), + On(pyast.LShift).Roles(uast.Bitwise, uast.LeftShift), + On(pyast.RShift).Roles(uast.Bitwise, uast.RightShift), + On(pyast.BitOr).Roles(uast.Bitwise, uast.Or), + On(pyast.BitXor).Roles(uast.Bitwise, uast.Xor), + On(pyast.BitAnd).Roles(uast.Bitwise, uast.And), // Boolean operators - On(HasInternalType(pyast.And)).Roles(OpBooleanAnd), - On(HasInternalType(pyast.Or)).Roles(OpBooleanOr), - On(HasInternalType(pyast.Not)).Roles(OpBooleanNot), - - On(HasInternalType(pyast.UnaryOp)).Roles(Expression, Incomplete), + // Not applying the "Binary" role since even while in the Python code + // boolean operators use (seemingly binary) infix notation, the generated + // AST nodes use prefix. + On(pyast.And).Roles(uast.Operator, uast.Boolean, uast.And), + On(pyast.Or).Roles(uast.Operator, uast.Boolean, uast.Or), + On(pyast.Not).Roles(uast.Operator, uast.Boolean, uast.Not), + On(pyast.UnaryOp).Roles(uast.Operator, uast.Unary, uast.Expression), // Unary operators - On(HasInternalType(pyast.Invert)).Roles(OpBitwiseComplement), - On(HasInternalType(pyast.UAdd)).Roles(OpPositive), - On(HasInternalType(pyast.USub)).Roles(OpNegative), - - On(HasInternalType(pyast.Str)).Roles(StringLiteral, Expression), - On(HasInternalType(pyast.Bytes)).Roles(ByteStringLiteral, Expression), - On(HasInternalType(pyast.Num)).Roles(NumberLiteral, Expression), - On(HasInternalType(pyast.BoolLiteral)).Roles(BooleanLiteral, Expression), - On(HasInternalType(pyast.JoinedStr)).Roles(StringLiteral, Expression).Children( - On(HasInternalType(pyast.FormattedValue)).Roles(Expression, Incomplete), + On(pyast.Invert).Roles(uast.Operator, uast.Unary, uast.Bitwise, uast.Not), + On(pyast.UAdd).Roles(uast.Operator, uast.Unary, uast.Positive), + On(pyast.USub).Roles(uast.Operator, uast.Unary, uast.Negative), + + // Literals + On(pyast.Str).Roles(uast.Literal, uast.String, uast.Expression), + On(pyast.StringLiteral).Roles(uast.Literal, uast.String, uast.Expression), + On(pyast.Bytes).Roles(uast.Literal, uast.ByteString, uast.Expression), + On(pyast.Num).Roles(uast.Literal, uast.Number, uast.Expression).Children( + On(HasInternalRole("n")).Roles(uast.Literal, uast.Number, uast.Expression), ), - On(HasInternalType(pyast.NoneLiteral)).Roles(NullLiteral, Expression), - On(HasInternalType(pyast.Set)).Roles(SetLiteral, Expression), - On(HasInternalType(pyast.List)).Roles(ListLiteral, Expression), - On(HasInternalType(pyast.Dict)).Roles(MapLiteral, Expression).Children( - On(HasInternalRole("keys")).Roles(MapKey), - On(HasInternalRole("values")).Roles(MapValue), + On(pyast.BoolLiteral).Roles(uast.Literal, uast.Boolean, uast.Expression), + On(pyast.JoinedStr).Roles(uast.Literal, uast.String, uast.Expression).Children( + On(pyast.FormattedValue).Roles(uast.Expression, uast.Incomplete), ), - On(HasInternalType(pyast.Tuple)).Roles(TupleLiteral, Expression), + On(pyast.NoneLiteral).Roles(uast.Literal, uast.Null, uast.Expression), + On(pyast.Set).Roles(uast.Literal, uast.Set, uast.Expression), + On(pyast.List).Roles(uast.Literal, uast.List, uast.Expression), + On(pyast.Dict).Roles(uast.Literal, uast.Map, uast.Expression).Children( + On(HasInternalRole("keys")).Roles(uast.Map, uast.Key), + On(HasInternalRole("values")).Roles(uast.Map, uast.Value), + ), + On(pyast.Tuple).Roles(uast.Literal, uast.Tuple, uast.Expression), // FIXME: the FunctionDeclarationReceiver is not set for methods; it should be taken from the parent // Type node Token (2 levels up) but the SDK doesn't allow this + On(pyast.FunctionDef).Roles(uast.Function, uast.Declaration, uast.Name, uast.Identifier), + On(pyast.AsyncFunctionDef).Roles(uast.Function, uast.Declaration, uast.Name, uast.Identifier, uast.Incomplete), + On(pyast.FuncDecorators).Roles(uast.Function, uast.Call, uast.Incomplete), + On(pyast.FuncDefBody).Roles(uast.Function, uast.Declaration, uast.Body), + // FIXME: arguments is a Groping node, update it we get a "Grouper" or "Container" role + On(HasInternalRole("arguments")).Roles(uast.Argument, uast.Incomplete), + On(HasInternalRole("args")).Roles(uast.Argument, uast.Name, uast.Identifier), + On(HasInternalRole("vararg")).Roles(uast.Argument, uast.ArgsList, uast.Name, uast.Identifier), + On(HasInternalRole("kwarg")).Roles(uast.Argument, uast.ArgsList, uast.Map, uast.Name, uast.Identifier), + On(HasInternalRole("kwonlyargs")).Roles(uast.Argument, uast.ArgsList, uast.Map, uast.Name, uast.Identifier), + // Default arguments: Python's AST puts default arguments on a sibling list to the one of + // arguments that must be mapped to the arguments right-aligned like: + // a, b=2, c=3 -> + // args [a,b,c], + // defaults [2,3] // TODO: create an issue for the SDK - On(HasInternalType(pyast.FunctionDef)).Roles(FunctionDeclaration, FunctionDeclarationName, - SimpleIdentifier), - On(HasInternalType(pyast.AsyncFunctionDef)).Roles(FunctionDeclaration, - FunctionDeclarationName, SimpleIdentifier, Incomplete), - On(HasInternalType("FunctionDef.decorator_list")).Roles(Call, Incomplete), - On(HasInternalType("FunctionDef.body")).Roles(FunctionDeclarationBody), - // FIXME: change to FunctionDeclarationArgumentS once the PR has been merged - On(HasInternalType(pyast.Arguments)).Roles(FunctionDeclarationArgument, Incomplete).Children( - On(HasInternalRole("args")).Roles(FunctionDeclarationArgument, FunctionDeclarationArgumentName, - SimpleIdentifier), - On(HasInternalRole("vararg")).Roles(FunctionDeclarationArgument, FunctionDeclarationVarArgsList, - FunctionDeclarationArgumentName, SimpleIdentifier), - // FIXME: this is really different from vararg, change it when we have FunctionDeclarationMap - // or something similar in the UAST - On(HasInternalRole("kwarg")).Roles(FunctionDeclarationArgument, FunctionDeclarationVarArgsList, - FunctionDeclarationArgumentName, Incomplete, SimpleIdentifier), - // Default arguments: Python's AST puts default arguments on a sibling list to the one of - // arguments that must be mapped to the arguments right-aligned like: - // a, b=2, c=3 -> - // args [a,b,c], - // defaults [2,3] - // TODO: create an issue for the SDK - On(HasInternalType("arguments.defaults")).Roles(FunctionDeclarationArgumentDefaultValue, Incomplete), - On(HasInternalType("arguments.keywords")).Roles(FunctionDeclarationArgumentDefaultValue, Incomplete), - On(HasInternalType("AsyncFunctionDef.decorator_list")).Roles(Call, Incomplete), - On(HasInternalType("AsyncFunctionDef.body")).Roles(FunctionDeclarationBody), - // FIXME: change to FunctionDeclarationArgumentS once the PR has been merged - ), - On(HasInternalType(pyast.Lambda)).Roles(FunctionDeclaration, Expression, Incomplete).Children( - On(HasInternalType("Lambda.body")).Roles(FunctionDeclarationBody), - // FIXME: change to FunctionDeclarationArgumentS once the PR has been merged - On(HasInternalType(pyast.Arguments)).Roles(FunctionDeclarationArgument, Incomplete).Children( - On(HasInternalRole("args")).Roles(FunctionDeclarationArgument, FunctionDeclarationArgumentName, - SimpleIdentifier), - On(HasInternalRole("vararg")).Roles(FunctionDeclarationArgument, FunctionDeclarationVarArgsList, - FunctionDeclarationArgumentName, SimpleIdentifier), - // FIXME: this is really different from vararg, change it when we have FunctionDeclarationMap - // or something similar in the UAST - On(HasInternalRole("kwarg")).Roles(FunctionDeclarationArgument, FunctionDeclarationVarArgsList, - FunctionDeclarationArgumentName, Incomplete, SimpleIdentifier), - // Default arguments: Python's AST puts default arguments on a sibling list to the one of - // arguments that must be mapped to the arguments right-aligned like: - // a, b=2, c=3 -> - // args [a,b,c], - // defaults [2,3] - // TODO: create an issue for the SDK - On(HasInternalType("arguments.defaults")).Roles(FunctionDeclarationArgumentDefaultValue, - Incomplete), - On(HasInternalType("arguments.keywords")).Roles(FunctionDeclarationArgumentDefaultValue, - Incomplete), - ), + On(pyast.ArgumentDefaults).Roles(uast.Function, uast.Declaration, uast.Argument, uast.Value, uast.Incomplete), + On(pyast.AsyncFuncDecorators).Roles(uast.Function, uast.Call, uast.Incomplete), + On(pyast.AsyncFuncDefBody).Roles(uast.Function, uast.Declaration, uast.Body), + // FIXME: change to Function, Declaration, ArgumentS once the PR has been merged + On(pyast.Lambda).Roles(uast.Function, uast.Declaration, uast.Expression, uast.Incomplete).Children( + On(pyast.LambdaBody).Roles(uast.Function, uast.Declaration, uast.Body), ), - On(HasInternalType(pyast.Attribute)).Roles(SimpleIdentifier, Expression).Children( - On(HasInternalType(pyast.Name)).Roles(QualifiedIdentifier)), + On(pyast.Attribute).Roles(uast.Identifier, uast.Expression).Children( + On(pyast.Name).Roles(uast.Identifier, uast.Qualified)), - On(HasInternalType(pyast.Call)).Roles(Call, Expression).Children( - On(HasInternalRole("args")).Roles(CallPositionalArgument), - On(HasInternalRole("keywords")).Roles(CallNamedArgument).Children( - On(HasInternalRole("value")).Roles(CallNamedArgumentValue), + On(pyast.Call).Roles(uast.Function, uast.Call, uast.Expression).Children( + On(HasInternalRole("args")).Roles(uast.Call, uast.Argument, uast.Positional), + On(HasInternalRole("keywords")).Roles(uast.Call, uast.Argument, uast.Name).Children( + On(HasInternalRole("value")).Roles(uast.Call, uast.Argument, uast.Value), ), On(HasInternalRole("func")).Self( - On(HasInternalType(pyast.Name)).Roles(CallCallee), - On(HasInternalType(pyast.Attribute)).Roles(CallCallee).Children( - On(HasInternalRole("value")).Roles(CallReceiver), + On(pyast.Name).Roles(uast.Call, uast.Callee), + On(pyast.Attribute).Roles(uast.Call, uast.Callee).Children( + On(HasInternalRole("value")).Roles(uast.Call, uast.Receiver), )), ), // // Assign => Assigment: - // targets[] => AssignmentVariable - // value => AssignmentValue + // targets[] => Left + // value => Right // - On(HasInternalType(pyast.Assign)).Roles(Assignment, Expression).Children( - On(HasInternalRole("targets")).Roles(AssignmentVariable), - On(HasInternalRole("value")).Roles(AssignmentValue), + On(pyast.Assign).Roles(uast.Binary, uast.Assignment, uast.Expression).Children( + On(HasInternalRole("targets")).Roles(uast.Left), + On(HasInternalRole("value")).Roles(uast.Right), ), - On(HasInternalType(pyast.AugAssign)).Roles(AugmentedAssignment, Statement).Children( - On(HasInternalRole("op")).Roles(AugmentedAssignmentOperator), - On(HasInternalRole("target")).Roles(AugmentedAssignmentVariable), - On(HasInternalRole("value")).Roles(AugmentedAssignmentValue), + On(pyast.AugAssign).Roles(uast.Operator, uast.Binary, uast.Assignment, uast.Statement).Children( + On(HasInternalRole("op")).Roles(uast.Operator, uast.Binary), + On(HasInternalRole("target")).Roles(uast.Left), + On(HasInternalRole("value")).Roles(uast.Right), ), - On(HasInternalType(pyast.Expression)).Roles(Expression), - On(HasInternalType(pyast.Expr)).Roles(Expression), - On(HasInternalType(pyast.Name)).Roles(SimpleIdentifier, Expression), + On(pyast.Expression).Roles(uast.Expression), + On(pyast.Expr).Roles(uast.Expression), + On(pyast.Name).Roles(uast.Identifier, uast.Expression), // Comments and non significative whitespace - On(HasInternalType(pyast.SameLineNoops)).Roles(Comment), - On(HasInternalType(pyast.PreviousNoops)).Roles(Whitespace).Children( - On(HasInternalRole("lines")).Roles(Comment), + On(pyast.SameLineNoops).Roles(uast.Comment), + On(pyast.PreviousNoops).Roles(uast.Whitespace).Children( + On(HasInternalRole("lines")).Roles(uast.Comment), ), - On(HasInternalType(pyast.RemainderNoops)).Roles(Whitespace).Children( - On(HasInternalRole("lines")).Roles(Comment), + On(pyast.RemainderNoops).Roles(uast.Whitespace).Children( + On(HasInternalRole("lines")).Roles(uast.Comment), ), // TODO: check what Constant nodes are generated in the python AST and improve this - On(HasInternalType(pyast.Constant)).Roles(SimpleIdentifier, Expression), - On(HasInternalType(pyast.Try)).Roles(Try, Statement).Children( - On(HasInternalType("Try.body")).Roles(TryBody), - On(HasInternalType("Try.finalbody")).Roles(TryFinally), - On(HasInternalType("Try.handlers")).Roles(TryCatch), - On(HasInternalType("Try.orelse")).Roles(IfElse), + On(pyast.Constant).Roles(uast.Identifier, uast.Expression), + On(pyast.Try).Roles(uast.Try, uast.Statement).Children( + On(pyast.TryBody).Roles(uast.Try, uast.Body), + On(pyast.TryFinalBody).Roles(uast.Try, uast.Finally), + On(pyast.TryHandlers).Roles(uast.Try, uast.Catch), + On(pyast.TryElse).Roles(uast.Try, uast.Body, uast.Else), ), - On(HasInternalType(pyast.TryExcept)).Roles(TryCatch, Statement), // py2 - On(HasInternalType(pyast.ExceptHandler)).Roles(TryCatch, Statement), // py3 - On(HasInternalType("ExceptHandler.name")).Roles(SimpleIdentifier), - On(HasInternalType(pyast.TryFinally)).Roles(TryFinally, Statement), - On(HasInternalType(pyast.Raise)).Roles(Throw, Statement), + On(pyast.TryExcept).Roles(uast.Try, uast.Catch, uast.Statement), // py2 + On(pyast.ExceptHandler).Roles(uast.Try, uast.Catch, uast.Statement), // py3 + On(pyast.ExceptHandlerName).Roles(uast.Identifier), + On(pyast.TryFinally).Roles(uast.Try, uast.Finally, uast.Statement), + On(pyast.Raise).Roles(uast.Throw, uast.Statement), // FIXME: review, add path for the body and items childs - On(HasInternalType(pyast.With)).Roles(BlockScope, Statement), - On(HasInternalType("With.body")).Roles(BlockScope, Expression, Incomplete), - On(HasInternalType("With.items")).Roles(SimpleIdentifier, Expression, Incomplete), - On(HasInternalType(pyast.AsyncWith)).Roles(BlockScope, Statement, Incomplete), - On(HasInternalType(pyast.Withitem)).Roles(SimpleIdentifier, Incomplete), - On(HasInternalType(pyast.Return)).Roles(Return, Statement), - On(HasInternalType(pyast.Break)).Roles(Break, Statement), - On(HasInternalType(pyast.Continue)).Roles(Continue, Statement), - // FIXME: IfCondition bodies in Python take the form: - // 1 < a < 10 - // - left (internalRole): 1 (first element) - // - Compare.ops (internalType): [LessThan, LessThan] - // - Compare.comparators (internalType): ['a', 10] + On(pyast.With).Roles(uast.Block, uast.Scope, uast.Statement), + On(pyast.WithBody).Roles(uast.Block, uast.Scope, uast.Expression, uast.Incomplete), + On(pyast.WithItems).Roles(uast.Identifier, uast.Expression, uast.Incomplete), + On(pyast.AsyncWith).Roles(uast.Block, uast.Scope, uast.Statement, uast.Incomplete), + On(pyast.Withitem).Roles(uast.Identifier, uast.Incomplete), + On(pyast.Return).Roles(uast.Return, uast.Statement), + On(pyast.Break).Roles(uast.Break, uast.Statement), + On(pyast.Continue).Roles(uast.Continue, uast.Statement), + + // - Compare.ops (internaluast.Type): [uast.LessThan, uast.LessThan] + // - Compare.comparators (internaluast.Type): ['a', 10] // The current mapping is: - // - left: BinaryExpressionLeft - // - Compare.ops: BinaryExpressionOp - // - Compare.comparators: BinaryExpressionRight + // - left: uast.Expression, uast.Binary, uast.Left + // - Compare.ops: uast.Expression, uast.Binary, uast.Operator + // - Compare.comparators: uast.Expression, uast.Binary, uast.Right // But this is obviously not correct. To fix this properly we would need // and SDK feature to mix lists (also needed for default and keyword arguments and // boolean operators). - // "If that sounds awkward is because it is" (their words) - On(HasInternalType(pyast.Compare)).Roles(BinaryExpression, Expression).Children( - On(HasInternalType("Compare.ops")).Roles(BinaryExpressionOp), - On(HasInternalRole("left")).Roles(BinaryExpressionLeft), + // "uast.If that sounds awkward is because it is" (their words) + On(pyast.Compare).Roles(uast.Expression, uast.Binary).Children( + On(pyast.CompareOps).Roles(uast.Expression, uast.Binary, uast.Operator), + On(HasInternalRole("left")).Roles(uast.Expression, uast.Binary, uast.Left), ), - On(HasInternalType("Compare.comparators")).Roles(BinaryExpressionRight), - On(HasInternalType(pyast.If)).Roles(If, Statement).Children( - On(HasInternalType("If.body")).Roles(IfBody), - On(HasInternalRole("test")).Roles(IfCondition), - On(HasInternalType("If.orelse")).Roles(IfElse), + On(pyast.CompareComparators).Roles(uast.Expression, uast.Binary, uast.Right), + On(pyast.If).Roles(uast.If, uast.Statement).Children( + On(pyast.IfBody).Roles(uast.If, uast.Body, uast.Then), + On(HasInternalRole("test")).Roles(uast.If, uast.Condition), + On(pyast.IfElse).Roles(uast.If, uast.Body, uast.Else), ), - On(HasInternalType(pyast.IfExp)).Roles(If, Expression).Children( + On(pyast.IfExp).Roles(uast.If, uast.Expression).Children( // These are used on ifexpressions (a = 1 if x else 2) - On(HasInternalRole("body")).Roles(IfBody), - On(HasInternalRole("test")).Roles(IfCondition), - On(HasInternalRole("orelse")).Roles(IfElse), + On(HasInternalRole("body")).Roles(uast.If, uast.Body, uast.Then), + On(HasInternalRole("test")).Roles(uast.If, uast.Condition), + On(HasInternalRole("orelse")).Roles(uast.If, uast.Body, uast.Else), ), - On(HasInternalType(pyast.Import)).Roles(ImportDeclaration, Statement), + On(pyast.Import).Roles(uast.Import, uast.Declaration, uast.Statement), // "y" in "from x import y" or "import y" - On(HasInternalType(pyast.Alias)).Roles(ImportPath, SimpleIdentifier), + On(pyast.Alias).Roles(uast.Import, uast.Pathname, uast.Identifier), // "x" in "from x import y" - On(HasInternalType("ImportFrom.module")).Roles(ImportPath, SimpleIdentifier), + On(pyast.ImportFromModule).Roles(uast.Import, uast.Pathname, uast.Identifier), // "y" in "import x as y" - On(HasInternalType("alias.asname")).Roles(ImportAlias, SimpleIdentifier), - On(HasInternalType(pyast.ImportFrom)).Roles(ImportDeclaration, Statement), - On(HasInternalType(pyast.ClassDef)).Roles(TypeDeclaration, SimpleIdentifier, Statement).Children( - On(HasInternalType("ClassDef.body")).Roles(TypeDeclarationBody), - On(HasInternalType("ClassDef.bases")).Roles(TypeDeclarationBases), - On(HasInternalType("ClassDef.keywords")).Roles(Incomplete).Children( - On(HasInternalType(pyast.Keyword)).Roles(SimpleIdentifier, Incomplete), + On(pyast.AliasAsName).Roles(uast.Import, uast.Alias, uast.Identifier), + On(pyast.ImportFrom).Roles(uast.Import, uast.Declaration, uast.Statement), + On(pyast.ClassDef).Roles(uast.Type, uast.Declaration, uast.Identifier, uast.Statement).Children( + On(pyast.ClassDefDecorators).Roles(uast.Type, uast.Call, uast.Incomplete), + On(pyast.ClassDefBody).Roles(uast.Type, uast.Declaration, uast.Body), + On(pyast.ClassDefBases).Roles(uast.Type, uast.Declaration, uast.Base), + On(pyast.ClassDefKeywords).Roles(uast.Incomplete).Children( + On(pyast.Keyword).Roles(uast.Identifier, uast.Incomplete), ), ), - On(HasInternalType(pyast.For)).Roles(ForEach, Statement).Children( - On(HasInternalType("For.body")).Roles(ForBody), - On(HasInternalRole("iter")).Roles(ForExpression), - On(HasInternalRole("target")).Roles(ForUpdate), - On(HasInternalType("For.orelse")).Roles(IfElse), + On(pyast.For).Roles(uast.For, uast.Iterator, uast.Statement).Children( + On(pyast.ForBody).Roles(uast.For, uast.Body), + On(HasInternalRole("iter")).Roles(uast.For, uast.Expression), + On(HasInternalRole("target")).Roles(uast.For, uast.Update), + On(pyast.ForElse).Roles(uast.For, uast.Body, uast.Else), ), - On(HasInternalType(pyast.AsyncFor)).Roles(ForEach, Statement, Incomplete).Children( - On(HasInternalType("AsyncFor.body")).Roles(ForBody), - On(HasInternalRole("iter")).Roles(ForExpression), - On(HasInternalRole("target")).Roles(ForUpdate), - On(HasInternalType("AsyncFor.orelse")).Roles(IfElse), + On(pyast.AsyncFor).Roles(uast.For, uast.Iterator, uast.Statement, uast.Incomplete).Children( + On(pyast.AsyncForBody).Roles(uast.For, uast.Body), + On(HasInternalRole("iter")).Roles(uast.For, uast.Expression), + On(HasInternalRole("target")).Roles(uast.For, uast.Update), + On(pyast.AsyncForElse).Roles(uast.For, uast.Body, uast.Else), ), - On(HasInternalType(pyast.While)).Roles(While, Statement).Children( - On(HasInternalType("While.body")).Roles(WhileBody), - On(HasInternalRole("test")).Roles(WhileCondition), - On(HasInternalType("While.orelse")).Roles(IfElse), + On(pyast.While).Roles(uast.While, uast.Statement).Children( + On(pyast.WhileBody).Roles(uast.While, uast.Body), + On(HasInternalRole("test")).Roles(uast.While, uast.Condition), + On(pyast.WhileElse).Roles(uast.While, uast.Body, uast.Else), ), - On(HasInternalType(pyast.Pass)).Roles(Noop, Statement), - // FIXME: this is the annotated assignment (a: annotation = 3) not exactly Assignment - // it also lacks AssignmentValue and AssignmentVariable (see how to add them) - On(HasInternalType(pyast.Assert)).Roles(Assert, Statement), - - // These are AST nodes in Python2 but we convert them to functions in the UAST like - // they are in Python3 - On(HasInternalType(pyast.Exec)).Roles(Call, Expression).Children( - On(HasInternalRole("body")).Roles(CallPositionalArgument), - On(HasInternalRole("globals")).Roles(CallPositionalArgument), - On(HasInternalRole("locals")).Roles(CallPositionalArgument), + On(pyast.Pass).Roles(uast.Noop, uast.Statement), + On(pyast.Assert).Roles(uast.Assert, uast.Statement), + + // These are AST nodes in Python2 but we convert them to functions in the UAST + // like they are in Python3 + On(pyast.Exec).Roles(uast.Function, uast.Call, uast.Expression).Children( + On(HasInternalRole("body")).Roles(uast.Call, uast.Argument, uast.Positional), + On(HasInternalRole("globals")).Roles(uast.Call, uast.Argument, uast.Positional), + On(HasInternalRole("locals")).Roles(uast.Call, uast.Argument, uast.Positional), ), - // Repr already comes as a Call \o/ + // Repr already comes as a uast.Call \o/ // Print as a function too. - On(HasInternalType(pyast.Print)).Roles(Call, CallCallee, SimpleIdentifier, Expression).Children( - On(HasInternalRole("dest")).Roles(CallPositionalArgument), - On(HasInternalRole("nl")).Roles(CallPositionalArgument), - On(HasInternalRole("values")).Roles(CallPositionalArgument).Children( - On(Any).Roles(CallPositionalArgument), + On(pyast.Print).Roles(uast.Function, uast.Call, uast.Callee, uast.Identifier, uast.Expression).Children( + On(HasInternalRole("dest")).Roles(uast.Call, uast.Argument, uast.Positional), + On(HasInternalRole("nl")).Roles(uast.Call, uast.Argument, uast.Positional), + On(HasInternalRole("values")).Roles(uast.Call, uast.Argument, uast.Positional).Children( + On(Any).Roles(uast.Call, uast.Argument, uast.Positional), ), ), - // Python annotations for variables, function argument or return values doesn't have any semantic - // information by themselves and this we consider it comments (some preprocessors or linters can use - // them, the runtimes ignore them). The TOKEN will take the annotation in the UAST node so - // the information is keept in any case. - // FIXME: need annotation or type UAST roles - On(HasInternalType(pyast.AnnAssign)).Roles(Assignment, Comment, Incomplete), - On(HasInternalType(pyast.Annotation)).Roles(Comment, Incomplete), - On(HasInternalRole(pyast.Returns)).Roles(Comment, Incomplete), - - // Python very odd ellipsis operator. Has a special rule in tonoder synthetic tokens - // map to load it with the token "PythonEllipsisOperator" and gets the role SimpleIdentifier - On(HasInternalType(pyast.Ellipsis)).Roles(SimpleIdentifier, Incomplete), - - // List/Map/Set comprehensions. We map the "for x in y" to ForEach roles and the - // "if something" to If* roles. FIXME: missing the top comprehension roles in the UAST, change - // once they've been merged - On(HasInternalType(pyast.Comprehension)).Roles(ForEach, Expression).Children( - On(HasInternalRole("iter")).Roles(ForUpdate, Statement), - On(HasInternalRole("target")).Roles(ForExpression), - // FIXME: see the comment on IfCondition above - On(HasInternalType(pyast.Compare)).Roles(IfCondition, BinaryExpression).Children( - On(HasInternalType("Compare.ops")).Roles(BinaryExpressionOp), - On(HasInternalRole("left")).Roles(BinaryExpressionLeft), + // Python annotations for variables, function argument or return values doesn't + // have any semantic information by themselves and this we consider it comments + // (some preprocessors or linters can use them, the runtimes ignore them). The + // TOKEN will take the annotation in the UAST node so the information is keept in + // any case. FIXME: need annotation or type UAST roles + On(pyast.AnnAssign).Roles(uast.Operator, uast.Binary, uast.Assignment, uast.Comment, uast.Incomplete), + On(HasInternalRole("annotation")).Roles(uast.Comment, uast.Incomplete), + On(HasInternalRole("returns")).Roles(uast.Comment, uast.Incomplete), + + // Python very odd ellipsis operatouast. Has a special rule in tonoder synthetic tokens + // map to load it with the token "PythonEllipsisuast.Operator" and gets the role uast.Identifier + On(pyast.Ellipsis).Roles(uast.Identifier, uast.Incomplete), + + // uast.List/uast.Map/uast.Set comprehensions. We map the "for x in y" to uast.For, uast.Iterator (foreach) + // roles and the "if something" to uast.If* roles. FIXME: missing the top comprehension + // roles in the UAST, change once they've been merged + On(pyast.ListComp).Roles(uast.Literal, uast.List, uast.For, uast.Expression, uast.Incomplete), + On(pyast.DictComp).Roles(uast.Literal, uast.Map, uast.For, uast.Expression, uast.Incomplete), + On(pyast.SetComp).Roles(uast.Literal, uast.Set, uast.For, uast.Expression, uast.Incomplete), + On(pyast.Comprehension).Roles(uast.For, uast.Iterator, uast.Expression).Children( + On(HasInternalRole("iter")).Roles(uast.For, uast.Update, uast.Statement), + On(HasInternalRole("target")).Roles(uast.For, uast.Expression), + // FIXME: see the comment on uast.If, uast.Condition above + On(pyast.Compare).Roles(uast.If, uast.Condition, uast.Expression, uast.Binary).Children( + On(pyast.CompareOps).Roles(uast.Expression, uast.Binary, uast.Operator), + On(HasInternalRole("left")).Roles(uast.Expression, uast.Binary, uast.Left), ), ), - On(HasInternalType(pyast.ListComp)).Roles(ListLiteral, Expression, Incomplete), - On(HasInternalType(pyast.DictComp)).Roles(MapLiteral, Expression, Incomplete), - On(HasInternalType(pyast.SetComp)).Roles(SetLiteral, Expression, Incomplete), - - On(HasInternalType(pyast.Delete)).Roles(Statement, Incomplete), - On(HasInternalType(pyast.Await)).Roles(Statement, Incomplete), - On(HasInternalType(pyast.Global)).Roles(Statement, VisibleFromWorld, Incomplete), - On(HasInternalType(pyast.Nonlocal)).Roles(Statement, VisibleFromModule, Incomplete), - - On(HasInternalType(pyast.Yield)).Roles(Return, Statement, Incomplete), - On(HasInternalType(pyast.YieldFrom)).Roles(Return, Statement, Incomplete), - On(HasInternalType(pyast.Yield)).Roles(ListLiteral, Expression, Incomplete), - - On(HasInternalType(pyast.Subscript)).Roles(Expression, Incomplete), - On(HasInternalType(pyast.Index)).Roles(Expression, Incomplete), - On(HasInternalType(pyast.Slice)).Roles(Expression, Incomplete), - On(HasInternalType(pyast.ExtSlice)).Roles(Expression, Incomplete), - ), -) + + On(pyast.Delete).Roles(uast.Statement, uast.Incomplete), + On(pyast.Await).Roles(uast.Statement, uast.Incomplete), + On(pyast.Global).Roles(uast.Statement, uast.Visibility, uast.World, uast.Incomplete), + On(pyast.Nonlocal).Roles(uast.Statement, uast.Visibility, uast.Module, uast.Incomplete), + + On(pyast.Yield).Roles(uast.Return, uast.Statement, uast.Incomplete), + On(pyast.YieldFrom).Roles(uast.Return, uast.Statement, uast.Incomplete), + On(pyast.Yield).Roles(uast.Literal, uast.List, uast.Expression, uast.Incomplete), + + On(pyast.Subscript).Roles(uast.Expression, uast.Incomplete), + On(pyast.Index).Roles(uast.Expression, uast.Incomplete), + On(pyast.Slice).Roles(uast.Expression, uast.Incomplete), + On(pyast.ExtSlice).Roles(uast.Expression, uast.Incomplete), + )) diff --git a/driver/normalizer/annotation_test.go b/driver/normalizer/annotation_test.go index 4cef339c..e6a55f00 100644 --- a/driver/normalizer/annotation_test.go +++ b/driver/normalizer/annotation_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/bblfsh/sdk.v0/uast" + "gopkg.in/bblfsh/sdk.v1/uast" ) var ( diff --git a/driver/normalizer/parser.go b/driver/normalizer/parser.go index bce2d09e..a68fdc88 100644 --- a/driver/normalizer/parser.go +++ b/driver/normalizer/parser.go @@ -1,8 +1,8 @@ package normalizer import ( - "gopkg.in/bblfsh/sdk.v0/protocol/driver" - "gopkg.in/bblfsh/sdk.v0/protocol/native" + "gopkg.in/bblfsh/sdk.v1/protocol/driver" + "gopkg.in/bblfsh/sdk.v1/protocol/native" ) var ToNoder = &native.ObjectToNoder{ diff --git a/driver/normalizer/pyast/pyast.go b/driver/normalizer/pyast/pyast.go index c51ad582..8a34590c 100644 --- a/driver/normalizer/pyast/pyast.go +++ b/driver/normalizer/pyast/pyast.go @@ -1,143 +1,172 @@ // Package pyast defines constants from Python 2 and 3 AST. package pyast -// GENERATED BY python-driver/native/gogen/gogen.py -// DO NOT EDIT +import "gopkg.in/bblfsh/sdk.v1/uast/ann" // Python 2+3 AST node types. -// FIXME: ColumnKey? (col_offset in Python) // This includes all classes extending from _ast.AST for both Python 2 and 3. // See: // https://docs.python.org/3.6/library/ast.html#abstract-grammar // https://docs.python.org/2.7/library/ast.html#abstract-grammar -const ( - Add = "Add" - Alias = "alias" - And = "And" - AnnAssign = "AnnAssign" - Annotation = "Annotation" - Arg = "arg" - Arguments = "arguments" - Assert = "Assert" - Assign = "Assign" - AsyncFor = "AsyncFor" - AsyncFunctionDef = "AsyncFunctionDef" - AsyncWith = "AsyncWith" - Attribute = "Attribute" - AugAssign = "AugAssign" - AugLoad = "AugLoad" - AugStore = "AugStore" - Await = "Await" - BinOp = "BinOp" - BitAnd = "BitAnd" - BitOr = "BitOr" - BitXor = "BitXor" - BoolLiteral = "BoolLiteral" - BoolOp = "BoolOp" - BoolopInternal = "boolop" - Break = "Break" - Bytes = "Bytes" - Call = "Call" - ClassDef = "ClassDef" - Cmpop = "cmpop" - Compare = "Compare" - Comprehension = "comprehension" - Constant = "Constant" - Continue = "Continue" - Del = "Del" - Delete = "Delete" - Dict = "Dict" - DictComp = "DictComp" - Div = "Div" - Ellipsis = "Ellipsis" - Eq = "Eq" - ExceptHandler = "ExceptHandler" - ExcepthandlerInternal = "excepthandler" - Exec = "Exec" - Expr = "Expr" - ExprInternal = "expr" - Expr_context = "expr_context" - Expression = "Expression" - ExtSlice = "ExtSlice" - FloorDiv = "FloorDiv" - For = "For" - FormattedValue = "FormattedValue" - FunctionDef = "FunctionDef" - GeneratorExp = "GeneratorExp" - Global = "Global" - Gt = "Gt" - GtE = "GtE" - If = "If" - IfExp = "IfExp" - Import = "Import" - ImportFrom = "ImportFrom" - In = "In" - Index = "Index" - Interactive = "Interactive" - Invert = "Invert" - Is = "Is" - IsNot = "IsNot" - JoinedStr = "JoinedStr" - Keyword = "keyword" - LShift = "LShift" - Lambda = "Lambda" - List = "List" - ListComp = "ListComp" - Load = "Load" - Lt = "Lt" - LtE = "LtE" - MatMult = "MatMult" - Mod = "Mod" - ModInternal = "mod" - Module = "Module" - Mult = "Mult" - Name = "Name" - NameConstant = "NameConstant" - NoneLiteral = "NoneLiteral" - Nonlocal = "Nonlocal" - NoopLine = "NoopLine" - Noop_lineInternal = "noop_line" - Not = "Not" - NotEq = "NotEq" - NotIn = "NotIn" - Num = "Num" - Operator = "operator" - Or = "Or" - Param = "Param" - Pass = "Pass" - Pow = "Pow" - PreviousNoops = "PreviousNoops" - Print = "Print" - RShift = "RShift" - Raise = "Raise" - RemainderNoops = "RemainderNoops" - Repr = "Repr" - Return = "Return" - Returns = "returns" - SameLineNoops = "SameLineNoops" - Set = "Set" - SetComp = "SetComp" - Slice = "Slice" - SliceInternal = "slice" - Starred = "Starred" - Stmt = "stmt" - Store = "Store" - Str = "Str" - Sub = "Sub" - Subscript = "Subscript" - Suite = "Suite" - Try = "Try" - TryExcept = "TryExcept" - TryFinally = "TryFinally" - Tuple = "Tuple" - UAdd = "UAdd" - USub = "USub" - UnaryOp = "UnaryOp" - UnaryopInternal = "unaryop" - While = "While" - With = "With" - Withitem = "withitem" - Yield = "Yield" - YieldFrom = "YieldFrom" +var ( + Add = ann.HasInternalType("Add") + Alias = ann.HasInternalType("alias") + AliasAsName = ann.HasInternalType("alias.asname") + And = ann.HasInternalType("And") + AnnAssign = ann.HasInternalType("AnnAssign") + Annotation = ann.HasInternalType("Annotation") + Arg = ann.HasInternalType("arg") + ArgumentDefaults = ann.HasInternalType("arguments.defaults") + Arguments = ann.HasInternalType("arguments") + Assert = ann.HasInternalType("Assert") + Assign = ann.HasInternalType("Assign") + AsyncFor = ann.HasInternalType("AsyncFor") + AsyncForBody = ann.HasInternalType("AsyncFor.body") + AsyncForElse = ann.HasInternalType("AsyncFor.orelse") + AsyncFuncDecorators = ann.HasInternalType("AsyncFunctionDef.decorator_list") + AsyncFuncDefBody = ann.HasInternalType("AsyncFunctionDef.body") + AsyncFunctionDef = ann.HasInternalType("AsyncFunctionDef") + AsyncWith = ann.HasInternalType("AsyncWith") + Attribute = ann.HasInternalType("Attribute") + AugAssign = ann.HasInternalType("AugAssign") + AugLoad = ann.HasInternalType("AugLoad") + AugStore = ann.HasInternalType("AugStore") + Await = ann.HasInternalType("Await") + BinOp = ann.HasInternalType("BinOp") + BitAnd = ann.HasInternalType("BitAnd") + BitOr = ann.HasInternalType("BitOr") + BitXor = ann.HasInternalType("BitXor") + BoolLiteral = ann.HasInternalType("BoolLiteral") + BoolOp = ann.HasInternalType("BoolOp") + BoolopInternal = ann.HasInternalType("boolop") + Break = ann.HasInternalType("Break") + ByteLiteral = ann.HasInternalType("ByteLiteral") + Bytes = ann.HasInternalType("Bytes") + Call = ann.HasInternalType("Call") + ClassDef = ann.HasInternalType("ClassDef") + ClassDefDecorators = ann.HasInternalType("ClassDef.decorator_list") + ClassDefBases = ann.HasInternalType("ClassDef.bases") + ClassDefBody = ann.HasInternalType("ClassDef.body") + ClassDefKeywords = ann.HasInternalType("ClassDef.keywords") + Cmpop = ann.HasInternalType("cmpop") + Compare = ann.HasInternalType("Compare") + CompareComparators = ann.HasInternalType("Compare.comparators") + CompareOps = ann.HasInternalType("Compare.ops") + Comprehension = ann.HasInternalType("comprehension") + Constant = ann.HasInternalType("Constant") + Continue = ann.HasInternalType("Continue") + Del = ann.HasInternalType("Del") + Delete = ann.HasInternalType("Delete") + Dict = ann.HasInternalType("Dict") + DictComp = ann.HasInternalType("DictComp") + Div = ann.HasInternalType("Div") + Ellipsis = ann.HasInternalType("Ellipsis") + Eq = ann.HasInternalType("Eq") + ExceptHandler = ann.HasInternalType("ExceptHandler") + ExceptHandlerName = ann.HasInternalType("ExceptHandler.name") + ExcepthandlerInternal = ann.HasInternalType("excepthandler") + Exec = ann.HasInternalType("Exec") + Expr = ann.HasInternalType("Expr") + ExprInternal = ann.HasInternalType("expr") + ExprContext = ann.HasInternalType("expr_context") + Expression = ann.HasInternalType("Expression") + ExtSlice = ann.HasInternalType("ExtSlice") + FloorDiv = ann.HasInternalType("FloorDiv") + For = ann.HasInternalType("For") + ForBody = ann.HasInternalType("For.body") + ForElse = ann.HasInternalType("For.orelse") + FormattedValue = ann.HasInternalType("FormattedValue") + FuncDecorators = ann.HasInternalType("FunctionDef.decorator_list") + FuncDefBody = ann.HasInternalType("FunctionDef.body") + FunctionDef = ann.HasInternalType("FunctionDef") + GeneratorExp = ann.HasInternalType("GeneratorExp") + Global = ann.HasInternalType("Global") + Gt = ann.HasInternalType("Gt") + GtE = ann.HasInternalType("GtE") + If = ann.HasInternalType("If") + IfBody = ann.HasInternalType("If.body") + IfElse = ann.HasInternalType("If.orelse") + IfExp = ann.HasInternalType("IfExp") + Import = ann.HasInternalType("Import") + ImportFrom = ann.HasInternalType("ImportFrom") + ImportFromModule = ann.HasInternalType("ImportFrom.module") + In = ann.HasInternalType("In") + Index = ann.HasInternalType("Index") + Interactive = ann.HasInternalType("Interactive") + Invert = ann.HasInternalType("Invert") + Is = ann.HasInternalType("Is") + IsNot = ann.HasInternalType("IsNot") + JoinedStr = ann.HasInternalType("JoinedStr") + Keyword = ann.HasInternalType("keyword") + LShift = ann.HasInternalType("LShift") + Lambda = ann.HasInternalType("Lambda") + LambdaBody = ann.HasInternalType("Lambda.body") + List = ann.HasInternalType("List") + ListComp = ann.HasInternalType("ListComp") + Load = ann.HasInternalType("Load") + Lt = ann.HasInternalType("Lt") + LtE = ann.HasInternalType("LtE") + MatMult = ann.HasInternalType("MatMult") + Mod = ann.HasInternalType("Mod") + ModInternal = ann.HasInternalType("mod") + Module = ann.HasInternalType("Module") + Mult = ann.HasInternalType("Mult") + Name = ann.HasInternalType("Name") + NameConstant = ann.HasInternalType("NameConstant") + NoneLiteral = ann.HasInternalType("NoneLiteral") + Nonlocal = ann.HasInternalType("Nonlocal") + NoopLine = ann.HasInternalType("NoopLine") + Noop_lineInternal = ann.HasInternalType("noop_line") + Not = ann.HasInternalType("Not") + NotEq = ann.HasInternalType("NotEq") + NotIn = ann.HasInternalType("NotIn") + Num = ann.HasInternalType("Num") + Operator = ann.HasInternalType("operator") + Or = ann.HasInternalType("Or") + Param = ann.HasInternalType("Param") + Pass = ann.HasInternalType("Pass") + Pow = ann.HasInternalType("Pow") + PreviousNoops = ann.HasInternalType("PreviousNoops") + Print = ann.HasInternalType("Print") + RShift = ann.HasInternalType("RShift") + Raise = ann.HasInternalType("Raise") + RemainderNoops = ann.HasInternalType("RemainderNoops") + Repr = ann.HasInternalType("Repr") + Return = ann.HasInternalType("Return") + Returns = ann.HasInternalType("returns") + SameLineNoops = ann.HasInternalType("SameLineNoops") + Set = ann.HasInternalType("Set") + SetComp = ann.HasInternalType("SetComp") + Slice = ann.HasInternalType("Slice") + SliceInternal = ann.HasInternalType("slice") + StringLiteral = ann.HasInternalType("StringLiteral") + Starred = ann.HasInternalType("Starred") + Stmt = ann.HasInternalType("stmt") + Store = ann.HasInternalType("Store") + Str = ann.HasInternalType("Str") + Sub = ann.HasInternalType("Sub") + Subscript = ann.HasInternalType("Subscript") + Suite = ann.HasInternalType("Suite") + Try = ann.HasInternalType("Try") + TryBody = ann.HasInternalType("Try.body") + TryElse = ann.HasInternalType("Try.orelse") + TryExcept = ann.HasInternalType("TryExcept") + TryFinalBody = ann.HasInternalType("Try.finalbody") + TryFinally = ann.HasInternalType("TryFinally") + TryHandlers = ann.HasInternalType("Try.handlers") + Tuple = ann.HasInternalType("Tuple") + UAdd = ann.HasInternalType("UAdd") + USub = ann.HasInternalType("USub") + UnaryOp = ann.HasInternalType("UnaryOp") + UnaryopInternal = ann.HasInternalType("unaryop") + While = ann.HasInternalType("While") + WhileBody = ann.HasInternalType("While.body") + WhileElse = ann.HasInternalType("While.orelse") + With = ann.HasInternalType("With") + WithBody = ann.HasInternalType("With.body") + WithItems = ann.HasInternalType("With.items") + Withitem = ann.HasInternalType("withitem") + Yield = ann.HasInternalType("Yield") + YieldFrom = ann.HasInternalType("YieldFrom") ) diff --git a/tests/annotations.py.uast b/tests/annotations.py.uast index 3133906e..d2d8cee0 100644 --- a/tests/annotations.py.uast +++ b/tests/annotations.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: AnnAssign { -. . . Roles: Assignment,Comment,Incomplete +. . . Roles: Operator,Binary,Assignment,Comment,Incomplete . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -17,7 +17,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . TOKEN "int" . . . . . StartPosition: { . . . . . . Offset: 3 @@ -35,7 +35,7 @@ Module { . . . . . } . . . . } . . . . 1: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 0 @@ -53,7 +53,7 @@ Module { . . . . . } . . . . } . . . . 2: Num { -. . . . . Roles: NumberLiteral,Expression +. . . . . Roles: Literal,Number,Expression . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 9 @@ -72,7 +72,7 @@ Module { . . . } . . } . . 1: AnnAssign { -. . . Roles: Assignment,Comment,Incomplete +. . . Roles: Operator,Binary,Assignment,Comment,Incomplete . . . StartPosition: { . . . . Offset: 11 . . . . Line: 2 @@ -85,7 +85,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . TOKEN "float" . . . . . StartPosition: { . . . . . . Offset: 14 @@ -103,7 +103,7 @@ Module { . . . . . } . . . . } . . . . 1: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression . . . . . TOKEN "b" . . . . . StartPosition: { . . . . . . Offset: 11 @@ -123,7 +123,7 @@ Module { . . . } . . } . . 2: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "somefunc" . . . StartPosition: { . . . . Offset: 24 @@ -140,7 +140,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -148,7 +148,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 33 @@ -165,7 +165,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . . . . . TOKEN "int" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 36 @@ -185,7 +185,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "b" . . . . . . . StartPosition: { . . . . . . . . Offset: 41 @@ -202,7 +202,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . . . . . TOKEN "str" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 44 @@ -224,7 +224,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -244,7 +244,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "0" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 70 @@ -265,7 +265,7 @@ Module { . . . . . } . . . . } . . . . 2: Name { -. . . . . Roles: SimpleIdentifier,Expression,Comment,Incomplete +. . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . TOKEN "float" . . . . . StartPosition: { . . . . . . Offset: 52 diff --git a/tests/aritmeticops.py.uast b/tests/aritmeticops.py.uast index 6edd946e..3ec22994 100644 --- a/tests/aritmeticops.py.uast +++ b/tests/aritmeticops.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 2 @@ -61,7 +61,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Add { -. . . . . . . Roles: BinaryExpressionOp,OpAdd +. . . . . . . Roles: Expression,Binary,Operator,Add . . . . . . . TOKEN "+" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -83,7 +83,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 4 . . . . . . Line: 2 @@ -94,7 +94,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 4 @@ -111,7 +111,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 6 @@ -128,7 +128,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Sub { -. . . . . . . Roles: BinaryExpressionOp,OpSubstract +. . . . . . . Roles: Expression,Binary,Operator,Substract . . . . . . . TOKEN "-" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -150,7 +150,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 8 . . . . . . Line: 3 @@ -161,7 +161,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 8 @@ -178,7 +178,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 10 @@ -195,7 +195,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Mult { -. . . . . . . Roles: BinaryExpressionOp,OpMultiply +. . . . . . . Roles: Expression,Binary,Operator,Multiply . . . . . . . TOKEN "*" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -217,7 +217,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 12 . . . . . . Line: 4 @@ -228,7 +228,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 12 @@ -245,7 +245,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 14 @@ -262,7 +262,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Div { -. . . . . . . Roles: BinaryExpressionOp,OpDivide +. . . . . . . Roles: Expression,Binary,Operator,Divide . . . . . . . TOKEN "/" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -284,7 +284,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 16 . . . . . . Line: 5 @@ -295,7 +295,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 16 @@ -312,7 +312,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -329,7 +329,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: FloorDiv { -. . . . . . . Roles: BinaryExpressionOp,OpDivide,Incomplete +. . . . . . . Roles: Expression,Binary,Operator,Divide,Incomplete . . . . . . . TOKEN "//" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -351,7 +351,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 21 . . . . . . Line: 6 @@ -362,7 +362,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 21 @@ -379,7 +379,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 23 @@ -396,7 +396,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Mod { -. . . . . . . Roles: BinaryExpressionOp,OpMod +. . . . . . . Roles: Expression,Binary,Operator,Modulo . . . . . . . TOKEN "%%" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -418,7 +418,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 25 . . . . . . Line: 7 @@ -429,7 +429,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 @@ -446,7 +446,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 28 @@ -463,7 +463,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Pow { -. . . . . . . Roles: BinaryExpressionOp,Incomplete +. . . . . . . Roles: Expression,Binary,Operator,Incomplete . . . . . . . TOKEN "**" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/assert_constant.py.uast b/tests/assert_constant.py.uast index bc8d907d..5acf90f2 100644 --- a/tests/assert_constant.py.uast +++ b/tests/assert_constant.py.uast @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: BoolLiteral { -. . . . . Roles: BooleanLiteral,Expression +. . . . . Roles: Literal,Boolean,Expression . . . . . TOKEN "true" . . . . . StartPosition: { . . . . . . Offset: 7 @@ -61,7 +61,7 @@ Module { . . . } . . . Children: { . . . . 0: BoolLiteral { -. . . . . Roles: BooleanLiteral,Expression +. . . . . Roles: Literal,Boolean,Expression . . . . . TOKEN "true" . . . . . StartPosition: { . . . . . . Offset: 20 @@ -98,7 +98,7 @@ Module { . . . } . . . Children: { . . . . 0: Str { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . TOKEN "assert message" . . . . . StartPosition: { . . . . . . Offset: 38 @@ -115,7 +115,7 @@ Module { . . . . . } . . . . } . . . . 1: BoolLiteral { -. . . . . Roles: BooleanLiteral,Expression +. . . . . Roles: Literal,Boolean,Expression . . . . . TOKEN "true" . . . . . StartPosition: { . . . . . . Offset: 32 diff --git a/tests/augassign.py.uast b/tests/augassign.py.uast index 412d87ad..1db7f084 100644 --- a/tests/augassign.py.uast +++ b/tests/augassign.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: AugAssign { -. . . Roles: AugmentedAssignment,Statement +. . . Roles: Operator,Binary,Assignment,Statement . . . TOKEN "?=" . . . StartPosition: { . . . . Offset: 2 @@ -22,7 +22,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AugmentedAssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 0 @@ -40,7 +40,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AugmentedAssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 5 @@ -57,7 +57,7 @@ Module { . . . . . } . . . . } . . . . 2: Add { -. . . . . Roles: OpAdd,AugmentedAssignmentOperator +. . . . . Roles: Add,Operator,Binary . . . . . TOKEN "+" . . . . . Properties: { . . . . . . internalRole: op @@ -66,7 +66,7 @@ Module { . . . } . . } . . 1: AugAssign { -. . . Roles: AugmentedAssignment,Statement +. . . Roles: Operator,Binary,Assignment,Statement . . . TOKEN "?=" . . . StartPosition: { . . . . Offset: 7 @@ -78,7 +78,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AugmentedAssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 7 @@ -96,7 +96,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AugmentedAssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 12 @@ -113,7 +113,7 @@ Module { . . . . . } . . . . } . . . . 2: Sub { -. . . . . Roles: OpSubstract,AugmentedAssignmentOperator +. . . . . Roles: Substract,Operator,Binary . . . . . TOKEN "-" . . . . . Properties: { . . . . . . internalRole: op @@ -122,7 +122,7 @@ Module { . . . } . . } . . 2: AugAssign { -. . . Roles: AugmentedAssignment,Statement +. . . Roles: Operator,Binary,Assignment,Statement . . . TOKEN "?=" . . . StartPosition: { . . . . Offset: 14 @@ -134,7 +134,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AugmentedAssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 14 @@ -152,7 +152,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AugmentedAssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 19 @@ -169,7 +169,7 @@ Module { . . . . . } . . . . } . . . . 2: Mult { -. . . . . Roles: OpMultiply,AugmentedAssignmentOperator +. . . . . Roles: Multiply,Operator,Binary . . . . . TOKEN "*" . . . . . Properties: { . . . . . . internalRole: op @@ -178,7 +178,7 @@ Module { . . . } . . } . . 3: AugAssign { -. . . Roles: AugmentedAssignment,Statement +. . . Roles: Operator,Binary,Assignment,Statement . . . TOKEN "?=" . . . StartPosition: { . . . . Offset: 21 @@ -190,7 +190,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AugmentedAssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 21 @@ -208,7 +208,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AugmentedAssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 26 @@ -225,7 +225,7 @@ Module { . . . . . } . . . . } . . . . 2: Div { -. . . . . Roles: OpDivide,AugmentedAssignmentOperator +. . . . . Roles: Divide,Operator,Binary . . . . . TOKEN "/" . . . . . Properties: { . . . . . . internalRole: op diff --git a/tests/bitwise.py.uast b/tests/bitwise.py.uast index db5ab619..75155643 100644 --- a/tests/bitwise.py.uast +++ b/tests/bitwise.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 4 @@ -61,7 +61,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitAnd { -. . . . . . . Roles: BinaryExpressionOp,OpBitwiseAnd +. . . . . . . Roles: Expression,Binary,Operator,Bitwise,And . . . . . . . TOKEN "&" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -83,7 +83,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 6 . . . . . . Line: 2 @@ -94,7 +94,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 6 @@ -111,7 +111,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 10 @@ -128,7 +128,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitOr { -. . . . . . . Roles: BinaryExpressionOp,OpBitwiseOr +. . . . . . . Roles: Expression,Binary,Operator,Bitwise,Or . . . . . . . TOKEN "|" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -150,7 +150,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 12 . . . . . . Line: 3 @@ -161,7 +161,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 12 @@ -178,7 +178,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 16 @@ -195,7 +195,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitXor { -. . . . . . . Roles: BinaryExpressionOp,OpBitwiseXor +. . . . . . . Roles: Expression,Binary,Operator,Bitwise,Xor . . . . . . . TOKEN "^" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -217,7 +217,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 18 . . . . . . Line: 4 @@ -228,7 +228,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 18 @@ -245,7 +245,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 23 @@ -262,7 +262,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: LShift { -. . . . . . . Roles: BinaryExpressionOp,OpBitwiseLeftShift +. . . . . . . Roles: Expression,Binary,Operator,Bitwise,LeftShift . . . . . . . TOKEN "<<" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -284,7 +284,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 25 . . . . . . Line: 5 @@ -295,7 +295,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 @@ -312,7 +312,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 30 @@ -329,7 +329,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: RShift { -. . . . . . . Roles: BinaryExpressionOp,OpBitwiseRightShift +. . . . . . . Roles: Expression,Binary,Operator,Bitwise,RightShift . . . . . . . TOKEN ">>" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -351,7 +351,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 32 . . . . . . Line: 6 @@ -362,7 +362,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: BinOp { -. . . . . . . Roles: BinaryExpressionLeft,BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary,Left,Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 38 . . . . . . . . Line: 6 @@ -373,7 +373,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: BinOp { -. . . . . . . . . Roles: BinaryExpressionLeft,BinaryExpression,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Expression,Binary . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 32 . . . . . . . . . . Line: 6 @@ -384,7 +384,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Num { -. . . . . . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . . . . . TOKEN "1" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 32 @@ -401,7 +401,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Num { -. . . . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . . . TOKEN "2" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 36 @@ -418,7 +418,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: BitAnd { -. . . . . . . . . . . Roles: BinaryExpressionOp,OpBitwiseAnd +. . . . . . . . . . . Roles: Expression,Binary,Operator,Bitwise,And . . . . . . . . . . . TOKEN "&" . . . . . . . . . . . Properties: { . . . . . . . . . . . . internalRole: op @@ -427,7 +427,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . TOKEN "3" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 40 @@ -444,7 +444,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: BitAnd { -. . . . . . . . . Roles: BinaryExpressionOp,OpBitwiseAnd +. . . . . . . . . Roles: Expression,Binary,Operator,Bitwise,And . . . . . . . . . TOKEN "&" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -453,7 +453,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "4" . . . . . . . StartPosition: { . . . . . . . . Offset: 44 @@ -470,7 +470,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitOr { -. . . . . . . Roles: BinaryExpressionOp,OpBitwiseOr +. . . . . . . Roles: Expression,Binary,Operator,Bitwise,Or . . . . . . . TOKEN "|" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -492,7 +492,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 46 . . . . . . Line: 7 @@ -503,7 +503,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: BinOp { -. . . . . . . Roles: BinaryExpressionLeft,BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary,Left,Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 47 . . . . . . . . Line: 7 @@ -514,7 +514,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 47 @@ -532,7 +532,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 51 @@ -549,7 +549,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: BinaryExpressionOp,OpAdd +. . . . . . . . . Roles: Expression,Binary,Operator,Add . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -558,7 +558,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: BinOp { -. . . . . . . Roles: BinaryExpressionRight,BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary,Right,Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 57 . . . . . . . . Line: 7 @@ -569,7 +569,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . TOKEN "d" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 57 @@ -587,7 +587,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 61 @@ -604,7 +604,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: BinaryExpressionOp,OpAdd +. . . . . . . . . Roles: Expression,Binary,Operator,Add . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -613,7 +613,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitOr { -. . . . . . . Roles: BinaryExpressionOp,OpBitwiseOr +. . . . . . . Roles: Expression,Binary,Operator,Bitwise,Or . . . . . . . TOKEN "|" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/classdef.py.uast b/tests/classdef.py.uast index 3e60f1f9..af49e461 100644 --- a/tests/classdef.py.uast +++ b/tests/classdef.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: ClassDef { -. . . Roles: TypeDeclaration,SimpleIdentifier,Statement +. . . Roles: Type,Declaration,Identifier,Statement . . . TOKEN "Animal" . . . StartPosition: { . . . . Offset: 6 @@ -22,13 +22,13 @@ Module { . . . } . . . Children: { . . . . 0: ClassDef.body { -. . . . . Roles: TypeDeclarationBody +. . . . . Roles: Type,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: FunctionDef { -. . . . . . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . . . . . Roles: Function,Declaration,Name,Identifier . . . . . . . TOKEN "__init__" . . . . . . . StartPosition: { . . . . . . . . Offset: 22 @@ -45,7 +45,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -53,7 +53,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 31 @@ -73,13 +73,13 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: FunctionDef.body { -. . . . . . . . . Roles: FunctionDeclarationBody +. . . . . . . . . Roles: Function,Declaration,Body . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Assign { -. . . . . . . . . . . Roles: Assignment,Expression +. . . . . . . . . . . Roles: Binary,Assignment,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 46 . . . . . . . . . . . . Line: 3 @@ -87,7 +87,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,AssignmentVariable +. . . . . . . . . . . . . Roles: Identifier,Expression,Left . . . . . . . . . . . . . TOKEN "_a" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 51 @@ -105,7 +105,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 46 @@ -125,7 +125,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . . . . . TOKEN "1" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 56 @@ -144,7 +144,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Assign { -. . . . . . . . . . . Roles: Assignment,Expression +. . . . . . . . . . . Roles: Binary,Assignment,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 66 . . . . . . . . . . . . Line: 4 @@ -152,7 +152,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . . . . . TOKEN "b" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 66 @@ -170,7 +170,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . . . . . TOKEN "2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 70 @@ -193,7 +193,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: FunctionDef { -. . . . . . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . . . . . Roles: Function,Declaration,Name,Identifier . . . . . . . TOKEN "method" . . . . . . . StartPosition: { . . . . . . . . Offset: 81 @@ -210,7 +210,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -218,7 +218,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 88 @@ -269,7 +269,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "arg1" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 94 @@ -289,7 +289,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: FunctionDef.body { -. . . . . . . . . Roles: FunctionDeclarationBody +. . . . . . . . . Roles: Function,Declaration,Body . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } @@ -313,7 +313,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: FunctionDef { -. . . . . . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . . . . . Roles: Function,Declaration,Name,Identifier . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 119 @@ -325,7 +325,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: FunctionDef.body { -. . . . . . . . . Roles: FunctionDeclarationBody +. . . . . . . . . Roles: Function,Declaration,Body . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } @@ -345,7 +345,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . TOKEN "_a" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 162 @@ -363,7 +363,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 157 @@ -420,13 +420,13 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: FunctionDef.decorator_list { -. . . . . . . . . Roles: Call,Incomplete +. . . . . . . . . Roles: Function,Call,Incomplete . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . TOKEN "property" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 120 @@ -445,7 +445,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: arguments { -. . . . . . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -455,7 +455,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: FunctionDef { -. . . . . . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . . . . . Roles: Function,Declaration,Name,Identifier . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 170 @@ -467,7 +467,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -475,7 +475,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "newa" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 190 @@ -528,13 +528,13 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: FunctionDef.body { -. . . . . . . . . Roles: FunctionDeclarationBody +. . . . . . . . . Roles: Function,Declaration,Body . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Assign { -. . . . . . . . . . . Roles: Assignment,Expression +. . . . . . . . . . . Roles: Binary,Assignment,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 205 . . . . . . . . . . . . Line: 15 @@ -542,7 +542,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,AssignmentVariable +. . . . . . . . . . . . . Roles: Identifier,Expression,Left . . . . . . . . . . . . . TOKEN "_a" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 210 @@ -560,7 +560,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 205 @@ -580,7 +580,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . Roles: AssignmentValue,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Right,Identifier,Expression . . . . . . . . . . . . . TOKEN "newa" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 215 @@ -602,13 +602,13 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: FunctionDef.decorator_list { -. . . . . . . . . Roles: Call,Incomplete +. . . . . . . . . Roles: Function,Call,Incomplete . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . TOKEN "setter" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 173 @@ -625,7 +625,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . TOKEN "a" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 171 @@ -653,7 +653,7 @@ Module { . . . } . . } . . 1: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 221 . . . . Line: 17 @@ -664,7 +664,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 221 @@ -715,7 +715,7 @@ Module { . . . . . } . . . . } . . . . 1: Call { -. . . . . Roles: Call,Expression,AssignmentValue +. . . . . Roles: Function,Call,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 225 . . . . . . Line: 17 @@ -726,7 +726,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "Animal" . . . . . . . StartPosition: { . . . . . . . . Offset: 225 @@ -748,7 +748,7 @@ Module { . . . } . . } . . 2: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 234 . . . . Line: 18 @@ -759,7 +759,7 @@ Module { . . . } . . . Children: { . . . . 0: Attribute { -. . . . . Roles: SimpleIdentifier,Expression,AssignmentVariable +. . . . . Roles: Identifier,Expression,Left . . . . . TOKEN "b" . . . . . StartPosition: { . . . . . . Offset: 236 @@ -777,7 +777,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 234 @@ -797,7 +797,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "3" . . . . . StartPosition: { . . . . . . Offset: 240 @@ -816,7 +816,7 @@ Module { . . . } . . } . . 3: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 242 . . . . Line: 19 @@ -827,7 +827,7 @@ Module { . . . } . . . Children: { . . . . 0: Attribute { -. . . . . Roles: SimpleIdentifier,Expression,AssignmentVariable +. . . . . Roles: Identifier,Expression,Left . . . . . TOKEN "g" . . . . . StartPosition: { . . . . . . Offset: 254 @@ -845,7 +845,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Attribute { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "f" . . . . . . . StartPosition: { . . . . . . . . Offset: 252 @@ -863,7 +863,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Attribute { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "e" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 250 @@ -881,7 +881,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . TOKEN "d" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 248 @@ -899,7 +899,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . TOKEN "c" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 246 @@ -917,7 +917,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . . . TOKEN "b" . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 244 @@ -935,7 +935,7 @@ Module { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . . . TOKEN "a" . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . Offset: 242 @@ -965,7 +965,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "6" . . . . . StartPosition: { . . . . . . Offset: 258 @@ -995,7 +995,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 260 . . . . . . Line: 20 @@ -1006,7 +1006,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "5" . . . . . . . StartPosition: { . . . . . . . . Offset: 269 @@ -1023,7 +1023,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Attribute { -. . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . TOKEN "method" . . . . . . . StartPosition: { . . . . . . . . Offset: 262 @@ -1041,7 +1041,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: QualifiedIdentifier,CallReceiver,SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Qualified,Call,Receiver,Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 260 diff --git a/tests/classdef_decorated.py.native b/tests/classdef_decorated.py.native new file mode 100644 index 00000000..6216677b --- /dev/null +++ b/tests/classdef_decorated.py.native @@ -0,0 +1,39 @@ +{ + "status": "ok", + "errors": [], + "ast": { + "PY3AST": { + "ast_type": "Module", + "body": [ + { + "ast_type": "ClassDef", + "bases": [], + "body": [ + { + "ast_type": "Pass", + "col_offset": 5, + "end_col_offset": 8, + "end_lineno": 3, + "lineno": 3 + } + ], + "col_offset": 1, + "decorator_list": [ + { + "ast_type": "Name", + "col_offset": 2, + "ctx": "Load", + "end_col_offset": 15, + "end_lineno": 1, + "id": "register_class", + "lineno": 1 + } + ], + "keywords": [], + "lineno": 1, + "name": "a" + } + ] + } + } +} diff --git a/tests/classdef_decorated.py.source b/tests/classdef_decorated.py.source new file mode 100644 index 00000000..00b062ef --- /dev/null +++ b/tests/classdef_decorated.py.source @@ -0,0 +1,3 @@ +@register_class +class a: + pass diff --git a/tests/classdef_decorated.py.uast b/tests/classdef_decorated.py.uast new file mode 100644 index 00000000..6f4b9a26 --- /dev/null +++ b/tests/classdef_decorated.py.uast @@ -0,0 +1,70 @@ +Status: ok +Errors: +UAST: +Module { +. Roles: File +. Children: { +. . 0: ClassDef { +. . . Roles: Type,Declaration,Identifier,Statement +. . . TOKEN "a" +. . . StartPosition: { +. . . . Offset: 0 +. . . . Line: 1 +. . . . Col: 1 +. . . } +. . . Properties: { +. . . . internalRole: body +. . . } +. . . Children: { +. . . . 0: ClassDef.body { +. . . . . Roles: Type,Declaration,Body +. . . . . Properties: { +. . . . . . promotedPropertyList: true +. . . . . } +. . . . . Children: { +. . . . . . 0: Pass { +. . . . . . . Roles: Noop,Statement +. . . . . . . TOKEN "pass" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 29 +. . . . . . . . Line: 3 +. . . . . . . . Col: 5 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 32 +. . . . . . . . Line: 3 +. . . . . . . . Col: 8 +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . . 1: ClassDef.decorator_list { +. . . . . Roles: Type,Call,Incomplete +. . . . . Properties: { +. . . . . . promotedPropertyList: true +. . . . . } +. . . . . Children: { +. . . . . . 0: Name { +. . . . . . . Roles: Identifier,Expression +. . . . . . . TOKEN "register_class" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 1 +. . . . . . . . Line: 1 +. . . . . . . . Col: 2 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 14 +. . . . . . . . Line: 1 +. . . . . . . . Col: 15 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . ctx: Load +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . } +. . } +. } +} + diff --git a/tests/classdef_inheritance.py.uast b/tests/classdef_inheritance.py.uast index 5e0ae8da..a2ec720c 100644 --- a/tests/classdef_inheritance.py.uast +++ b/tests/classdef_inheritance.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: ClassDef { -. . . Roles: TypeDeclaration,SimpleIdentifier,Statement +. . . Roles: Type,Declaration,Identifier,Statement . . . TOKEN "Dog" . . . StartPosition: { . . . . Offset: 6 @@ -22,13 +22,13 @@ Module { . . . } . . . Children: { . . . . 0: ClassDef.bases { -. . . . . Roles: TypeDeclarationBases +. . . . . Roles: Type,Declaration,Base . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "Animal" . . . . . . . StartPosition: { . . . . . . . . Offset: 10 @@ -47,7 +47,7 @@ Module { . . . . . } . . . . } . . . . 1: ClassDef.body { -. . . . . Roles: TypeDeclarationBody +. . . . . Roles: Type,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -71,7 +71,7 @@ Module { . . . } . . } . . 1: ClassDef { -. . . Roles: TypeDeclaration,SimpleIdentifier,Statement +. . . Roles: Type,Declaration,Identifier,Statement . . . TOKEN "RobotDog" . . . StartPosition: { . . . . Offset: 35 @@ -88,13 +88,13 @@ Module { . . . } . . . Children: { . . . . 0: ClassDef.bases { -. . . . . Roles: TypeDeclarationBases +. . . . . Roles: Type,Declaration,Base . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "Robot" . . . . . . . StartPosition: { . . . . . . . . Offset: 44 @@ -144,7 +144,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "Dog" . . . . . . . StartPosition: { . . . . . . . . Offset: 51 @@ -163,7 +163,7 @@ Module { . . . . . } . . . . } . . . . 1: ClassDef.body { -. . . . . Roles: TypeDeclarationBody +. . . . . Roles: Type,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } diff --git a/tests/classdef_metaclass_py2.py.uast b/tests/classdef_metaclass_py2.py.uast index 1bc57536..485789ce 100644 --- a/tests/classdef_metaclass_py2.py.uast +++ b/tests/classdef_metaclass_py2.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: ClassDef { -. . . Roles: TypeDeclaration,SimpleIdentifier,Statement +. . . Roles: Type,Declaration,Identifier,Statement . . . TOKEN "MySingleton" . . . StartPosition: { . . . . Offset: 6 @@ -22,13 +22,13 @@ Module { . . . } . . . Children: { . . . . 0: ClassDef.bases { -. . . . . Roles: TypeDeclarationBases +. . . . . Roles: Type,Declaration,Base . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "object" . . . . . . . StartPosition: { . . . . . . . . Offset: 18 @@ -47,13 +47,13 @@ Module { . . . . . } . . . . } . . . . 1: ClassDef.body { -. . . . . Roles: TypeDeclarationBody +. . . . . Roles: Type,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 31 . . . . . . . . Line: 2 @@ -61,7 +61,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "___metaclass__" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 31 @@ -79,7 +79,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: AssignmentValue,SimpleIdentifier,Expression +. . . . . . . . . Roles: Right,Identifier,Expression . . . . . . . . . TOKEN "Singleton" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 48 diff --git a/tests/classdef_metaclass_py3.py.uast b/tests/classdef_metaclass_py3.py.uast index b8f46b71..edd6a6a5 100644 --- a/tests/classdef_metaclass_py3.py.uast +++ b/tests/classdef_metaclass_py3.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: ClassDef { -. . . Roles: TypeDeclaration,SimpleIdentifier,Statement +. . . Roles: Type,Declaration,Identifier,Statement . . . TOKEN "MySingleton" . . . StartPosition: { . . . . Offset: 6 @@ -22,7 +22,7 @@ Module { . . . } . . . Children: { . . . . 0: ClassDef.body { -. . . . . Roles: TypeDeclarationBody +. . . . . Roles: Type,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -50,11 +50,11 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: keyword { -. . . . . . . Roles: SimpleIdentifier,Incomplete +. . . . . . . Roles: Identifier,Incomplete . . . . . . . TOKEN "metaclass" . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "Singleton" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 28 @@ -78,7 +78,7 @@ Module { . . . } . . } . . 1: ClassDef { -. . . Roles: TypeDeclaration,SimpleIdentifier,Statement +. . . Roles: Type,Declaration,Identifier,Statement . . . TOKEN "MySingleton" . . . StartPosition: { . . . . Offset: 56 @@ -95,13 +95,13 @@ Module { . . . } . . . Children: { . . . . 0: ClassDef.bases { -. . . . . Roles: TypeDeclarationBases +. . . . . Roles: Type,Declaration,Base . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "ParentClass" . . . . . . . StartPosition: { . . . . . . . . Offset: 68 @@ -153,7 +153,7 @@ Module { . . . . . } . . . . } . . . . 1: ClassDef.body { -. . . . . Roles: TypeDeclarationBody +. . . . . Roles: Type,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -181,11 +181,11 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: keyword { -. . . . . . . Roles: SimpleIdentifier,Incomplete +. . . . . . . Roles: Identifier,Incomplete . . . . . . . TOKEN "metaclass" . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "Singleton" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 91 diff --git a/tests/comments.py.uast b/tests/comments.py.uast index 7c189ea2..999bb647 100644 --- a/tests/comments.py.uast +++ b/tests/comments.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 39 . . . . Line: 3 @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 39 @@ -97,7 +97,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 43 diff --git a/tests/booleanop.py.native b/tests/comparisonop.py.native similarity index 100% rename from tests/booleanop.py.native rename to tests/comparisonop.py.native diff --git a/tests/booleanop.py.source b/tests/comparisonop.py.source similarity index 100% rename from tests/booleanop.py.source rename to tests/comparisonop.py.source diff --git a/tests/booleanop.py.uast b/tests/comparisonop.py.uast similarity index 85% rename from tests/booleanop.py.uast rename to tests/comparisonop.py.uast index f1599969..421fd2d7 100644 --- a/tests/booleanop.py.uast +++ b/tests/comparisonop.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Compare { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,13 +27,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 5 @@ -49,7 +49,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,BinaryExpressionLeft +. . . . . . . Roles: Literal,Number,Expression,Expression,Binary,Left . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 @@ -66,13 +66,13 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Eq { -. . . . . . . . . Roles: OpEqual +. . . . . . . . . Roles: Operator,Equal . . . . . . . . . TOKEN "==" . . . . . . . . } . . . . . . . } @@ -93,7 +93,7 @@ Module { . . . } . . . Children: { . . . . 0: Compare { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 7 . . . . . . Line: 2 @@ -104,13 +104,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 12 @@ -126,7 +126,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,BinaryExpressionLeft +. . . . . . . Roles: Literal,Number,Expression,Expression,Binary,Left . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 7 @@ -143,13 +143,13 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: NotEq { -. . . . . . . . . Roles: OpNotEqual +. . . . . . . . . Roles: Operator,Equal,Not . . . . . . . . . TOKEN "!=" . . . . . . . . } . . . . . . . } @@ -170,7 +170,7 @@ Module { . . . } . . . Children: { . . . . 0: UnaryOp { -. . . . . Roles: Expression,Incomplete +. . . . . Roles: Operator,Unary,Expression . . . . . StartPosition: { . . . . . . Offset: 14 . . . . . . Line: 3 @@ -181,7 +181,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 18 @@ -198,7 +198,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Not { -. . . . . . . Roles: OpBooleanNot +. . . . . . . Roles: Operator,Boolean,Not . . . . . . . TOKEN "!" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -220,7 +220,7 @@ Module { . . . } . . . Children: { . . . . 0: Compare { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 20 . . . . . . Line: 4 @@ -231,13 +231,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 25 @@ -251,7 +251,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "3" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 30 @@ -267,7 +267,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,BinaryExpressionLeft +. . . . . . . Roles: Literal,Number,Expression,Expression,Binary,Left . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 20 @@ -284,17 +284,17 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Eq { -. . . . . . . . . Roles: OpEqual +. . . . . . . . . Roles: Operator,Equal . . . . . . . . . TOKEN "==" . . . . . . . . } . . . . . . . . 1: Eq { -. . . . . . . . . Roles: OpEqual +. . . . . . . . . Roles: Operator,Equal . . . . . . . . . TOKEN "==" . . . . . . . . } . . . . . . . } @@ -315,7 +315,7 @@ Module { . . . } . . . Children: { . . . . 0: Compare { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 32 . . . . . . Line: 5 @@ -326,13 +326,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 36 @@ -346,7 +346,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "3" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 40 @@ -362,7 +362,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,BinaryExpressionLeft +. . . . . . . Roles: Literal,Number,Expression,Expression,Binary,Left . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 32 @@ -379,17 +379,17 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Lt { -. . . . . . . . . Roles: OpLessThan +. . . . . . . . . Roles: Operator,LessThan . . . . . . . . . TOKEN "<" . . . . . . . . } . . . . . . . . 1: Gt { -. . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } @@ -410,7 +410,7 @@ Module { . . . } . . . Children: { . . . . 0: Compare { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 42 . . . . . . Line: 6 @@ -421,13 +421,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 46 @@ -441,7 +441,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "3" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 51 @@ -457,7 +457,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,BinaryExpressionLeft +. . . . . . . Roles: Literal,Number,Expression,Expression,Binary,Left . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 42 @@ -474,17 +474,17 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Lt { -. . . . . . . . . Roles: OpLessThan +. . . . . . . . . Roles: Operator,LessThan . . . . . . . . . TOKEN "<" . . . . . . . . } . . . . . . . . 1: NotEq { -. . . . . . . . . Roles: OpNotEqual +. . . . . . . . . Roles: Operator,Equal,Not . . . . . . . . . TOKEN "!=" . . . . . . . . } . . . . . . . } diff --git a/tests/complex.py.native b/tests/complex.py.native new file mode 100644 index 00000000..17661f65 --- /dev/null +++ b/tests/complex.py.native @@ -0,0 +1,53 @@ +{ + "status": "ok", + "errors": [], + "ast": { + "PY3AST": { + "ast_type": "Module", + "body": [ + { + "ast_type": "Assign", + "col_offset": 1, + "lineno": 1, + "targets": [ + { + "ast_type": "Name", + "col_offset": 1, + "ctx": "Store", + "end_col_offset": 1, + "end_lineno": 1, + "id": "a", + "lineno": 1 + } + ], + "value": { + "ast_type": "BinOp", + "col_offset": 5, + "left": { + "ast_type": "Num", + "col_offset": 5, + "lineno": 1, + "n": { + "imag": 1, + "real": 0 + } + }, + "lineno": 1, + "op": { + "ast_type": "Mult" + }, + "right": { + "ast_type": "Num", + "col_offset": 10, + "lineno": 1, + "n": { + "imag": 1, + "real": 0 + } + } + } + } + ] + } + } +} diff --git a/tests/complex.py.source b/tests/complex.py.source new file mode 100644 index 00000000..786e0a4e --- /dev/null +++ b/tests/complex.py.source @@ -0,0 +1 @@ +a = 1j * 1j diff --git a/tests/complex.py.uast b/tests/complex.py.uast new file mode 100644 index 00000000..7e1a36cf --- /dev/null +++ b/tests/complex.py.uast @@ -0,0 +1,102 @@ +Status: ok +Errors: +UAST: +Module { +. Roles: File +. Children: { +. . 0: Assign { +. . . Roles: Binary,Assignment,Expression +. . . StartPosition: { +. . . . Offset: 0 +. . . . Line: 1 +. . . . Col: 1 +. . . } +. . . Properties: { +. . . . internalRole: body +. . . } +. . . Children: { +. . . . 0: Name { +. . . . . Roles: Left,Identifier,Expression +. . . . . TOKEN "a" +. . . . . StartPosition: { +. . . . . . Offset: 0 +. . . . . . Line: 1 +. . . . . . Col: 1 +. . . . . } +. . . . . EndPosition: { +. . . . . . Offset: 0 +. . . . . . Line: 1 +. . . . . . Col: 1 +. . . . . } +. . . . . Properties: { +. . . . . . ctx: Store +. . . . . . internalRole: targets +. . . . . } +. . . . } +. . . . 1: BinOp { +. . . . . Roles: Expression,Binary,Right +. . . . . StartPosition: { +. . . . . . Offset: 4 +. . . . . . Line: 1 +. . . . . . Col: 5 +. . . . . } +. . . . . Properties: { +. . . . . . internalRole: value +. . . . . } +. . . . . Children: { +. . . . . . 0: Num { +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression +. . . . . . . StartPosition: { +. . . . . . . . Offset: 4 +. . . . . . . . Line: 1 +. . . . . . . . Col: 5 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: left +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: { +. . . . . . . . . Roles: Literal,Number,Expression +. . . . . . . . . Properties: { +. . . . . . . . . . imag: 1 +. . . . . . . . . . internalRole: n +. . . . . . . . . . real: 0 +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . . 1: Num { +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression +. . . . . . . StartPosition: { +. . . . . . . . Offset: 9 +. . . . . . . . Line: 1 +. . . . . . . . Col: 10 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: right +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: { +. . . . . . . . . Roles: Literal,Number,Expression +. . . . . . . . . Properties: { +. . . . . . . . . . imag: 1 +. . . . . . . . . . internalRole: n +. . . . . . . . . . real: 0 +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . . 2: Mult { +. . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . TOKEN "*" +. . . . . . . Properties: { +. . . . . . . . internalRole: op +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . } +. . } +. } +} + diff --git a/tests/comprehension_dict.py.uast b/tests/comprehension_dict.py.uast index bb80eba8..ab172a44 100644 --- a/tests/comprehension_dict.py.uast +++ b/tests/comprehension_dict.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: DictComp { -. . . . . Roles: MapLiteral,Expression,Incomplete +. . . . . Roles: Literal,Map,For,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,14 +27,14 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: comprehension { -. . . . . . . Roles: ForEach,Expression +. . . . . . . Roles: For,Iterator,Expression . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Compare { -. . . . . . . . . Roles: BinaryExpression,Expression,IfCondition,BinaryExpression +. . . . . . . . . Roles: Expression,Binary,If,Condition,Expression,Binary . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 29 . . . . . . . . . . Line: 1 @@ -45,13 +45,13 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Compare.comparators { -. . . . . . . . . . . Roles: BinaryExpressionRight +. . . . . . . . . . . Roles: Expression,Binary,Right . . . . . . . . . . . Properties: { . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . . . . . TOKEN "2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 31 @@ -67,7 +67,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression,BinaryExpressionLeft,BinaryExpressionLeft +. . . . . . . . . . . Roles: Identifier,Expression,Expression,Binary,Left,Expression,Binary,Left . . . . . . . . . . . TOKEN "n" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 29 @@ -85,13 +85,13 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: Compare.ops { -. . . . . . . . . . . Roles: BinaryExpressionOp,BinaryExpressionOp +. . . . . . . . . . . Roles: Expression,Binary,Operator,Expression,Binary,Operator . . . . . . . . . . . Properties: { . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Gt { -. . . . . . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . . . . . TOKEN ">" . . . . . . . . . . . . } . . . . . . . . . . . } @@ -99,7 +99,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForUpdate,Statement +. . . . . . . . . Roles: Identifier,Expression,For,Update,Statement . . . . . . . . . TOKEN "somelist" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 17 @@ -117,7 +117,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForExpression +. . . . . . . . . Roles: Identifier,Expression,For,Expression . . . . . . . . . TOKEN "n" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 12 @@ -137,7 +137,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "n" . . . . . . . StartPosition: { . . . . . . . . Offset: 1 @@ -155,7 +155,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BinOp { -. . . . . . . Roles: BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 4 . . . . . . . . Line: 1 @@ -166,7 +166,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . TOKEN "n" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 4 @@ -184,7 +184,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 6 @@ -201,7 +201,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Mult { -. . . . . . . . . Roles: BinaryExpressionOp,OpMultiply +. . . . . . . . . Roles: Expression,Binary,Operator,Multiply . . . . . . . . . TOKEN "*" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op diff --git a/tests/comprehension_list.py.uast b/tests/comprehension_list.py.uast index afcb9794..6d4f897d 100644 --- a/tests/comprehension_list.py.uast +++ b/tests/comprehension_list.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: ListComp { -. . . . . Roles: ListLiteral,Expression,Incomplete +. . . . . Roles: Literal,List,For,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 1 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: BinOp { -. . . . . . . Roles: BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 1 . . . . . . . . Line: 1 @@ -38,7 +38,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . TOKEN "i" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 1 @@ -56,7 +56,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 3 @@ -73,7 +73,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Mult { -. . . . . . . . . Roles: BinaryExpressionOp,OpMultiply +. . . . . . . . . Roles: Expression,Binary,Operator,Multiply . . . . . . . . . TOKEN "*" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -82,14 +82,14 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: comprehension { -. . . . . . . Roles: ForEach,Expression +. . . . . . . Roles: For,Iterator,Expression . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Compare { -. . . . . . . . . Roles: BinaryExpression,Expression,IfCondition,BinaryExpression +. . . . . . . . . Roles: Expression,Binary,If,Condition,Expression,Binary . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 26 . . . . . . . . . . Line: 1 @@ -100,13 +100,13 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Compare.comparators { -. . . . . . . . . . . Roles: BinaryExpressionRight +. . . . . . . . . . . Roles: Expression,Binary,Right . . . . . . . . . . . Properties: { . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . . . . . TOKEN "2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 28 @@ -122,7 +122,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression,BinaryExpressionLeft,BinaryExpressionLeft +. . . . . . . . . . . Roles: Identifier,Expression,Expression,Binary,Left,Expression,Binary,Left . . . . . . . . . . . TOKEN "i" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 26 @@ -140,13 +140,13 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: Compare.ops { -. . . . . . . . . . . Roles: BinaryExpressionOp,BinaryExpressionOp +. . . . . . . . . . . Roles: Expression,Binary,Operator,Expression,Binary,Operator . . . . . . . . . . . Properties: { . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Gt { -. . . . . . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . . . . . TOKEN ">" . . . . . . . . . . . . } . . . . . . . . . . . } @@ -154,7 +154,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForUpdate,Statement +. . . . . . . . . Roles: Identifier,Expression,For,Update,Statement . . . . . . . . . TOKEN "somelist" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 14 @@ -172,7 +172,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForExpression +. . . . . . . . . Roles: Identifier,Expression,For,Expression . . . . . . . . . TOKEN "i" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 9 @@ -207,7 +207,7 @@ Module { . . . } . . . Children: { . . . . 0: ListComp { -. . . . . Roles: ListLiteral,Expression,Incomplete +. . . . . Roles: Literal,List,For,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 32 . . . . . . Line: 2 @@ -218,7 +218,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: BinOp { -. . . . . . . Roles: BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 32 . . . . . . . . Line: 2 @@ -229,7 +229,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . TOKEN "i" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 32 @@ -247,7 +247,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 34 @@ -264,7 +264,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Mult { -. . . . . . . . . Roles: BinaryExpressionOp,OpMultiply +. . . . . . . . . Roles: Expression,Binary,Operator,Multiply . . . . . . . . . TOKEN "*" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -273,14 +273,14 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: comprehension { -. . . . . . . Roles: ForEach,Expression +. . . . . . . Roles: For,Iterator,Expression . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForUpdate,Statement +. . . . . . . . . Roles: Identifier,Expression,For,Update,Statement . . . . . . . . . TOKEN "somelist" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 51 @@ -298,7 +298,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForExpression +. . . . . . . . . Roles: Identifier,Expression,For,Expression . . . . . . . . . TOKEN "sublist" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 40 @@ -318,14 +318,14 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: comprehension { -. . . . . . . Roles: ForEach,Expression +. . . . . . . Roles: For,Iterator,Expression . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForUpdate,Statement +. . . . . . . . . Roles: Identifier,Expression,For,Update,Statement . . . . . . . . . TOKEN "sublist" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 69 @@ -343,7 +343,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForExpression +. . . . . . . . . Roles: Identifier,Expression,For,Expression . . . . . . . . . TOKEN "i" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 64 diff --git a/tests/comprehension_set.py.uast b/tests/comprehension_set.py.uast index e915bc3f..7430e123 100644 --- a/tests/comprehension_set.py.uast +++ b/tests/comprehension_set.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: SetComp { -. . . . . Roles: SetLiteral,Expression,Incomplete +. . . . . Roles: Literal,Set,For,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: BinOp { -. . . . . . . Roles: BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 1 . . . . . . . . Line: 1 @@ -38,7 +38,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . TOKEN "n" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 1 @@ -56,7 +56,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 3 @@ -73,7 +73,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Mult { -. . . . . . . . . Roles: BinaryExpressionOp,OpMultiply +. . . . . . . . . Roles: Expression,Binary,Operator,Multiply . . . . . . . . . TOKEN "*" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -82,14 +82,14 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: comprehension { -. . . . . . . Roles: ForEach,Expression +. . . . . . . Roles: For,Iterator,Expression . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Compare { -. . . . . . . . . Roles: BinaryExpression,Expression,IfCondition,BinaryExpression +. . . . . . . . . Roles: Expression,Binary,If,Condition,Expression,Binary . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 26 . . . . . . . . . . Line: 1 @@ -100,13 +100,13 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Compare.comparators { -. . . . . . . . . . . Roles: BinaryExpressionRight +. . . . . . . . . . . Roles: Expression,Binary,Right . . . . . . . . . . . Properties: { . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . . . . . TOKEN "2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 28 @@ -122,7 +122,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression,BinaryExpressionLeft,BinaryExpressionLeft +. . . . . . . . . . . Roles: Identifier,Expression,Expression,Binary,Left,Expression,Binary,Left . . . . . . . . . . . TOKEN "n" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 26 @@ -140,13 +140,13 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: Compare.ops { -. . . . . . . . . . . Roles: BinaryExpressionOp,BinaryExpressionOp +. . . . . . . . . . . Roles: Expression,Binary,Operator,Expression,Binary,Operator . . . . . . . . . . . Properties: { . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Gt { -. . . . . . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . . . . . TOKEN ">" . . . . . . . . . . . . } . . . . . . . . . . . } @@ -154,7 +154,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForUpdate,Statement +. . . . . . . . . Roles: Identifier,Expression,For,Update,Statement . . . . . . . . . TOKEN "somelist" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 14 @@ -172,7 +172,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression,ForExpression +. . . . . . . . . Roles: Identifier,Expression,For,Expression . . . . . . . . . TOKEN "n" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 9 diff --git a/tests/continue_break.py.native b/tests/continue_break.py.native new file mode 100644 index 00000000..28185a23 --- /dev/null +++ b/tests/continue_break.py.native @@ -0,0 +1,169 @@ +{ + "status": "ok", + "errors": [], + "ast": { + "PY3AST": { + "ast_type": "Module", + "body": [ + { + "ast_type": "For", + "body": [ + { + "ast_type": "If", + "body": [ + { + "ast_type": "Continue", + "col_offset": 9, + "end_col_offset": 16, + "end_lineno": 3, + "lineno": 3 + } + ], + "col_offset": 5, + "end_col_offset": 6, + "end_lineno": 2, + "lineno": 2, + "orelse": [], + "test": { + "ast_type": "Compare", + "col_offset": 8, + "comparators": [ + { + "ast_type": "Num", + "col_offset": 13, + "end_col_offset": 13, + "end_lineno": 2, + "lineno": 2, + "n": 2 + } + ], + "left": { + "ast_type": "Name", + "col_offset": 8, + "ctx": "Load", + "end_col_offset": 8, + "end_lineno": 2, + "id": "i", + "lineno": 2 + }, + "lineno": 2, + "ops": [ + { + "ast_type": "Eq" + } + ] + } + }, + { + "ast_type": "If", + "body": [ + { + "ast_type": "Break", + "col_offset": 9, + "end_col_offset": 13, + "end_lineno": 5, + "lineno": 5 + } + ], + "col_offset": 5, + "end_col_offset": 6, + "end_lineno": 4, + "lineno": 4, + "orelse": [], + "test": { + "ast_type": "Compare", + "col_offset": 8, + "comparators": [ + { + "ast_type": "Num", + "col_offset": 13, + "end_col_offset": 13, + "end_lineno": 4, + "lineno": 4, + "n": 3 + } + ], + "left": { + "ast_type": "Name", + "col_offset": 8, + "ctx": "Load", + "end_col_offset": 8, + "end_lineno": 4, + "id": "i", + "lineno": 4 + }, + "lineno": 4, + "ops": [ + { + "ast_type": "Eq" + } + ] + } + } + ], + "col_offset": 1, + "end_col_offset": 3, + "end_lineno": 1, + "iter": { + "ast_type": "List", + "col_offset": 10, + "ctx": "Load", + "elts": [ + { + "ast_type": "Num", + "col_offset": 11, + "end_col_offset": 11, + "end_lineno": 1, + "lineno": 1, + "n": 1 + }, + { + "ast_type": "Num", + "col_offset": 13, + "end_col_offset": 13, + "end_lineno": 1, + "lineno": 1, + "n": 2 + }, + { + "ast_type": "Num", + "col_offset": 15, + "end_col_offset": 15, + "end_lineno": 1, + "lineno": 1, + "n": 3 + } + ], + "lineno": 1 + }, + "lineno": 1, + "orelse": [], + "target": { + "ast_type": "Name", + "col_offset": 5, + "ctx": "Store", + "end_col_offset": 5, + "end_lineno": 1, + "id": "i", + "lineno": 1 + } + } + ], + "noops_remainder": { + "ast_type": "RemainderNoops", + "col_offset": 1, + "end_col_offset": 1, + "end_lineno": 6, + "lineno": 6, + "lines": [ + { + "ast_type": "NoopLine", + "col_offset": 1, + "lineno": 6, + "noop_line": "\n" + } + ] + } + } + } +} diff --git a/tests/continue_break.py.source b/tests/continue_break.py.source new file mode 100644 index 00000000..34750ce3 --- /dev/null +++ b/tests/continue_break.py.source @@ -0,0 +1,6 @@ +for i in [1,2,3]: + if i == 2: + continue + if i == 3: + break + diff --git a/tests/continue_break.py.uast b/tests/continue_break.py.uast new file mode 100644 index 00000000..0d2cbe32 --- /dev/null +++ b/tests/continue_break.py.uast @@ -0,0 +1,356 @@ +Status: ok +Errors: +UAST: +Module { +. Roles: File +. Children: { +. . 0: For { +. . . Roles: For,Iterator,Statement +. . . TOKEN "for" +. . . StartPosition: { +. . . . Offset: 0 +. . . . Line: 1 +. . . . Col: 1 +. . . } +. . . EndPosition: { +. . . . Offset: 2 +. . . . Line: 1 +. . . . Col: 3 +. . . } +. . . Properties: { +. . . . internalRole: body +. . . } +. . . Children: { +. . . . 0: For.body { +. . . . . Roles: For,Body +. . . . . Properties: { +. . . . . . promotedPropertyList: true +. . . . . } +. . . . . Children: { +. . . . . . 0: If { +. . . . . . . Roles: If,Statement +. . . . . . . TOKEN "if" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 22 +. . . . . . . . Line: 2 +. . . . . . . . Col: 5 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 23 +. . . . . . . . Line: 2 +. . . . . . . . Col: 6 +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: If.body { +. . . . . . . . . Roles: If,Body,Then +. . . . . . . . . Properties: { +. . . . . . . . . . promotedPropertyList: true +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: Continue { +. . . . . . . . . . . Roles: Continue,Statement +. . . . . . . . . . . TOKEN "continue" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 41 +. . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . Col: 9 +. . . . . . . . . . . } +. . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . Offset: 48 +. . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . Col: 16 +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . . 1: Compare { +. . . . . . . . . Roles: Expression,Binary,If,Condition +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 25 +. . . . . . . . . . Line: 2 +. . . . . . . . . . Col: 8 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . internalRole: test +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: Compare.comparators { +. . . . . . . . . . . Roles: Expression,Binary,Right +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . promotedPropertyList: true +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: Num { +. . . . . . . . . . . . . Roles: Literal,Number,Expression +. . . . . . . . . . . . . TOKEN "2" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 30 +. . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . Col: 13 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . Offset: 30 +. . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . Col: 13 +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 1: Name { +. . . . . . . . . . . Roles: Identifier,Expression,Expression,Binary,Left +. . . . . . . . . . . TOKEN "i" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 25 +. . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . Col: 8 +. . . . . . . . . . . } +. . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . Offset: 25 +. . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . Col: 8 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . internalRole: left +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 2: Compare.ops { +. . . . . . . . . . . Roles: Expression,Binary,Operator +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . promotedPropertyList: true +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: Eq { +. . . . . . . . . . . . . Roles: Operator,Equal +. . . . . . . . . . . . . TOKEN "==" +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . . 1: If { +. . . . . . . Roles: If,Statement +. . . . . . . TOKEN "if" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 54 +. . . . . . . . Line: 4 +. . . . . . . . Col: 5 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 55 +. . . . . . . . Line: 4 +. . . . . . . . Col: 6 +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: If.body { +. . . . . . . . . Roles: If,Body,Then +. . . . . . . . . Properties: { +. . . . . . . . . . promotedPropertyList: true +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: Break { +. . . . . . . . . . . Roles: Break,Statement +. . . . . . . . . . . TOKEN "break" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 73 +. . . . . . . . . . . . Line: 5 +. . . . . . . . . . . . Col: 9 +. . . . . . . . . . . } +. . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . Offset: 77 +. . . . . . . . . . . . Line: 5 +. . . . . . . . . . . . Col: 13 +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . . 1: Compare { +. . . . . . . . . Roles: Expression,Binary,If,Condition +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 57 +. . . . . . . . . . Line: 4 +. . . . . . . . . . Col: 8 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . internalRole: test +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: Compare.comparators { +. . . . . . . . . . . Roles: Expression,Binary,Right +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . promotedPropertyList: true +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: Num { +. . . . . . . . . . . . . Roles: Literal,Number,Expression +. . . . . . . . . . . . . TOKEN "3" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 62 +. . . . . . . . . . . . . . Line: 4 +. . . . . . . . . . . . . . Col: 13 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . Offset: 62 +. . . . . . . . . . . . . . Line: 4 +. . . . . . . . . . . . . . Col: 13 +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 1: Name { +. . . . . . . . . . . Roles: Identifier,Expression,Expression,Binary,Left +. . . . . . . . . . . TOKEN "i" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 57 +. . . . . . . . . . . . Line: 4 +. . . . . . . . . . . . Col: 8 +. . . . . . . . . . . } +. . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . Offset: 57 +. . . . . . . . . . . . Line: 4 +. . . . . . . . . . . . Col: 8 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . internalRole: left +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 2: Compare.ops { +. . . . . . . . . . . Roles: Expression,Binary,Operator +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . promotedPropertyList: true +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: Eq { +. . . . . . . . . . . . . Roles: Operator,Equal +. . . . . . . . . . . . . TOKEN "==" +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . . 1: List { +. . . . . Roles: Literal,List,Expression,For,Expression +. . . . . StartPosition: { +. . . . . . Offset: 9 +. . . . . . Line: 1 +. . . . . . Col: 10 +. . . . . } +. . . . . Properties: { +. . . . . . ctx: Load +. . . . . . internalRole: iter +. . . . . } +. . . . . Children: { +. . . . . . 0: Num { +. . . . . . . Roles: Literal,Number,Expression +. . . . . . . TOKEN "1" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 10 +. . . . . . . . Line: 1 +. . . . . . . . Col: 11 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 10 +. . . . . . . . Line: 1 +. . . . . . . . Col: 11 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: elts +. . . . . . . } +. . . . . . } +. . . . . . 1: Num { +. . . . . . . Roles: Literal,Number,Expression +. . . . . . . TOKEN "2" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 12 +. . . . . . . . Line: 1 +. . . . . . . . Col: 13 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 12 +. . . . . . . . Line: 1 +. . . . . . . . Col: 13 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: elts +. . . . . . . } +. . . . . . } +. . . . . . 2: Num { +. . . . . . . Roles: Literal,Number,Expression +. . . . . . . TOKEN "3" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 14 +. . . . . . . . Line: 1 +. . . . . . . . Col: 15 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 14 +. . . . . . . . Line: 1 +. . . . . . . . Col: 15 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: elts +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . . 2: Name { +. . . . . Roles: Identifier,Expression,For,Update +. . . . . TOKEN "i" +. . . . . StartPosition: { +. . . . . . Offset: 4 +. . . . . . Line: 1 +. . . . . . Col: 5 +. . . . . } +. . . . . EndPosition: { +. . . . . . Offset: 4 +. . . . . . Line: 1 +. . . . . . Col: 5 +. . . . . } +. . . . . Properties: { +. . . . . . ctx: Store +. . . . . . internalRole: target +. . . . . } +. . . . } +. . . } +. . } +. . 1: RemainderNoops { +. . . Roles: Whitespace +. . . StartPosition: { +. . . . Offset: 79 +. . . . Line: 6 +. . . . Col: 1 +. . . } +. . . EndPosition: { +. . . . Offset: 79 +. . . . Line: 6 +. . . . Col: 1 +. . . } +. . . Properties: { +. . . . internalRole: noops_remainder +. . . } +. . . Children: { +. . . . 0: NoopLine { +. . . . . Roles: Comment +. . . . . TOKEN " +" +. . . . . StartPosition: { +. . . . . . Offset: 79 +. . . . . . Line: 6 +. . . . . . Col: 1 +. . . . . } +. . . . . Properties: { +. . . . . . internalRole: lines +. . . . . } +. . . . } +. . . } +. . } +. } +} + diff --git a/tests/declarations_annotated.py.uast b/tests/declarations_annotated.py.uast index 8dbedb5a..389d1298 100644 --- a/tests/declarations_annotated.py.uast +++ b/tests/declarations_annotated.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: AnnAssign { -. . . Roles: Assignment,Comment,Incomplete +. . . Roles: Operator,Binary,Assignment,Comment,Incomplete . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -17,7 +17,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . TOKEN "int" . . . . . StartPosition: { . . . . . . Offset: 3 @@ -35,7 +35,7 @@ Module { . . . . . } . . . . } . . . . 1: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 0 @@ -53,7 +53,7 @@ Module { . . . . . } . . . . } . . . . 2: Num { -. . . . . Roles: NumberLiteral,Expression +. . . . . Roles: Literal,Number,Expression . . . . . TOKEN "3" . . . . . StartPosition: { . . . . . . Offset: 9 @@ -72,7 +72,7 @@ Module { . . . } . . } . . 1: AnnAssign { -. . . Roles: Assignment,Comment,Incomplete +. . . Roles: Operator,Binary,Assignment,Comment,Incomplete . . . StartPosition: { . . . . Offset: 11 . . . . Line: 2 @@ -84,7 +84,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . TOKEN "str" . . . . . StartPosition: { . . . . . . Offset: 14 @@ -102,7 +102,7 @@ Module { . . . . . } . . . . } . . . . 1: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression . . . . . TOKEN "b" . . . . . StartPosition: { . . . . . . Offset: 11 @@ -120,7 +120,7 @@ Module { . . . . . } . . . . } . . . . 2: Str { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . TOKEN "foo" . . . . . StartPosition: { . . . . . . Offset: 20 diff --git a/tests/ellipsis.py.uast b/tests/ellipsis.py.uast index 20bab805..eb940d24 100644 --- a/tests/ellipsis.py.uast +++ b/tests/ellipsis.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: List { -. . . . . Roles: ListLiteral,Expression +. . . . . Roles: Literal,List,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -28,7 +28,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Ellipsis { -. . . . . . . Roles: SimpleIdentifier,Incomplete +. . . . . . . Roles: Identifier,Incomplete . . . . . . . TOKEN "..." . . . . . . . StartPosition: { . . . . . . . . Offset: 1 @@ -45,7 +45,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "0" . . . . . . . StartPosition: { . . . . . . . . Offset: 6 diff --git a/tests/except.py.uast b/tests/except.py.uast index 1e8c9344..9245a640 100644 --- a/tests/except.py.uast +++ b/tests/except.py.uast @@ -21,13 +21,13 @@ Module { . . . } . . . Children: { . . . . 0: Try.body { -. . . . . Roles: TryBody +. . . . . Roles: Try,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 9 . . . . . . . . Line: 2 @@ -35,7 +35,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 9 @@ -53,7 +53,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 13 @@ -89,7 +89,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 25 . . . . . . . . . . Line: 3 @@ -100,7 +100,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "gogogo" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 35 @@ -117,7 +117,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "Exception" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 25 @@ -141,7 +141,7 @@ Module { . . . . . } . . . . } . . . . 1: Try.finalbody { -. . . . . Roles: TryFinally +. . . . . Roles: Try,Finally . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -155,7 +155,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 147 . . . . . . . . . . Line: 9 @@ -166,7 +166,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "here we are" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 153 @@ -183,7 +183,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 147 @@ -207,7 +207,7 @@ Module { . . . . . } . . . . } . . . . 2: ExceptHandler { -. . . . . Roles: TryCatch,Statement +. . . . . Roles: Try,Catch,Statement . . . . . StartPosition: { . . . . . . Offset: 69 . . . . . . Line: 4 @@ -235,7 +235,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 76 . . . . . . . . . . Line: 5 @@ -246,7 +246,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "someexception catched" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 82 @@ -263,7 +263,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 76 @@ -285,7 +285,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "SomeException" . . . . . . . StartPosition: { . . . . . . . . Offset: 52 @@ -303,7 +303,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: ExceptHandler.name { -. . . . . . . Roles: SimpleIdentifier +. . . . . . . Roles: Identifier . . . . . . . TOKEN "e" . . . . . . . Properties: { . . . . . . . . promotedPropertyString: true @@ -312,7 +312,7 @@ Module { . . . . . } . . . . } . . . . 3: ExceptHandler { -. . . . . Roles: TryCatch,Statement +. . . . . Roles: Try,Catch,Statement . . . . . TOKEN "" . . . . . StartPosition: { . . . . . . Offset: 107 @@ -336,7 +336,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 119 . . . . . . . . . . Line: 7 @@ -347,7 +347,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "ayyyy" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 125 @@ -364,7 +364,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 119 diff --git a/tests/exec.py.uast b/tests/exec.py.uast index f1809688..c0b4b847 100644 --- a/tests/exec.py.uast +++ b/tests/exec.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "print 1" . . . . . . . StartPosition: { . . . . . . . . Offset: 5 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "exec" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 diff --git a/tests/for.py.uast b/tests/for.py.uast index 25a22bf7..695e906b 100644 --- a/tests/for.py.uast +++ b/tests/for.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: For { -. . . Roles: ForEach,Statement +. . . Roles: For,Iterator,Statement . . . TOKEN "for" . . . StartPosition: { . . . . Offset: 0 @@ -22,13 +22,13 @@ Module { . . . } . . . Children: { . . . . 0: For.body { -. . . . . Roles: ForBody +. . . . . Roles: For,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: AugAssign { -. . . . . . . Roles: AugmentedAssignment,Statement +. . . . . . . Roles: Operator,Binary,Assignment,Statement . . . . . . . TOKEN "?=" . . . . . . . StartPosition: { . . . . . . . . Offset: 24 @@ -42,7 +42,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AugmentedAssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 22 @@ -60,7 +60,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,AugmentedAssignmentValue +. . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 27 @@ -77,7 +77,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: OpAdd,AugmentedAssignmentOperator +. . . . . . . . . Roles: Add,Operator,Binary . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -94,7 +94,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 33 . . . . . . . . . . Line: 3 @@ -105,7 +105,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . TOKEN "i" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 39 @@ -123,7 +123,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 33 @@ -147,7 +147,7 @@ Module { . . . . . } . . . . } . . . . 1: List { -. . . . . Roles: ListLiteral,Expression,ForExpression +. . . . . Roles: Literal,List,Expression,For,Expression . . . . . StartPosition: { . . . . . . Offset: 9 . . . . . . Line: 1 @@ -159,7 +159,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 10 @@ -176,7 +176,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 12 @@ -193,7 +193,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 14 @@ -212,7 +212,7 @@ Module { . . . . . } . . . . } . . . . 2: Name { -. . . . . Roles: SimpleIdentifier,Expression,ForUpdate +. . . . . Roles: Identifier,Expression,For,Update . . . . . TOKEN "i" . . . . . StartPosition: { . . . . . . Offset: 4 diff --git a/tests/functioncalls.py.uast b/tests/functioncalls.py.uast index 4e7a2f14..590f4a1d 100644 --- a/tests/functioncalls.py.uast +++ b/tests/functioncalls.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "something1" . . . . . . . StartPosition: { . . . . . . . . Offset: 11 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "42" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 @@ -61,7 +61,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Name { -. . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "somesymbbol" . . . . . . . StartPosition: { . . . . . . . . Offset: 29 @@ -79,7 +79,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "normalCall" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 @@ -112,7 +112,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 42 . . . . . . Line: 2 @@ -123,7 +123,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "something" . . . . . . . StartPosition: { . . . . . . . . Offset: 58 @@ -140,7 +140,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "42" . . . . . . . StartPosition: { . . . . . . . . Offset: 71 @@ -157,7 +157,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Name { -. . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "somesymbol" . . . . . . . StartPosition: { . . . . . . . . Offset: 75 @@ -175,7 +175,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: Attribute { -. . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . TOKEN "qualifiedCall" . . . . . . . StartPosition: { . . . . . . . . Offset: 44 @@ -193,7 +193,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: QualifiedIdentifier,CallReceiver,SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Qualified,Call,Receiver,Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 42 @@ -228,7 +228,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 87 . . . . . . Line: 3 @@ -239,7 +239,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 95 @@ -257,7 +257,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "keyCall" . . . . . . . StartPosition: { . . . . . . . . Offset: 87 @@ -275,14 +275,14 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: keyword { -. . . . . . . Roles: CallNamedArgument +. . . . . . . Roles: Call,Argument,Name . . . . . . . TOKEN "b" . . . . . . . Properties: { . . . . . . . . internalRole: keywords . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,CallNamedArgumentValue +. . . . . . . . . Roles: Literal,Number,Expression,Call,Argument,Value . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 100 @@ -301,14 +301,14 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: keyword { -. . . . . . . Roles: CallNamedArgument +. . . . . . . Roles: Call,Argument,Name . . . . . . . TOKEN "c" . . . . . . . Properties: { . . . . . . . . internalRole: keywords . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,CallNamedArgumentValue +. . . . . . . . . Roles: Literal,Number,Expression,Call,Argument,Value . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 105 @@ -342,7 +342,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 108 . . . . . . Line: 4 @@ -353,7 +353,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 123 @@ -371,7 +371,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Starred { -. . . . . . . Roles: CallPositionalArgument +. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional . . . . . . . StartPosition: { . . . . . . . . Offset: 126 . . . . . . . . Line: 4 @@ -383,7 +383,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "expandedList" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 127 @@ -403,7 +403,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "expandListCall" . . . . . . . StartPosition: { . . . . . . . . Offset: 108 @@ -436,7 +436,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 141 . . . . . . Line: 5 @@ -447,7 +447,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 155 @@ -465,7 +465,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "expandMapCall" . . . . . . . StartPosition: { . . . . . . . . Offset: 141 @@ -483,14 +483,14 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: keyword { -. . . . . . . Roles: CallNamedArgument +. . . . . . . Roles: Call,Argument,Name . . . . . . . TOKEN "" . . . . . . . Properties: { . . . . . . . . internalRole: keywords . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: CallNamedArgumentValue,SimpleIdentifier,Expression +. . . . . . . . . Roles: Call,Argument,Value,Identifier,Expression . . . . . . . . . TOKEN "expandedMap" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 160 diff --git a/tests/functiondef_annotated.py.uast b/tests/functiondef_annotated.py.uast index 424bf75d..43ec81b7 100644 --- a/tests/functiondef_annotated.py.uast +++ b/tests/functiondef_annotated.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someFunc" . . . StartPosition: { . . . . Offset: 4 @@ -22,7 +22,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -30,7 +30,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -47,7 +47,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . . . . . TOKEN "int" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 19 @@ -67,7 +67,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 24 @@ -84,7 +84,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . . . . . TOKEN "str" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 30 @@ -104,7 +104,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg3" . . . . . . . StartPosition: { . . . . . . . . Offset: 35 @@ -121,7 +121,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . . . . . TOKEN "MyType" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 41 @@ -143,7 +143,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -165,7 +165,7 @@ Module { . . . . . } . . . . } . . . . 2: Name { -. . . . . Roles: SimpleIdentifier,Expression,Comment,Incomplete +. . . . . Roles: Identifier,Expression,Comment,Incomplete . . . . . TOKEN "Tuple" . . . . . StartPosition: { . . . . . . Offset: 52 diff --git a/tests/functiondef_decorated.py.uast b/tests/functiondef_decorated.py.uast index 04743b8b..0f972d6c 100644 --- a/tests/functiondef_decorated.py.uast +++ b/tests/functiondef_decorated.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someFunc" . . . StartPosition: { . . . . Offset: 0 @@ -18,7 +18,7 @@ Module { . . . } . . . Children: { . . . . 0: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -43,13 +43,13 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.decorator_list { -. . . . . Roles: Call,Incomplete +. . . . . Roles: Function,Call,Incomplete . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "somedecorator" . . . . . . . StartPosition: { . . . . . . . . Offset: 1 @@ -68,7 +68,7 @@ Module { . . . . . } . . . . } . . . . 2: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -78,7 +78,7 @@ Module { . . . } . . } . . 1: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someFunc" . . . StartPosition: { . . . . Offset: 43 @@ -91,7 +91,7 @@ Module { . . . } . . . Children: { . . . . 0: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -149,13 +149,13 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.decorator_list { -. . . . . Roles: Call,Incomplete +. . . . . Roles: Function,Call,Incomplete . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Call { -. . . . . . . Roles: Call,Expression +. . . . . . . Roles: Function,Call,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 44 . . . . . . . . Line: 5 @@ -163,7 +163,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 64 @@ -180,7 +180,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 67 @@ -197,7 +197,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . TOKEN "3" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 70 @@ -214,7 +214,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 3: Name { -. . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . TOKEN "somedecoratorparams" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 44 @@ -236,7 +236,7 @@ Module { . . . . . } . . . . } . . . . 2: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: diff --git a/tests/functiondef_defaultparams.py.native b/tests/functiondef_defaultparams.py.native index baee4add..ef2ca67f 100644 --- a/tests/functiondef_defaultparams.py.native +++ b/tests/functiondef_defaultparams.py.native @@ -104,6 +104,61 @@ "lineno": 1, "name": "someFunc", "returns": null + }, + { + "args": { + "args": [], + "ast_type": "arguments", + "defaults": [], + "kw_defaults": [ + { + "ast_type": "Num", + "col_offset": 22, + "end_col_offset": 22, + "end_lineno": 3, + "lineno": 3, + "n": 3 + } + ], + "kwarg": null, + "kwonlyargs": [ + { + "annotation": null, + "arg": "thing", + "ast_type": "arg", + "col_offset": 16, + "end_col_offset": 20, + "end_lineno": 3, + "lineno": 3 + } + ], + "vararg": { + "annotation": null, + "arg": "ignore", + "ast_type": "arg", + "col_offset": 8, + "end_col_offset": 13, + "end_lineno": 3, + "lineno": 3 + } + }, + "ast_type": "FunctionDef", + "body": [ + { + "ast_type": "Pass", + "col_offset": 26, + "end_col_offset": 29, + "end_lineno": 3, + "lineno": 3 + } + ], + "col_offset": 5, + "decorator_list": [], + "end_col_offset": 5, + "end_lineno": 3, + "lineno": 3, + "name": "x", + "returns": null } ] } diff --git a/tests/functiondef_defaultparams.py.source b/tests/functiondef_defaultparams.py.source index 97a96170..f4fb3979 100644 --- a/tests/functiondef_defaultparams.py.source +++ b/tests/functiondef_defaultparams.py.source @@ -1,2 +1,3 @@ def someFunc(arg1, arg2, arg3=1, arg4="polompos", arg5=None): pass +def x(*ignore, thing=3): pass diff --git a/tests/functiondef_defaultparams.py.uast b/tests/functiondef_defaultparams.py.uast index 7d8fd6a3..6a450b47 100644 --- a/tests/functiondef_defaultparams.py.uast +++ b/tests/functiondef_defaultparams.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someFunc" . . . StartPosition: { . . . . Offset: 4 @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -31,7 +31,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -49,7 +49,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -67,7 +67,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg3" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 @@ -85,7 +85,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg4" . . . . . . . StartPosition: { . . . . . . . . Offset: 33 @@ -103,7 +103,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 4: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg5" . . . . . . . StartPosition: { . . . . . . . . Offset: 50 @@ -121,13 +121,13 @@ Module { . . . . . . . } . . . . . . } . . . . . . 5: arguments.defaults { -. . . . . . . Roles: FunctionDeclarationArgumentDefaultValue,Incomplete +. . . . . . . Roles: Function,Declaration,Argument,Value,Incomplete . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 30 @@ -141,7 +141,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Str { -. . . . . . . . . Roles: StringLiteral,Expression +. . . . . . . . . Roles: Literal,String,Expression . . . . . . . . . TOKEN "polompos" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 38 @@ -155,7 +155,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: NoneLiteral { -. . . . . . . . . Roles: NullLiteral,Expression +. . . . . . . . . Roles: Literal,Null,Expression . . . . . . . . . TOKEN "" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 55 @@ -176,7 +176,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -199,6 +199,110 @@ Module { . . . . } . . . } . . } +. . 1: FunctionDef { +. . . Roles: Function,Declaration,Name,Identifier +. . . TOKEN "x" +. . . StartPosition: { +. . . . Offset: 75 +. . . . Line: 3 +. . . . Col: 5 +. . . } +. . . EndPosition: { +. . . . Offset: 75 +. . . . Line: 3 +. . . . Col: 5 +. . . } +. . . Properties: { +. . . . internalRole: body +. . . . returns: +. . . } +. . . Children: { +. . . . 0: arguments { +. . . . . Roles: Argument,Name,Identifier +. . . . . Properties: { +. . . . . . internalRole: args +. . . . . . kwarg: +. . . . . } +. . . . . Children: { +. . . . . . 0: Num { +. . . . . . . Roles: Literal,Number,Expression +. . . . . . . TOKEN "3" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 92 +. . . . . . . . Line: 3 +. . . . . . . . Col: 22 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 92 +. . . . . . . . Line: 3 +. . . . . . . . Col: 22 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: kw_defaults +. . . . . . . } +. . . . . . } +. . . . . . 1: arg { +. . . . . . . Roles: Argument,ArgsList,Map,Name,Identifier +. . . . . . . TOKEN "thing" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 86 +. . . . . . . . Line: 3 +. . . . . . . . Col: 16 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 90 +. . . . . . . . Line: 3 +. . . . . . . . Col: 20 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . annotation: +. . . . . . . . internalRole: kwonlyargs +. . . . . . . } +. . . . . . } +. . . . . . 2: arg { +. . . . . . . Roles: Argument,ArgsList,Name,Identifier +. . . . . . . TOKEN "ignore" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 78 +. . . . . . . . Line: 3 +. . . . . . . . Col: 8 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 83 +. . . . . . . . Line: 3 +. . . . . . . . Col: 13 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . annotation: +. . . . . . . . internalRole: vararg +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . . 1: FunctionDef.body { +. . . . . Roles: Function,Declaration,Body +. . . . . Properties: { +. . . . . . promotedPropertyList: true +. . . . . } +. . . . . Children: { +. . . . . . 0: Pass { +. . . . . . . Roles: Noop,Statement +. . . . . . . TOKEN "pass" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 96 +. . . . . . . . Line: 3 +. . . . . . . . Col: 26 +. . . . . . . } +. . . . . . . EndPosition: { +. . . . . . . . Offset: 99 +. . . . . . . . Line: 3 +. . . . . . . . Col: 29 +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . } +. . } . } } diff --git a/tests/functiondef_docstring.py.uast b/tests/functiondef_docstring.py.uast index 4ded3e8f..20b638aa 100644 --- a/tests/functiondef_docstring.py.uast +++ b/tests/functiondef_docstring.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someFunc" . . . StartPosition: { . . . . Offset: 4 @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -37,7 +37,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Str { -. . . . . . . . . Roles: StringLiteral,Expression +. . . . . . . . . Roles: Literal,String,Expression . . . . . . . . . TOKEN " And this is the docstring " @@ -91,7 +91,7 @@ Module { . . . . . } . . . . } . . . . 1: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: diff --git a/tests/functiondef_kwarg.py.uast b/tests/functiondef_kwarg.py.uast index 0dac7cc2..dc693f0c 100644 --- a/tests/functiondef_kwarg.py.uast +++ b/tests/functiondef_kwarg.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someFunc" . . . StartPosition: { . . . . Offset: 4 @@ -23,14 +23,14 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . vararg: . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -48,7 +48,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -66,7 +66,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationVarArgsList,FunctionDeclarationArgumentName,Incomplete,SimpleIdentifier +. . . . . . . Roles: Argument,ArgsList,Map,Name,Identifier . . . . . . . TOKEN "kwparameters" . . . . . . . StartPosition: { . . . . . . . . Offset: 27 @@ -86,7 +86,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -110,7 +110,7 @@ Module { . . . } . . } . . 1: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someVarMapFunc" . . . StartPosition: { . . . . Offset: 56 @@ -128,13 +128,13 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 71 @@ -185,7 +185,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 77 @@ -203,7 +203,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationVarArgsList,FunctionDeclarationArgumentName,Incomplete,SimpleIdentifier +. . . . . . . Roles: Argument,ArgsList,Map,Name,Identifier . . . . . . . TOKEN "kwparameters2" . . . . . . . StartPosition: { . . . . . . . . Offset: 95 @@ -221,7 +221,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationVarArgsList,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,ArgsList,Name,Identifier . . . . . . . TOKEN "varargs" . . . . . . . StartPosition: { . . . . . . . . Offset: 84 @@ -241,7 +241,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } diff --git a/tests/functiondef_simple.py.uast b/tests/functiondef_simple.py.uast index 8d510ca0..580fef73 100644 --- a/tests/functiondef_simple.py.uast +++ b/tests/functiondef_simple.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someFunc" . . . StartPosition: { . . . . Offset: 4 @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -31,7 +31,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -49,7 +49,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -67,7 +67,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg3" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 @@ -87,7 +87,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -121,7 +121,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "arg1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 52 @@ -145,7 +145,7 @@ Module { . . . } . . } . . 1: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someGen" . . . StartPosition: { . . . . Offset: 62 @@ -163,7 +163,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -171,7 +171,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "n1" . . . . . . . StartPosition: { . . . . . . . . Offset: 70 @@ -222,7 +222,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "n2" . . . . . . . StartPosition: { . . . . . . . . Offset: 74 @@ -240,7 +240,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "n3" . . . . . . . StartPosition: { . . . . . . . . Offset: 78 @@ -260,7 +260,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -274,7 +274,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Yield { -. . . . . . . . . Roles: Return,Statement,Incomplete,ListLiteral,Expression,Incomplete +. . . . . . . . . Roles: Return,Statement,Incomplete,Literal,List,Expression,Incomplete . . . . . . . . . TOKEN "yield" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 87 @@ -291,7 +291,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Tuple { -. . . . . . . . . . . Roles: TupleLiteral,Expression +. . . . . . . . . . . Roles: Literal,Tuple,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 93 . . . . . . . . . . . . Line: 6 @@ -303,7 +303,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . TOKEN "n1" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 93 @@ -321,7 +321,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . TOKEN "n2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 97 @@ -339,7 +339,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 2: Name { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . TOKEN "n3" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 101 @@ -367,7 +367,7 @@ Module { . . . } . . } . . 2: AsyncFunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier,Incomplete +. . . Roles: Function,Declaration,Name,Identifier,Incomplete . . . TOKEN "asyncfunc" . . . StartPosition: { . . . . Offset: 115 @@ -385,7 +385,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -393,7 +393,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 125 diff --git a/tests/functiondef_vararg.py.uast b/tests/functiondef_vararg.py.uast index 49d8b72e..70801b1f 100644 --- a/tests/functiondef_vararg.py.uast +++ b/tests/functiondef_vararg.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "someFunc" . . . StartPosition: { . . . . Offset: 4 @@ -23,14 +23,14 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -48,7 +48,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -66,7 +66,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationVarArgsList,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,ArgsList,Name,Identifier . . . . . . . TOKEN "otherargs" . . . . . . . StartPosition: { . . . . . . . . Offset: 26 @@ -86,7 +86,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } diff --git a/tests/hello.py.uast b/tests/hello.py.uast index 46d7cd12..f885f8ab 100644 --- a/tests/hello.py.uast +++ b/tests/hello.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "hello world" . . . . . . . StartPosition: { . . . . . . . . Offset: 6 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "print" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 diff --git a/tests/if.py.uast b/tests/if.py.uast index c5b98a23..04273b0b 100644 --- a/tests/if.py.uast +++ b/tests/if.py.uast @@ -22,7 +22,7 @@ Module { . . . } . . . Children: { . . . . 0: If.body { -. . . . . Roles: IfBody +. . . . . Roles: If,Body,Then . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -36,7 +36,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 13 . . . . . . . . . . Line: 2 @@ -47,7 +47,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: BoolLiteral { -. . . . . . . . . . . Roles: BooleanLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,Boolean,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "true" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 19 @@ -65,7 +65,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 13 @@ -89,7 +89,7 @@ Module { . . . . . } . . . . } . . . . 1: BoolLiteral { -. . . . . Roles: BooleanLiteral,Expression,IfCondition +. . . . . Roles: Literal,Boolean,Expression,If,Condition . . . . . TOKEN "true" . . . . . StartPosition: { . . . . . . Offset: 3 @@ -126,7 +126,7 @@ Module { . . . } . . . Children: { . . . . 0: If.body { -. . . . . Roles: IfBody +. . . . . Roles: If,Body,Then . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -140,7 +140,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 49 . . . . . . . . . . Line: 5 @@ -151,7 +151,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: BoolLiteral { -. . . . . . . . . . . Roles: BooleanLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,Boolean,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "true" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 55 @@ -169,7 +169,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 49 @@ -193,7 +193,7 @@ Module { . . . . . } . . . . } . . . . 1: Call { -. . . . . Roles: Call,Expression,IfCondition +. . . . . Roles: Function,Call,Expression,If,Condition . . . . . StartPosition: { . . . . . . Offset: 29 . . . . . . Line: 4 @@ -204,7 +204,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "functionCall" . . . . . . . StartPosition: { . . . . . . . . Offset: 29 @@ -276,13 +276,13 @@ Module { . . . } . . . Children: { . . . . 0: If.body { -. . . . . Roles: IfBody +. . . . . Roles: If,Body,Then . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 76 . . . . . . . . Line: 8 @@ -290,7 +290,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 76 @@ -308,7 +308,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . TOKEN "1.1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 80 @@ -327,7 +327,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 88 . . . . . . . . Line: 9 @@ -335,7 +335,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "x" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 88 @@ -353,7 +353,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . TOKEN "1.2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 92 @@ -374,7 +374,7 @@ Module { . . . . . } . . . . } . . . . 1: If.orelse { -. . . . . Roles: IfElse +. . . . . Roles: If,Body,Else . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -389,13 +389,13 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: If.body { -. . . . . . . . . Roles: IfBody +. . . . . . . . . Roles: If,Body,Then . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Assign { -. . . . . . . . . . . Roles: Assignment,Expression +. . . . . . . . . . . Roles: Binary,Assignment,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 113 . . . . . . . . . . . . Line: 11 @@ -403,7 +403,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . . . . . TOKEN "c" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 113 @@ -421,7 +421,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . . . . . TOKEN "2.1" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 117 @@ -440,7 +440,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Assign { -. . . . . . . . . . . Roles: Assignment,Expression +. . . . . . . . . . . Roles: Binary,Assignment,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 125 . . . . . . . . . . . . Line: 12 @@ -448,7 +448,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . . . . . TOKEN "j" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 125 @@ -466,7 +466,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . . . . . TOKEN "2.2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 129 @@ -487,13 +487,13 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: If.orelse { -. . . . . . . . . Roles: IfElse +. . . . . . . . . Roles: If,Body,Else . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Assign { -. . . . . . . . . . . Roles: Assignment,Expression +. . . . . . . . . . . Roles: Binary,Assignment,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 143 . . . . . . . . . . . . Line: 14 @@ -501,7 +501,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . . . . . TOKEN "b" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 143 @@ -519,7 +519,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . . . . . TOKEN "3.1" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 147 @@ -538,7 +538,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Assign { -. . . . . . . . . . . Roles: Assignment,Expression +. . . . . . . . . . . Roles: Binary,Assignment,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 155 . . . . . . . . . . . . Line: 15 @@ -546,7 +546,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . . . . . TOKEN "p" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 155 @@ -564,7 +564,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . . . . . TOKEN "3.2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 159 @@ -585,7 +585,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Compare { -. . . . . . . . . Roles: BinaryExpression,Expression,IfCondition +. . . . . . . . . Roles: Expression,Binary,If,Condition . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 101 . . . . . . . . . . Line: 10 @@ -596,13 +596,13 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Compare.comparators { -. . . . . . . . . . . Roles: BinaryExpressionRight +. . . . . . . . . . . Roles: Expression,Binary,Right . . . . . . . . . . . Properties: { . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . TOKEN "c" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 106 @@ -621,7 +621,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression,BinaryExpressionLeft +. . . . . . . . . . . Roles: Identifier,Expression,Expression,Binary,Left . . . . . . . . . . . TOKEN "b" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 101 @@ -639,13 +639,13 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: Compare.ops { -. . . . . . . . . . . Roles: BinaryExpressionOp +. . . . . . . . . . . Roles: Expression,Binary,Operator . . . . . . . . . . . Properties: { . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Eq { -. . . . . . . . . . . . . Roles: OpEqual +. . . . . . . . . . . . . Roles: Operator,Equal . . . . . . . . . . . . . TOKEN "==" . . . . . . . . . . . . } . . . . . . . . . . . } @@ -657,7 +657,7 @@ Module { . . . . . } . . . . } . . . . 2: Compare { -. . . . . Roles: BinaryExpression,Expression,IfCondition +. . . . . Roles: Expression,Binary,If,Condition . . . . . StartPosition: { . . . . . . Offset: 65 . . . . . . Line: 7 @@ -668,13 +668,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "b" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 69 @@ -693,7 +693,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: SimpleIdentifier,Expression,BinaryExpressionLeft +. . . . . . . Roles: Identifier,Expression,Expression,Binary,Left . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 65 @@ -744,13 +744,13 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Gt { -. . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } @@ -777,7 +777,7 @@ Module { . . . } . . . Children: { . . . . 0: If.body { -. . . . . Roles: IfBody +. . . . . Roles: If,Body,Then . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -799,7 +799,7 @@ Module { . . . . . } . . . . } . . . . 1: Compare { -. . . . . Roles: BinaryExpression,Expression,IfCondition +. . . . . Roles: Expression,Binary,If,Condition . . . . . StartPosition: { . . . . . . Offset: 167 . . . . . . Line: 17 @@ -810,13 +810,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "b" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 171 @@ -833,7 +833,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "c" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 175 @@ -850,7 +850,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "d" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 179 @@ -869,7 +869,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: SimpleIdentifier,Expression,BinaryExpressionLeft +. . . . . . . Roles: Identifier,Expression,Expression,Binary,Left . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 167 @@ -920,21 +920,21 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Gt { -. . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . . 1: Gt { -. . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . . 2: Gt { -. . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } diff --git a/tests/ifexpression.py.uast b/tests/ifexpression.py.uast index 41d98b32..049098b6 100644 --- a/tests/ifexpression.py.uast +++ b/tests/ifexpression.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 0 @@ -34,7 +34,7 @@ Module { . . . . . } . . . . } . . . . 1: IfExp { -. . . . . Roles: AssignmentValue,If,Expression +. . . . . Roles: Right,If,Expression . . . . . StartPosition: { . . . . . . Offset: 4 . . . . . . Line: 1 @@ -45,7 +45,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression,IfBody +. . . . . . . Roles: Literal,Number,Expression,If,Body,Then . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 4 @@ -62,7 +62,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,IfElse +. . . . . . . Roles: Literal,Number,Expression,If,Body,Else . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 20 @@ -79,7 +79,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare { -. . . . . . . Roles: BinaryExpression,Expression,IfCondition +. . . . . . . Roles: Expression,Binary,If,Condition . . . . . . . StartPosition: { . . . . . . . . Offset: 9 . . . . . . . . Line: 1 @@ -90,13 +90,13 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Compare.comparators { -. . . . . . . . . Roles: BinaryExpressionRight +. . . . . . . . . Roles: Expression,Binary,Right . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Num { -. . . . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . . . TOKEN "4" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 13 @@ -112,7 +112,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: NumberLiteral,Expression,BinaryExpressionLeft +. . . . . . . . . Roles: Literal,Number,Expression,Expression,Binary,Left . . . . . . . . . TOKEN "3" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 9 @@ -129,13 +129,13 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Compare.ops { -. . . . . . . . . Roles: BinaryExpressionOp +. . . . . . . . . Roles: Expression,Binary,Operator . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Gt { -. . . . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . . . TOKEN ">" . . . . . . . . . . } . . . . . . . . . } diff --git a/tests/import.py.uast b/tests/import.py.uast index 449ef421..6c00dffc 100644 --- a/tests/import.py.uast +++ b/tests/import.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: Import { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "sys" . . . . . Properties: { . . . . . . asname: @@ -26,7 +26,7 @@ Module { . . . } . . } . . 1: Import { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 11 . . . . Line: 2 @@ -37,7 +37,7 @@ Module { . . . } . . . Children: { . . . . 0: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "sys" . . . . . Properties: { . . . . . . asname: @@ -45,7 +45,7 @@ Module { . . . . . } . . . . } . . . . 1: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "os" . . . . . Properties: { . . . . . . asname: @@ -55,7 +55,7 @@ Module { . . . } . . } . . 2: ImportFrom { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 31 . . . . Line: 3 @@ -73,14 +73,14 @@ Module { . . . } . . . Children: { . . . . 0: ImportFrom.module { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "os" . . . . . Properties: { . . . . . . promotedPropertyString: true . . . . . } . . . . } . . . . 1: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "path" . . . . . Properties: { . . . . . . asname: @@ -90,7 +90,7 @@ Module { . . . } . . } . . 3: ImportFrom { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 46 . . . . Line: 4 @@ -103,14 +103,14 @@ Module { . . . } . . . Children: { . . . . 0: ImportFrom.module { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "os.path" . . . . . Properties: { . . . . . . promotedPropertyString: true . . . . . } . . . . } . . . . 1: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "join" . . . . . Properties: { . . . . . . asname: @@ -118,7 +118,7 @@ Module { . . . . . } . . . . } . . . . 2: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "exists" . . . . . Properties: { . . . . . . asname: diff --git a/tests/issue30.py.uast b/tests/issue30.py.uast index 46b090d6..a29780bf 100644 --- a/tests/issue30.py.uast +++ b/tests/issue30.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: Import { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "sys" . . . . . Properties: { . . . . . . asname: @@ -37,7 +37,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 11 . . . . . . Line: 2 @@ -48,7 +48,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "Hello world! " . . . . . . . StartPosition: { @@ -66,7 +66,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Attribute { -. . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . TOKEN "write" . . . . . . . StartPosition: { . . . . . . . . Offset: 22 @@ -84,7 +84,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Attribute { -. . . . . . . . . Roles: SimpleIdentifier,Expression,CallReceiver +. . . . . . . . . Roles: Identifier,Expression,Call,Receiver . . . . . . . . . TOKEN "stdout" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 15 @@ -102,7 +102,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . TOKEN "sys" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 11 diff --git a/tests/issue51.py.uast b/tests/issue51.py.uast index 384a7554..9135aff6 100644 --- a/tests/issue51.py.uast +++ b/tests/issue51.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Attribute { -. . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . TOKEN "figure" . . . . . . . StartPosition: { . . . . . . . . Offset: 4 @@ -45,7 +45,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: QualifiedIdentifier,CallReceiver,SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Qualified,Call,Receiver,Identifier,Expression . . . . . . . . . TOKEN "plt" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 diff --git a/tests/issue58.py.uast b/tests/issue58.py.uast index 1d977c75..e60f619d 100644 --- a/tests/issue58.py.uast +++ b/tests/issue58.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Tuple { -. . . . . Roles: TupleLiteral,Expression,AssignmentVariable +. . . . . Roles: Literal,Tuple,Expression,Left . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -28,7 +28,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 @@ -46,7 +46,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "b" . . . . . . . StartPosition: { . . . . . . . . Offset: 3 @@ -66,7 +66,7 @@ Module { . . . . . } . . . . } . . . . 1: Tuple { -. . . . . Roles: TupleLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Tuple,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 7 . . . . . . Line: 1 @@ -78,7 +78,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "0" . . . . . . . StartPosition: { . . . . . . . . Offset: 7 @@ -95,7 +95,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: NoneLiteral { -. . . . . . . Roles: NullLiteral,Expression +. . . . . . . Roles: Literal,Null,Expression . . . . . . . TOKEN "" . . . . . . . StartPosition: { . . . . . . . . Offset: 10 diff --git a/tests/issue62.py.uast b/tests/issue62.py.uast index c18d1e83..b9f88435 100644 --- a/tests/issue62.py.uast +++ b/tests/issue62.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: ImportFrom { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 5 . . . . Line: 1 @@ -23,14 +23,14 @@ Module { . . . } . . . Children: { . . . . 0: ImportFrom.module { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "os" . . . . . Properties: { . . . . . . promotedPropertyString: true . . . . . } . . . . } . . . . 1: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "path" . . . . . Properties: { . . . . . . asname: @@ -40,7 +40,7 @@ Module { . . . } . . } . . 1: Import { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 20 . . . . Line: 2 @@ -51,7 +51,7 @@ Module { . . . } . . . Children: { . . . . 0: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "sys" . . . . . Properties: { . . . . . . asname: @@ -61,7 +61,7 @@ Module { . . . } . . } . . 2: Import { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 32 . . . . Line: 4 @@ -103,7 +103,7 @@ Module { . . . . . } . . . . } . . . . 1: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "numpy" . . . . . Properties: { . . . . . . alias.asname: np @@ -111,7 +111,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: alias.asname { -. . . . . . . Roles: ImportAlias,SimpleIdentifier +. . . . . . . Roles: Import,Alias,Identifier . . . . . . . TOKEN "np" . . . . . . . Properties: { . . . . . . . . promotedPropertyString: true diff --git a/tests/issue62_b.py.uast b/tests/issue62_b.py.uast index 7f99ca55..99cc7f23 100644 --- a/tests/issue62_b.py.uast +++ b/tests/issue62_b.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: ImportFrom { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 5 . . . . Line: 1 @@ -23,14 +23,14 @@ Module { . . . } . . . Children: { . . . . 0: ImportFrom.module { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "collections" . . . . . Properties: { . . . . . . promotedPropertyString: true . . . . . } . . . . } . . . . 1: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "Counter" . . . . . Properties: { . . . . . . asname: @@ -40,7 +40,7 @@ Module { . . . } . . } . . 1: ImportFrom { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 33 . . . . Line: 3 @@ -84,14 +84,14 @@ Module { . . . . . } . . . . } . . . . 1: ImportFrom.module { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "ast2vec.bblfsh_roles" . . . . . Properties: { . . . . . . promotedPropertyString: true . . . . . } . . . . } . . . . 2: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "SIMPLE_IDENTIFIER" . . . . . Properties: { . . . . . . asname: @@ -101,7 +101,7 @@ Module { . . . } . . } . . 2: ImportFrom { -. . . Roles: ImportDeclaration,Statement +. . . Roles: Import,Declaration,Statement . . . StartPosition: { . . . . Offset: 84 . . . . Line: 4 @@ -114,14 +114,14 @@ Module { . . . } . . . Children: { . . . . 0: ImportFrom.module { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "ast2vec.repo2.base" . . . . . Properties: { . . . . . . promotedPropertyString: true . . . . . } . . . . } . . . . 1: alias { -. . . . . Roles: ImportPath,SimpleIdentifier +. . . . . Roles: Import,Pathname,Identifier . . . . . TOKEN "Repo2Base" . . . . . Properties: { . . . . . . asname: @@ -131,7 +131,7 @@ Module { . . . } . . } . . 3: ClassDef { -. . . Roles: TypeDeclaration,SimpleIdentifier,Statement +. . . Roles: Type,Declaration,Identifier,Statement . . . TOKEN "Repo2IdModel" . . . StartPosition: { . . . . Offset: 133 @@ -148,13 +148,13 @@ Module { . . . } . . . Children: { . . . . 0: ClassDef.body { -. . . . . Roles: TypeDeclarationBody +. . . . . Roles: Type,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 151 . . . . . . . . Line: 8 @@ -162,7 +162,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "NAME" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 151 @@ -226,7 +226,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Str { -. . . . . . . . . Roles: StringLiteral,Expression,AssignmentValue +. . . . . . . . . Roles: Literal,String,Expression,Right . . . . . . . . . TOKEN "Repo2IdModel" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 158 @@ -249,7 +249,7 @@ Module { . . . } . . } . . 4: ClassDef { -. . . Roles: TypeDeclaration,SimpleIdentifier,Statement +. . . Roles: Type,Declaration,Identifier,Statement . . . TOKEN "Repo2IdCounter" . . . StartPosition: { . . . . Offset: 181 @@ -266,13 +266,13 @@ Module { . . . } . . . Children: { . . . . 0: ClassDef.bases { -. . . . . Roles: TypeDeclarationBases +. . . . . Roles: Type,Declaration,Base . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "Repo2Base" . . . . . . . StartPosition: { . . . . . . . . Offset: 196 @@ -337,7 +337,7 @@ Module { . . . . . } . . . . } . . . . 1: ClassDef.body { -. . . . . Roles: TypeDeclarationBody +. . . . . Roles: Type,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -351,7 +351,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Str { -. . . . . . . . . Roles: StringLiteral,Expression +. . . . . . . . . Roles: Literal,String,Expression . . . . . . . . . TOKEN " Print all SIMPLE_IDENTIFIERs (and counters) from repository " @@ -372,7 +372,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 292 . . . . . . . . Line: 15 @@ -380,7 +380,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "MODEL_CLASS" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 292 @@ -398,7 +398,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: AssignmentValue,SimpleIdentifier,Expression +. . . . . . . . . Roles: Right,Identifier,Expression . . . . . . . . . TOKEN "Repo2IdModel" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 306 @@ -418,7 +418,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: FunctionDef { -. . . . . . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . . . . . Roles: Function,Declaration,Name,Identifier . . . . . . . TOKEN "collect_id_cnt" . . . . . . . StartPosition: { . . . . . . . . Offset: 328 @@ -435,7 +435,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -443,7 +443,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 343 @@ -494,7 +494,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "root" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 349 @@ -512,7 +512,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 355 @@ -532,13 +532,13 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: FunctionDef.body { -. . . . . . . . . Roles: FunctionDeclarationBody +. . . . . . . . . Roles: Function,Declaration,Body . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: For { -. . . . . . . . . . . Roles: ForEach,Statement +. . . . . . . . . . . Roles: For,Iterator,Statement . . . . . . . . . . . TOKEN "for" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 372 @@ -552,7 +552,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: For.body { -. . . . . . . . . . . . . Roles: ForBody +. . . . . . . . . . . . . Roles: For,Body . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . . . } @@ -572,13 +572,13 @@ Module { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . 0: If.body { -. . . . . . . . . . . . . . . . . Roles: IfBody +. . . . . . . . . . . . . . . . . Roles: If,Body,Then . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: AugAssign { -. . . . . . . . . . . . . . . . . . . Roles: AugmentedAssignment,Statement +. . . . . . . . . . . . . . . . . . . Roles: Operator,Binary,Assignment,Statement . . . . . . . . . . . . . . . . . . . TOKEN "?=" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 476 @@ -592,7 +592,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . 0: Subscript { -. . . . . . . . . . . . . . . . . . . . . Roles: AugmentedAssignmentVariable,Expression,Incomplete +. . . . . . . . . . . . . . . . . . . . . Roles: Left,Expression,Incomplete . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . Offset: 459 . . . . . . . . . . . . . . . . . . . . . . Line: 20 @@ -610,7 +610,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . . . . . . . . . . . . . TOKEN "token" . . . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . . . Offset: 469 @@ -628,7 +628,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . TOKEN "ch" . . . . . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . . . . . Offset: 466 @@ -650,7 +650,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . Offset: 459 @@ -670,7 +670,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . 1: Num { -. . . . . . . . . . . . . . . . . . . . . Roles: NumberLiteral,Expression,AugmentedAssignmentValue +. . . . . . . . . . . . . . . . . . . . . Roles: Literal,Number,Expression,Right . . . . . . . . . . . . . . . . . . . . . TOKEN "1" . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . Offset: 479 @@ -687,7 +687,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . 2: Add { -. . . . . . . . . . . . . . . . . . . . . Roles: OpAdd,AugmentedAssignmentOperator +. . . . . . . . . . . . . . . . . . . . . Roles: Add,Operator,Binary . . . . . . . . . . . . . . . . . . . . . TOKEN "+" . . . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . . . internalRole: op @@ -698,7 +698,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . 1: Compare { -. . . . . . . . . . . . . . . . . Roles: BinaryExpression,Expression,IfCondition +. . . . . . . . . . . . . . . . . Roles: Expression,Binary,If,Condition . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . Offset: 412 . . . . . . . . . . . . . . . . . . Line: 19 @@ -709,13 +709,13 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: Compare.comparators { -. . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionRight +. . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Right . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . . . . . . . . . TOKEN "roles" . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . Offset: 436 @@ -732,7 +732,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . . . . . . . . . TOKEN "ch" . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . Offset: 433 @@ -754,7 +754,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,BinaryExpressionLeft +. . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression,Expression,Binary,Left . . . . . . . . . . . . . . . . . . . TOKEN "SIMPLE_IDENTIFIER" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 412 @@ -772,13 +772,13 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 2: Compare.ops { -. . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionOp +. . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . 0: In { -. . . . . . . . . . . . . . . . . . . . . Roles: OpContains +. . . . . . . . . . . . . . . . . . . . . Roles: Operator,Contains . . . . . . . . . . . . . . . . . . . . . TOKEN "in" . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . } @@ -796,7 +796,7 @@ Module { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . 0: Call { -. . . . . . . . . . . . . . . . . Roles: Call,Expression +. . . . . . . . . . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . Offset: 493 . . . . . . . . . . . . . . . . . . Line: 21 @@ -807,7 +807,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "ch" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 513 @@ -825,7 +825,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 517 @@ -843,7 +843,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 2: Attribute { -. . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . . . . . . . . . . . . . TOKEN "collect_id_cnt" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 498 @@ -861,7 +861,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . . . Roles: QualifiedIdentifier,CallReceiver,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Qualified,Call,Receiver,Identifier,Expression . . . . . . . . . . . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . Offset: 493 @@ -887,7 +887,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Attribute { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,ForExpression +. . . . . . . . . . . . . Roles: Identifier,Expression,For,Expression . . . . . . . . . . . . . TOKEN "children" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 387 @@ -905,7 +905,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . TOKEN "root" . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 382 @@ -925,7 +925,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 2: Name { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,ForUpdate +. . . . . . . . . . . . . Roles: Identifier,Expression,For,Update . . . . . . . . . . . . . TOKEN "ch" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 376 @@ -949,7 +949,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: FunctionDef { -. . . . . . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . . . . . Roles: Function,Declaration,Name,Identifier . . . . . . . TOKEN "convert_uasts" . . . . . . . StartPosition: { . . . . . . . . Offset: 534 @@ -966,7 +966,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -974,7 +974,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 548 @@ -1025,7 +1025,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: arg { -. . . . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . . . TOKEN "file_uast_generator" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 554 @@ -1045,13 +1045,13 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: FunctionDef.body { -. . . . . . . . . Roles: FunctionDeclarationBody +. . . . . . . . . Roles: Function,Declaration,Body . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: For { -. . . . . . . . . . . Roles: ForEach,Statement +. . . . . . . . . . . Roles: For,Iterator,Statement . . . . . . . . . . . TOKEN "for" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 584 @@ -1065,7 +1065,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: For.body { -. . . . . . . . . . . . . Roles: ForBody +. . . . . . . . . . . . . Roles: For,Body . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . promotedPropertyList: true . . . . . . . . . . . . . } @@ -1079,7 +1079,7 @@ Module { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . 0: Call { -. . . . . . . . . . . . . . . . . Roles: Call,Expression +. . . . . . . . . . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . Offset: 634 . . . . . . . . . . . . . . . . . . Line: 25 @@ -1090,7 +1090,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: BinOp { -. . . . . . . . . . . . . . . . . . . Roles: BinaryExpression,Expression,CallPositionalArgument +. . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 655 . . . . . . . . . . . . . . . . . . . . Line: 25 @@ -1101,7 +1101,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . 0: BinOp { -. . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionLeft,BinaryExpression,Expression +. . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Left,Expression,Binary . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . Offset: 640 . . . . . . . . . . . . . . . . . . . . . . Line: 25 @@ -1112,7 +1112,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . 0: BinOp { -. . . . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionLeft,BinaryExpression,Expression +. . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Left,Expression,Binary . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . Offset: 640 . . . . . . . . . . . . . . . . . . . . . . . . Line: 25 @@ -1123,7 +1123,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . . . 0: Str { -. . . . . . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionLeft,StringLiteral,Expression +. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Left,Literal,String,Expression . . . . . . . . . . . . . . . . . . . . . . . . . TOKEN "-" . . . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . . . Offset: 640 @@ -1140,7 +1140,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . . 1: Num { -. . . . . . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . . . . . . . . . . . . . . . . . TOKEN "20" . . . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . . . Offset: 646 @@ -1157,7 +1157,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . . 2: Mult { -. . . . . . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionOp,OpMultiply +. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Multiply . . . . . . . . . . . . . . . . . . . . . . . . . TOKEN "*" . . . . . . . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . . . . . . . internalRole: op @@ -1166,7 +1166,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . 1: Str { -. . . . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionRight,StringLiteral,Expression +. . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Right,Literal,String,Expression . . . . . . . . . . . . . . . . . . . . . . . TOKEN " " . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . Offset: 651 @@ -1183,7 +1183,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . 2: Add { -. . . . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionOp,OpAdd +. . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Add . . . . . . . . . . . . . . . . . . . . . . . TOKEN "+" . . . . . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . . . . . internalRole: op @@ -1192,7 +1192,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . 1: Call { -. . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionRight,Call,Expression +. . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Right,Function,Call,Expression . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . Offset: 657 . . . . . . . . . . . . . . . . . . . . . . Line: 25 @@ -1203,7 +1203,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,CallPositionalArgument +. . . . . . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional . . . . . . . . . . . . . . . . . . . . . . . TOKEN "filepath" . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . Offset: 671 @@ -1221,7 +1221,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . . . . . . . . . . . TOKEN "file_uast" . . . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . . . Offset: 661 @@ -1241,7 +1241,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . . . . . . . . . . . . . TOKEN "str" . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . Offset: 657 @@ -1261,7 +1261,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . 2: Add { -. . . . . . . . . . . . . . . . . . . . . Roles: BinaryExpressionOp,OpAdd +. . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Add . . . . . . . . . . . . . . . . . . . . . TOKEN "+" . . . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . . . internalRole: op @@ -1270,7 +1270,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 634 @@ -1292,7 +1292,7 @@ Module { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: Assign { -. . . . . . . . . . . . . . . Roles: Assignment,Expression +. . . . . . . . . . . . . . . Roles: Binary,Assignment,Expression . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 694 . . . . . . . . . . . . . . . . Line: 26 @@ -1300,7 +1300,7 @@ Module { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . Offset: 694 @@ -1318,7 +1318,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . 1: Call { -. . . . . . . . . . . . . . . . . Roles: Call,Expression,AssignmentValue +. . . . . . . . . . . . . . . . . Roles: Function,Call,Expression,Right . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . Offset: 703 . . . . . . . . . . . . . . . . . . Line: 26 @@ -1329,7 +1329,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "Counter" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 703 @@ -1359,7 +1359,7 @@ Module { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . 0: Call { -. . . . . . . . . . . . . . . . . Roles: Call,Expression +. . . . . . . . . . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . Offset: 725 . . . . . . . . . . . . . . . . . . Line: 27 @@ -1370,7 +1370,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,CallPositionalArgument +. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional . . . . . . . . . . . . . . . . . . . TOKEN "uast" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 764 @@ -1388,7 +1388,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . . . . . . . . . . . TOKEN "response" . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . Offset: 755 @@ -1406,7 +1406,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . . . . . . . . . . . TOKEN "file_uast" . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . Offset: 745 @@ -1428,7 +1428,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 770 @@ -1446,7 +1446,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 2: Attribute { -. . . . . . . . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . . . . . . . . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . . . . . . . . . . . . . TOKEN "collect_id_cnt" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 730 @@ -1464,7 +1464,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . . . Roles: QualifiedIdentifier,CallReceiver,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . . . Roles: Identifier,Qualified,Call,Receiver,Identifier,Expression . . . . . . . . . . . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . Offset: 725 @@ -1496,7 +1496,7 @@ Module { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . 0: Call { -. . . . . . . . . . . . . . . . . Roles: Call,Expression +. . . . . . . . . . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . Offset: 790 . . . . . . . . . . . . . . . . . . Line: 28 @@ -1507,7 +1507,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 796 @@ -1525,7 +1525,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 790 @@ -1549,7 +1549,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,ForExpression +. . . . . . . . . . . . . Roles: Identifier,Expression,For,Expression . . . . . . . . . . . . . TOKEN "file_uast_generator" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 601 @@ -1567,7 +1567,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 2: Name { -. . . . . . . . . . . . . Roles: SimpleIdentifier,Expression,ForUpdate +. . . . . . . . . . . . . Roles: Identifier,Expression,For,Update . . . . . . . . . . . . . TOKEN "file_uast" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 588 @@ -1612,13 +1612,13 @@ Module { . . . } . . . Children: { . . . . 0: If.body { -. . . . . Roles: IfBody +. . . . . Roles: If,Body,Then . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 837 . . . . . . . . Line: 32 @@ -1626,7 +1626,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "repo" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 837 @@ -1644,7 +1644,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Str { -. . . . . . . . . Roles: StringLiteral,Expression,AssignmentValue +. . . . . . . . . Roles: Literal,String,Expression,Right . . . . . . . . . TOKEN "test/imports/" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 844 @@ -1663,7 +1663,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 864 . . . . . . . . Line: 33 @@ -1671,7 +1671,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "c2v" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 864 @@ -1689,7 +1689,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Call { -. . . . . . . . . Roles: Call,Expression,AssignmentValue +. . . . . . . . . Roles: Function,Call,Expression,Right . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 870 . . . . . . . . . . Line: 33 @@ -1700,7 +1700,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "Repo2IdCounter" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 870 @@ -1718,14 +1718,14 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: keyword { -. . . . . . . . . . . Roles: CallNamedArgument +. . . . . . . . . . . Roles: Call,Argument,Name . . . . . . . . . . . TOKEN "linguist" . . . . . . . . . . . Properties: { . . . . . . . . . . . . internalRole: keywords . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Str { -. . . . . . . . . . . . . Roles: StringLiteral,Expression,CallNamedArgumentValue +. . . . . . . . . . . . . Roles: Literal,String,Expression,Call,Argument,Value . . . . . . . . . . . . . TOKEN "path/to/enry" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 894 @@ -1744,14 +1744,14 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: keyword { -. . . . . . . . . . . Roles: CallNamedArgument +. . . . . . . . . . . Roles: Call,Argument,Name . . . . . . . . . . . TOKEN "bblfsh_endpoint" . . . . . . . . . . . Properties: { . . . . . . . . . . . . internalRole: keywords . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Str { -. . . . . . . . . . . . . Roles: StringLiteral,Expression,CallNamedArgumentValue +. . . . . . . . . . . . . Roles: Literal,String,Expression,Call,Argument,Value . . . . . . . . . . . . . TOKEN "0.0.0.0:9432" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 926 @@ -1782,7 +1782,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 946 . . . . . . . . . . Line: 34 @@ -1793,7 +1793,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . TOKEN "repo" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 969 @@ -1811,7 +1811,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Attribute { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . . . . . TOKEN "convert_repository" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 950 @@ -1829,7 +1829,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: QualifiedIdentifier,CallReceiver,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Qualified,Call,Receiver,Identifier,Expression . . . . . . . . . . . . . TOKEN "c2v" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 946 @@ -1855,7 +1855,7 @@ Module { . . . . . } . . . . } . . . . 1: Compare { -. . . . . Roles: BinaryExpression,Expression,IfCondition +. . . . . Roles: Expression,Binary,If,Condition . . . . . StartPosition: { . . . . . . Offset: 809 . . . . . . Line: 31 @@ -1866,13 +1866,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Str { -. . . . . . . . . Roles: StringLiteral,Expression +. . . . . . . . . Roles: Literal,String,Expression . . . . . . . . . TOKEN "__main__" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 821 @@ -1888,7 +1888,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: SimpleIdentifier,Expression,BinaryExpressionLeft +. . . . . . . Roles: Identifier,Expression,Expression,Binary,Left . . . . . . . TOKEN "__name__" . . . . . . . StartPosition: { . . . . . . . . Offset: 809 @@ -1952,13 +1952,13 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Eq { -. . . . . . . . . Roles: OpEqual +. . . . . . . . . Roles: Operator,Equal . . . . . . . . . TOKEN "==" . . . . . . . . } . . . . . . . } diff --git a/tests/issue76.py.native b/tests/issue76.py.native new file mode 100644 index 00000000..a7e0f903 --- /dev/null +++ b/tests/issue76.py.native @@ -0,0 +1,185 @@ +{ + "status": "ok", + "errors": [], + "ast": { + "PY3AST": { + "ast_type": "Module", + "body": [ + { + "ast_type": "With", + "body": [ + { + "ast_type": "Expr", + "col_offset": 5, + "lineno": 2, + "value": { + "args": [ + { + "args": [ + { + "ast_type": "Name", + "col_offset": 25, + "ctx": "Load", + "end_col_offset": 36, + "end_lineno": 2, + "id": "chosen_words", + "lineno": 2 + } + ], + "ast_type": "Call", + "col_offset": 15, + "func": { + "ast_type": "Attribute", + "attr": "join", + "col_offset": 20, + "ctx": "Load", + "end_col_offset": 23, + "end_lineno": 2, + "lineno": 2, + "value": { + "ast_type": "Str", + "col_offset": 15, + "end_col_offset": 18, + "end_lineno": 2, + "lineno": 2, + "s": "\n" + } + }, + "keywords": [], + "lineno": 2 + } + ], + "ast_type": "Call", + "col_offset": 5, + "func": { + "ast_type": "Attribute", + "attr": "write", + "col_offset": 9, + "ctx": "Load", + "end_col_offset": 13, + "end_lineno": 2, + "lineno": 2, + "value": { + "ast_type": "Name", + "col_offset": 5, + "ctx": "Load", + "end_col_offset": 7, + "end_lineno": 2, + "id": "out", + "lineno": 2 + } + }, + "keywords": [], + "lineno": 2 + } + } + ], + "col_offset": 1, + "end_col_offset": 4, + "end_lineno": 1, + "items": [ + { + "ast_type": "withitem", + "context_expr": { + "args": [ + { + "args": [ + { + "ast_type": "Attribute", + "attr": "output", + "col_offset": 29, + "ctx": "Load", + "end_col_offset": 34, + "end_lineno": 1, + "lineno": 1, + "value": { + "ast_type": "Name", + "col_offset": 24, + "ctx": "Load", + "end_col_offset": 27, + "end_lineno": 1, + "id": "args", + "lineno": 1 + } + }, + { + "ast_type": "Str", + "col_offset": 37, + "end_col_offset": 51, + "end_lineno": 1, + "lineno": 1, + "s": "row_vocab.txt" + } + ], + "ast_type": "Call", + "col_offset": 11, + "func": { + "ast_type": "Attribute", + "attr": "join", + "col_offset": 19, + "ctx": "Load", + "end_col_offset": 22, + "end_lineno": 1, + "lineno": 1, + "value": { + "ast_type": "Attribute", + "attr": "path", + "col_offset": 14, + "ctx": "Load", + "end_col_offset": 17, + "end_lineno": 1, + "lineno": 1, + "value": { + "ast_type": "Name", + "col_offset": 11, + "ctx": "Load", + "end_col_offset": 12, + "end_lineno": 1, + "id": "os", + "lineno": 1 + } + } + }, + "keywords": [], + "lineno": 1 + }, + { + "ast_type": "Str", + "col_offset": 55, + "end_col_offset": 57, + "end_lineno": 1, + "lineno": 1, + "s": "w" + } + ], + "ast_type": "Call", + "col_offset": 6, + "func": { + "ast_type": "Name", + "col_offset": 6, + "ctx": "Load", + "end_col_offset": 9, + "end_lineno": 1, + "id": "open", + "lineno": 1 + }, + "keywords": [], + "lineno": 1 + }, + "optional_vars": { + "ast_type": "Name", + "col_offset": 63, + "ctx": "Store", + "end_col_offset": 65, + "end_lineno": 1, + "id": "out", + "lineno": 1 + } + } + ], + "lineno": 1 + } + ] + } + } +} diff --git a/tests/issue76.py.source b/tests/issue76.py.source new file mode 100644 index 00000000..f8590650 --- /dev/null +++ b/tests/issue76.py.source @@ -0,0 +1,2 @@ +with open(os.path.join(args.output, "row_vocab.txt"), "w") as out: + out.write('\n'.join(chosen_words)) diff --git a/tests/issue76.py.uast b/tests/issue76.py.uast new file mode 100644 index 00000000..34378c3e --- /dev/null +++ b/tests/issue76.py.uast @@ -0,0 +1,371 @@ +Status: ok +Errors: +UAST: +Module { +. Roles: File +. Children: { +. . 0: With { +. . . Roles: Block,Scope,Statement +. . . TOKEN "with" +. . . StartPosition: { +. . . . Offset: 0 +. . . . Line: 1 +. . . . Col: 1 +. . . } +. . . EndPosition: { +. . . . Offset: 3 +. . . . Line: 1 +. . . . Col: 4 +. . . } +. . . Properties: { +. . . . internalRole: body +. . . } +. . . Children: { +. . . . 0: With.body { +. . . . . Roles: Block,Scope,Expression,Incomplete +. . . . . Properties: { +. . . . . . promotedPropertyList: true +. . . . . } +. . . . . Children: { +. . . . . . 0: Expr { +. . . . . . . Roles: Expression +. . . . . . . StartPosition: { +. . . . . . . . Offset: 71 +. . . . . . . . Line: 2 +. . . . . . . . Col: 5 +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: Call { +. . . . . . . . . Roles: Function,Call,Expression +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 71 +. . . . . . . . . . Line: 2 +. . . . . . . . . . Col: 5 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . internalRole: value +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: Call { +. . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Function,Call,Expression +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 81 +. . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . Col: 15 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: args +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: Name { +. . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . . . . . TOKEN "chosen_words" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 91 +. . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . Col: 25 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . Offset: 102 +. . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . Col: 36 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . . . internalRole: args +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . . 1: Attribute { +. . . . . . . . . . . . . Roles: Identifier,Expression,Call,Callee +. . . . . . . . . . . . . TOKEN "join" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 86 +. . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . Col: 20 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . Offset: 89 +. . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . Col: 23 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . . . internalRole: func +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Children: { +. . . . . . . . . . . . . . 0: Str { +. . . . . . . . . . . . . . . Roles: Literal,String,Expression,Call,Receiver +. . . . . . . . . . . . . . . TOKEN " +" +. . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . Offset: 81 +. . . . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . . . Col: 15 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . . . Offset: 84 +. . . . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . . . Col: 18 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . internalRole: value +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . } +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 1: Attribute { +. . . . . . . . . . . Roles: Identifier,Expression,Call,Callee +. . . . . . . . . . . TOKEN "write" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 75 +. . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . Col: 9 +. . . . . . . . . . . } +. . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . Offset: 79 +. . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . Col: 13 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . internalRole: func +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: Name { +. . . . . . . . . . . . . Roles: Identifier,Qualified,Call,Receiver,Identifier,Expression +. . . . . . . . . . . . . TOKEN "out" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 71 +. . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . Col: 5 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . Offset: 73 +. . . . . . . . . . . . . . Line: 2 +. . . . . . . . . . . . . . Col: 7 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . . . internalRole: value +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . . 1: With.items { +. . . . . Roles: Identifier,Expression,Incomplete +. . . . . Properties: { +. . . . . . promotedPropertyList: true +. . . . . } +. . . . . Children: { +. . . . . . 0: withitem { +. . . . . . . Roles: Identifier,Incomplete +. . . . . . . Children: { +. . . . . . . . 0: Call { +. . . . . . . . . Roles: Function,Call,Expression +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 5 +. . . . . . . . . . Line: 1 +. . . . . . . . . . Col: 6 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . internalRole: context_expr +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: Call { +. . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Function,Call,Expression +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 10 +. . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . Col: 11 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: args +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: Attribute { +. . . . . . . . . . . . . Roles: Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional +. . . . . . . . . . . . . TOKEN "output" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 28 +. . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . Col: 29 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . Offset: 33 +. . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . Col: 34 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . . . internalRole: args +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Children: { +. . . . . . . . . . . . . . 0: Name { +. . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression +. . . . . . . . . . . . . . . TOKEN "args" +. . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . Offset: 23 +. . . . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . . . Col: 24 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . . . Offset: 26 +. . . . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . . . Col: 27 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . . . . . internalRole: value +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . } +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . . 1: Str { +. . . . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . . . TOKEN "row_vocab.txt" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 36 +. . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . Col: 37 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . Offset: 50 +. . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . Col: 51 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . internalRole: args +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . . 2: Attribute { +. . . . . . . . . . . . . Roles: Identifier,Expression,Call,Callee +. . . . . . . . . . . . . TOKEN "join" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 18 +. . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . Col: 19 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . Offset: 21 +. . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . Col: 22 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . . . internalRole: func +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Children: { +. . . . . . . . . . . . . . 0: Attribute { +. . . . . . . . . . . . . . . Roles: Identifier,Expression,Call,Receiver +. . . . . . . . . . . . . . . TOKEN "path" +. . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . Offset: 13 +. . . . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . . . Col: 14 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . . . Offset: 16 +. . . . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . . . Col: 17 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . . . . . internalRole: value +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . Children: { +. . . . . . . . . . . . . . . . 0: Name { +. . . . . . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression +. . . . . . . . . . . . . . . . . TOKEN "os" +. . . . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . . . Offset: 10 +. . . . . . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . . . . . Col: 11 +. . . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . . . . . . . Offset: 11 +. . . . . . . . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . . . . . . . Col: 12 +. . . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . . . . . . . internalRole: value +. . . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . } +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 1: Str { +. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . TOKEN "w" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 54 +. . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . Col: 55 +. . . . . . . . . . . } +. . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . Offset: 56 +. . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . Col: 57 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: args +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 2: Name { +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression +. . . . . . . . . . . TOKEN "open" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 5 +. . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . Col: 6 +. . . . . . . . . . . } +. . . . . . . . . . . EndPosition: { +. . . . . . . . . . . . Offset: 8 +. . . . . . . . . . . . Line: 1 +. . . . . . . . . . . . Col: 9 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . ctx: Load +. . . . . . . . . . . . internalRole: func +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . . 1: Name { +. . . . . . . . . Roles: Identifier,Expression +. . . . . . . . . TOKEN "out" +. . . . . . . . . StartPosition: { +. . . . . . . . . . Offset: 62 +. . . . . . . . . . Line: 1 +. . . . . . . . . . Col: 63 +. . . . . . . . . } +. . . . . . . . . EndPosition: { +. . . . . . . . . . Offset: 64 +. . . . . . . . . . Line: 1 +. . . . . . . . . . Col: 65 +. . . . . . . . . } +. . . . . . . . . Properties: { +. . . . . . . . . . ctx: Store +. . . . . . . . . . internalRole: optional_vars +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . } +. . } +. } +} + diff --git a/tests/lambda.py.uast b/tests/lambda.py.uast index 7eb681cf..de4e9b26 100644 --- a/tests/lambda.py.uast +++ b/tests/lambda.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Lambda { -. . . . . Roles: FunctionDeclaration,Expression,Incomplete +. . . . . Roles: Function,Declaration,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -32,7 +32,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arguments { -. . . . . . . Roles: FunctionDeclarationArgument,Incomplete,FunctionDeclarationArgument,Incomplete +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . Properties: { . . . . . . . . internalRole: args . . . . . . . . kwarg: @@ -40,7 +40,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arg { -. . . . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier,FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . . . Roles: Argument,Name,Identifier . . . . . . . . . TOKEN "x" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 7 @@ -60,7 +60,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: BinOp { -. . . . . . . Roles: BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 10 . . . . . . . . Line: 1 @@ -71,7 +71,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . TOKEN "x" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 10 @@ -89,7 +89,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 12 @@ -106,7 +106,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: BinaryExpressionOp,OpAdd +. . . . . . . . . Roles: Expression,Binary,Operator,Add . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op diff --git a/tests/literals_assign.py.uast b/tests/literals_assign.py.uast index 7bad87ad..5ab7a98d 100644 --- a/tests/literals_assign.py.uast +++ b/tests/literals_assign.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 0 @@ -53,7 +53,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "3" . . . . . StartPosition: { . . . . . . Offset: 4 @@ -72,7 +72,7 @@ Module { . . . } . . } . . 1: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 12 . . . . Line: 2 @@ -83,7 +83,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "b" . . . . . StartPosition: { . . . . . . Offset: 12 @@ -120,7 +120,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "3.14" . . . . . StartPosition: { . . . . . . Offset: 16 @@ -139,7 +139,7 @@ Module { . . . } . . } . . 2: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 29 . . . . Line: 3 @@ -150,7 +150,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "c" . . . . . StartPosition: { . . . . . . Offset: 29 @@ -187,7 +187,7 @@ Module { . . . . . } . . . . } . . . . 1: Str { -. . . . . Roles: StringLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,String,Expression,Right . . . . . TOKEN "somestring" . . . . . StartPosition: { . . . . . . Offset: 33 @@ -206,7 +206,7 @@ Module { . . . } . . } . . 3: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 55 . . . . Line: 4 @@ -217,7 +217,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "d" . . . . . StartPosition: { . . . . . . Offset: 55 @@ -254,7 +254,7 @@ Module { . . . . . } . . . . } . . . . 1: NoneLiteral { -. . . . . Roles: NullLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Null,Expression,Right . . . . . TOKEN "" . . . . . StartPosition: { . . . . . . Offset: 59 @@ -274,7 +274,7 @@ Module { . . . } . . } . . 4: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 71 . . . . Line: 5 @@ -285,7 +285,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "e" . . . . . StartPosition: { . . . . . . Offset: 71 @@ -322,7 +322,7 @@ Module { . . . . . } . . . . } . . . . 1: List { -. . . . . Roles: ListLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,List,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 75 . . . . . . Line: 5 @@ -334,7 +334,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 76 @@ -351,7 +351,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 79 @@ -368,7 +368,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 82 @@ -389,7 +389,7 @@ Module { . . . } . . } . . 5: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 100 . . . . Line: 6 @@ -400,7 +400,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "f" . . . . . StartPosition: { . . . . . . Offset: 100 @@ -437,7 +437,7 @@ Module { . . . . . } . . . . } . . . . 1: Tuple { -. . . . . Roles: TupleLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Tuple,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 105 . . . . . . Line: 6 @@ -449,7 +449,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 105 @@ -466,7 +466,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 108 @@ -483,7 +483,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 111 @@ -504,7 +504,7 @@ Module { . . . } . . } . . 6: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 130 . . . . Line: 7 @@ -515,7 +515,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "g" . . . . . StartPosition: { . . . . . . Offset: 130 @@ -552,7 +552,7 @@ Module { . . . . . } . . . . } . . . . 1: Set { -. . . . . Roles: SetLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Set,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 134 . . . . . . Line: 7 @@ -563,7 +563,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 135 @@ -580,7 +580,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 138 @@ -597,7 +597,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 141 @@ -618,7 +618,7 @@ Module { . . . } . . } . . 7: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 158 . . . . Line: 8 @@ -629,7 +629,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "h" . . . . . StartPosition: { . . . . . . Offset: 158 @@ -666,7 +666,7 @@ Module { . . . . . } . . . . } . . . . 1: Dict { -. . . . . Roles: MapLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Map,Expression,Right . . . . . StartPosition: { . . . . . . Offset: 162 . . . . . . Line: 8 @@ -677,7 +677,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression,MapKey +. . . . . . . Roles: Literal,String,Expression,Map,Key . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 163 @@ -694,7 +694,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Str { -. . . . . . . Roles: StringLiteral,Expression,MapKey +. . . . . . . Roles: Literal,String,Expression,Map,Key . . . . . . . TOKEN "b" . . . . . . . StartPosition: { . . . . . . . . Offset: 171 @@ -711,7 +711,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Num { -. . . . . . . Roles: NumberLiteral,Expression,MapValue +. . . . . . . Roles: Literal,Number,Expression,Map,Value . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 168 @@ -728,7 +728,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: Num { -. . . . . . . Roles: NumberLiteral,Expression,MapValue +. . . . . . . Roles: Literal,Number,Expression,Map,Value . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 176 @@ -749,7 +749,7 @@ Module { . . . } . . } . . 8: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 194 . . . . Line: 9 @@ -760,7 +760,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "i" . . . . . StartPosition: { . . . . . . Offset: 194 @@ -797,7 +797,7 @@ Module { . . . . . } . . . . } . . . . 1: BinOp { -. . . . . Roles: BinaryExpression,Expression,AssignmentValue +. . . . . Roles: Expression,Binary,Right . . . . . StartPosition: { . . . . . . Offset: 204 . . . . . . Line: 9 @@ -808,7 +808,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: BinOp { -. . . . . . . Roles: BinaryExpressionLeft,BinaryExpression,Expression +. . . . . . . Roles: Expression,Binary,Left,Expression,Binary . . . . . . . StartPosition: { . . . . . . . . Offset: 198 . . . . . . . . Line: 9 @@ -819,7 +819,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 198 @@ -837,7 +837,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: BinaryExpressionRight,SimpleIdentifier,Expression +. . . . . . . . . Roles: Expression,Binary,Right,Identifier,Expression . . . . . . . . . TOKEN "b" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 202 @@ -855,7 +855,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: BinaryExpressionOp,OpAdd +. . . . . . . . . Roles: Expression,Binary,Operator,Add . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -864,7 +864,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Call { -. . . . . . . Roles: BinaryExpressionRight,Call,Expression +. . . . . . . Roles: Expression,Binary,Right,Function,Call,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 206 . . . . . . . . Line: 9 @@ -875,7 +875,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: CallPositionalArgument,SimpleIdentifier,Expression +. . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . TOKEN "d" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 210 @@ -893,7 +893,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . TOKEN "int" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 206 @@ -913,7 +913,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Sub { -. . . . . . . Roles: BinaryExpressionOp,OpSubstract +. . . . . . . Roles: Expression,Binary,Operator,Substract . . . . . . . TOKEN "-" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/loop_if.py.uast b/tests/loop_if.py.uast index 1ca97602..17b3bf07 100644 --- a/tests/loop_if.py.uast +++ b/tests/loop_if.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: For { -. . . Roles: ForEach,Statement +. . . Roles: For,Iterator,Statement . . . TOKEN "for" . . . StartPosition: { . . . . Offset: 0 @@ -22,7 +22,7 @@ Module { . . . } . . . Children: { . . . . 0: For.body { -. . . . . Roles: ForBody +. . . . . Roles: For,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -44,7 +44,7 @@ Module { . . . . . } . . . . } . . . . 1: Name { -. . . . . Roles: SimpleIdentifier,Expression,ForExpression +. . . . . Roles: Identifier,Expression,For,Expression . . . . . TOKEN "something" . . . . . StartPosition: { . . . . . . Offset: 9 @@ -62,7 +62,7 @@ Module { . . . . . } . . . . } . . . . 2: For.orelse { -. . . . . Roles: IfElse +. . . . . Roles: For,Body,Else . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -76,7 +76,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 39 . . . . . . . . . . Line: 4 @@ -87,7 +87,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "Python fors have elses" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 45 @@ -104,7 +104,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 39 @@ -128,7 +128,7 @@ Module { . . . . . } . . . . } . . . . 3: Name { -. . . . . Roles: SimpleIdentifier,Expression,ForUpdate +. . . . . Roles: Identifier,Expression,For,Update . . . . . TOKEN "i" . . . . . StartPosition: { . . . . . . Offset: 4 diff --git a/tests/other_statements.py.uast b/tests/other_statements.py.uast index 6c45aa1c..cac02c13 100644 --- a/tests/other_statements.py.uast +++ b/tests/other_statements.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 0 @@ -34,7 +34,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 4 @@ -53,7 +53,7 @@ Module { . . . } . . } . . 1: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 6 . . . . Line: 2 @@ -64,7 +64,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "b" . . . . . StartPosition: { . . . . . . Offset: 6 @@ -82,7 +82,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "2" . . . . . StartPosition: { . . . . . . Offset: 10 @@ -118,7 +118,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: SimpleIdentifier,Expression +. . . . . Roles: Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 16 @@ -138,7 +138,7 @@ Module { . . . } . . } . . 3: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "f" . . . StartPosition: { . . . . Offset: 22 @@ -156,13 +156,13 @@ Module { . . . } . . . Children: { . . . . 0: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Global { -. . . . . . . Roles: Statement,VisibleFromWorld,Incomplete +. . . . . . . Roles: Statement,Visibility,World,Incomplete . . . . . . . TOKEN "global" . . . . . . . StartPosition: { . . . . . . . . Offset: 31 @@ -176,7 +176,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 38 @@ -195,7 +195,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Nonlocal { -. . . . . . . Roles: Statement,VisibleFromModule,Incomplete +. . . . . . . Roles: Statement,Visibility,Module,Incomplete . . . . . . . TOKEN "nonlocal" . . . . . . . StartPosition: { . . . . . . . . Offset: 44 @@ -209,7 +209,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "b" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 53 @@ -236,7 +236,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Yield { -. . . . . . . . . Roles: Return,Statement,Incomplete,ListLiteral,Expression,Incomplete +. . . . . . . . . Roles: Return,Statement,Incomplete,Literal,List,Expression,Incomplete . . . . . . . . . TOKEN "yield" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 59 @@ -253,7 +253,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . TOKEN "b" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 65 @@ -277,7 +277,7 @@ Module { . . . . . } . . . . } . . . . 1: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: diff --git a/tests/pass.py.uast b/tests/pass.py.uast index d5faf401..74663d9f 100644 --- a/tests/pass.py.uast +++ b/tests/pass.py.uast @@ -41,7 +41,7 @@ Module { . . . } . . } . . 1: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "somefun" . . . StartPosition: { . . . . Offset: 17 @@ -59,7 +59,7 @@ Module { . . . } . . . Children: { . . . . 0: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -114,7 +114,7 @@ Module { . . . . . } . . . . } . . . . 1: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -124,7 +124,7 @@ Module { . . . } . . } . . 2: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "otherfun" . . . StartPosition: { . . . . Offset: 38 @@ -142,7 +142,7 @@ Module { . . . } . . . Children: { . . . . 0: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -197,7 +197,7 @@ Module { . . . . . } . . . . } . . . . 1: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: diff --git a/tests/print.py.uast b/tests/print.py.uast index de4283b5..ee1ba521 100644 --- a/tests/print.py.uast +++ b/tests/print.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: Print { -. . . Roles: Call,CallCallee,SimpleIdentifier,Expression +. . . Roles: Function,Call,Callee,Identifier,Expression . . . TOKEN "print" . . . StartPosition: { . . . . Offset: 0 @@ -24,7 +24,7 @@ Module { . . . } . . . Children: { . . . . 0: Num { -. . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . Roles: Literal,Number,Expression,Call,Argument,Positional . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 6 @@ -43,7 +43,7 @@ Module { . . . } . . } . . 1: Print { -. . . Roles: Call,CallCallee,SimpleIdentifier,Expression +. . . Roles: Function,Call,Callee,Identifier,Expression . . . TOKEN "print" . . . StartPosition: { . . . . Offset: 9 @@ -62,7 +62,7 @@ Module { . . . } . . . Children: { . . . . 0: Num { -. . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . Roles: Literal,Number,Expression,Call,Argument,Positional . . . . . TOKEN "2" . . . . . StartPosition: { . . . . . . Offset: 15 diff --git a/tests/qualified.py.uast b/tests/qualified.py.uast index 9ea6b687..4829a8d9 100644 --- a/tests/qualified.py.uast +++ b/tests/qualified.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Attribute { -. . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . TOKEN "method" . . . . . . . StartPosition: { . . . . . . . . Offset: 4 @@ -45,7 +45,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: QualifiedIdentifier,CallReceiver,SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Qualified,Call,Receiver,Identifier,Expression . . . . . . . . . TOKEN "obj" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 @@ -69,7 +69,7 @@ Module { . . . } . . } . . 1: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 13 . . . . Line: 2 @@ -80,7 +80,7 @@ Module { . . . } . . . Children: { . . . . 0: Attribute { -. . . . . Roles: SimpleIdentifier,Expression,AssignmentVariable +. . . . . Roles: Identifier,Expression,Left . . . . . TOKEN "b" . . . . . StartPosition: { . . . . . . Offset: 15 @@ -98,7 +98,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -118,7 +118,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "1" . . . . . StartPosition: { . . . . . . Offset: 19 @@ -137,7 +137,7 @@ Module { . . . } . . } . . 2: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 21 . . . . Line: 3 @@ -148,7 +148,7 @@ Module { . . . } . . . Children: { . . . . 0: Attribute { -. . . . . Roles: SimpleIdentifier,Expression,AssignmentVariable +. . . . . Roles: Identifier,Expression,Left . . . . . TOKEN "e" . . . . . StartPosition: { . . . . . . Offset: 29 @@ -166,7 +166,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Attribute { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "d" . . . . . . . StartPosition: { . . . . . . . . Offset: 27 @@ -184,7 +184,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Attribute { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "c" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 25 @@ -202,7 +202,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Identifier,Expression . . . . . . . . . . . TOKEN "b" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 23 @@ -220,7 +220,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: QualifiedIdentifier,SimpleIdentifier,Expression +. . . . . . . . . . . . . Roles: Identifier,Qualified,Identifier,Expression . . . . . . . . . . . . . TOKEN "a" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 21 @@ -246,7 +246,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "5" . . . . . StartPosition: { . . . . . . Offset: 33 diff --git a/tests/repr.py.uast b/tests/repr.py.uast index c5369def..fc44dd67 100644 --- a/tests/repr.py.uast +++ b/tests/repr.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 5 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "repr" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 diff --git a/tests/sameline.py.uast b/tests/sameline.py.uast index c724939a..728add1f 100644 --- a/tests/sameline.py.uast +++ b/tests/sameline.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "same line test" . . . . . . . StartPosition: { . . . . . . . . Offset: 6 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "print" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 @@ -77,7 +77,7 @@ Module { . . . } . . . Children: { . . . . 0: Call { -. . . . . Roles: Call,Expression +. . . . . Roles: Function,Call,Expression . . . . . StartPosition: { . . . . . . Offset: 25 . . . . . . Line: 1 @@ -88,7 +88,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "another call" . . . . . . . StartPosition: { . . . . . . . . Offset: 31 @@ -105,7 +105,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Name { -. . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . TOKEN "print" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 diff --git a/tests/sorting.py.uast b/tests/sorting.py.uast index 5cac790a..bcd66d14 100644 --- a/tests/sorting.py.uast +++ b/tests/sorting.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: BinOp { -. . . . . Roles: BinaryExpression,Expression +. . . . . Roles: Expression,Binary . . . . . StartPosition: { . . . . . . Offset: 17 . . . . . . Line: 2 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: BinaryExpressionLeft,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Left,Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 17 @@ -94,7 +94,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . TOKEN "2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -111,7 +111,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Add { -. . . . . . . Roles: BinaryExpressionOp,OpAdd +. . . . . . . Roles: Expression,Binary,Operator,Add . . . . . . . TOKEN "+" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/string_fstring.py.uast b/tests/string_fstring.py.uast index 47bfd662..97b27266 100644 --- a/tests/string_fstring.py.uast +++ b/tests/string_fstring.py.uast @@ -6,7 +6,7 @@ Module { . Roles: File . Children: { . . 0: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 0 . . . . Line: 1 @@ -17,7 +17,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "a" . . . . . StartPosition: { . . . . . . Offset: 0 @@ -35,7 +35,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "42" . . . . . StartPosition: { . . . . . . Offset: 4 @@ -54,7 +54,7 @@ Module { . . . } . . } . . 1: Assign { -. . . Roles: Assignment,Expression +. . . Roles: Binary,Assignment,Expression . . . StartPosition: { . . . . Offset: 7 . . . . Line: 2 @@ -65,7 +65,7 @@ Module { . . . } . . . Children: { . . . . 0: Name { -. . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . Roles: Left,Identifier,Expression . . . . . TOKEN "b" . . . . . StartPosition: { . . . . . . Offset: 7 @@ -83,7 +83,7 @@ Module { . . . . . } . . . . } . . . . 1: Num { -. . . . . Roles: NumberLiteral,Expression,AssignmentValue +. . . . . Roles: Literal,Number,Expression,Right . . . . . TOKEN "3.14" . . . . . StartPosition: { . . . . . . Offset: 11 @@ -113,7 +113,7 @@ Module { . . . } . . . Children: { . . . . 0: JoinedStr { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . StartPosition: { . . . . . . Offset: 16 . . . . . . Line: 3 @@ -124,7 +124,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN "This is an fstring with an " . . . . . . . StartPosition: { . . . . . . . . Offset: 18 @@ -154,7 +154,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 1 @@ -169,7 +169,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN " inserted parameter" . . . . . . . StartPosition: { . . . . . . . . Offset: 48 @@ -201,7 +201,7 @@ Module { . . . } . . . Children: { . . . . 0: JoinedStr { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . StartPosition: { . . . . . . Offset: 69 . . . . . . Line: 4 @@ -212,7 +212,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN "Another with " . . . . . . . StartPosition: { . . . . . . . . Offset: 71 @@ -242,7 +242,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 1 @@ -257,7 +257,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN " tostring indicator" . . . . . . . StartPosition: { . . . . . . . . Offset: 89 @@ -289,7 +289,7 @@ Module { . . . } . . . Children: { . . . . 0: JoinedStr { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . StartPosition: { . . . . . . Offset: 110 . . . . . . Line: 5 @@ -300,7 +300,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN "Another with " . . . . . . . StartPosition: { . . . . . . . . Offset: 112 @@ -330,7 +330,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 1 @@ -345,7 +345,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN " repr indicator" . . . . . . . StartPosition: { . . . . . . . . Offset: 130 @@ -377,7 +377,7 @@ Module { . . . } . . . Children: { . . . . 0: JoinedStr { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . StartPosition: { . . . . . . Offset: 147 . . . . . . Line: 6 @@ -388,7 +388,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN "Another with " . . . . . . . StartPosition: { . . . . . . . . Offset: 149 @@ -418,7 +418,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 1 @@ -433,7 +433,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN " ascii indicator" . . . . . . . StartPosition: { . . . . . . . . Offset: 167 @@ -465,7 +465,7 @@ Module { . . . } . . . Children: { . . . . 0: JoinedStr { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . StartPosition: { . . . . . . Offset: 185 . . . . . . Line: 7 @@ -476,7 +476,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN "Another with " . . . . . . . StartPosition: { . . . . . . . . Offset: 187 @@ -505,7 +505,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: JoinedStr { -. . . . . . . . . Roles: StringLiteral,Expression +. . . . . . . . . Roles: Literal,String,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 185 . . . . . . . . . . Line: 7 @@ -529,7 +529,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . . . . . TOKEN "2" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 1 @@ -543,7 +543,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Str { -. . . . . . . . . . . Roles: StringLiteral,Expression +. . . . . . . . . . . Roles: Literal,String,Expression . . . . . . . . . . . TOKEN "." . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 206 @@ -573,7 +573,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Num { -. . . . . . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . . . . . TOKEN "3" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 1 @@ -589,7 +589,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "b" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 1 @@ -604,7 +604,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN " width and precission float indicator" . . . . . . . StartPosition: { . . . . . . . . Offset: 211 @@ -625,7 +625,7 @@ Module { . . . } . . } . . 7: FunctionDef { -. . . Roles: FunctionDeclaration,FunctionDeclarationName,SimpleIdentifier +. . . Roles: Function,Declaration,Name,Identifier . . . TOKEN "somefunc" . . . StartPosition: { . . . . Offset: 255 @@ -643,7 +643,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: FunctionDeclarationArgument,Incomplete +. . . . . Roles: Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -651,7 +651,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: FunctionDeclarationArgument,FunctionDeclarationArgumentName,SimpleIdentifier +. . . . . . . Roles: Argument,Name,Identifier . . . . . . . TOKEN "i" . . . . . . . StartPosition: { . . . . . . . . Offset: 264 @@ -704,7 +704,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.body { -. . . . . Roles: FunctionDeclarationBody +. . . . . Roles: Function,Declaration,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -724,7 +724,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: BinOp { -. . . . . . . . . Roles: BinaryExpression,Expression +. . . . . . . . . Roles: Expression,Binary . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 275 . . . . . . . . . . Line: 9 @@ -735,7 +735,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: BinaryExpressionLeft,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Expression,Binary,Left,Identifier,Expression . . . . . . . . . . . TOKEN "i" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 275 @@ -753,7 +753,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Num { -. . . . . . . . . . . Roles: BinaryExpressionRight,NumberLiteral,Expression +. . . . . . . . . . . Roles: Expression,Binary,Right,Literal,Number,Expression . . . . . . . . . . . TOKEN "2" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 277 @@ -770,7 +770,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: Mult { -. . . . . . . . . . . Roles: BinaryExpressionOp,OpMultiply +. . . . . . . . . . . Roles: Expression,Binary,Operator,Multiply . . . . . . . . . . . TOKEN "*" . . . . . . . . . . . Properties: { . . . . . . . . . . . . internalRole: op @@ -796,7 +796,7 @@ Module { . . . } . . . Children: { . . . . 0: JoinedStr { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . StartPosition: { . . . . . . Offset: 279 . . . . . . Line: 10 @@ -807,7 +807,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN "Another with " . . . . . . . StartPosition: { . . . . . . . . Offset: 281 @@ -837,7 +837,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 1 . . . . . . . . . . Line: 1 @@ -848,7 +848,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Num { -. . . . . . . . . . . Roles: NumberLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "10" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 @@ -860,7 +860,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "somefunc" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 @@ -877,7 +877,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN " an embedded call" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 @@ -909,7 +909,7 @@ Module { . . . } . . . Children: { . . . . 0: JoinedStr { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 11 @@ -920,7 +920,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN "Another with " . . . . . . . StartPosition: { . . . . . . . . Offset: 0 @@ -950,7 +950,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 0 . . . . . . . . . . Line: 1 @@ -961,7 +961,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . Roles: SimpleIdentifier,Expression,CallCallee +. . . . . . . . . . . Roles: Identifier,Expression,Call,Callee . . . . . . . . . . . TOKEN "upper" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 @@ -974,7 +974,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Str { -. . . . . . . . . . . . . Roles: StringLiteral,Expression,CallReceiver +. . . . . . . . . . . . . Roles: Literal,String,Expression,Call,Receiver . . . . . . . . . . . . . TOKEN "pok" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 0 @@ -992,7 +992,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Str { -. . . . . . . Roles: StringLiteral,Expression +. . . . . . . Roles: Literal,String,Expression . . . . . . . TOKEN " an embedded expression" . . . . . . . StartPosition: { . . . . . . . . Offset: 0 diff --git a/tests/string_normal.py.uast b/tests/string_normal.py.uast index 70881c8e..71e8b152 100644 --- a/tests/string_normal.py.uast +++ b/tests/string_normal.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Str { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . TOKEN "Normal double quoted string" . . . . . StartPosition: { . . . . . . Offset: 0 @@ -46,7 +46,7 @@ Module { . . . } . . . Children: { . . . . 0: Str { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . TOKEN "Normal single quoted string" . . . . . StartPosition: { . . . . . . Offset: 30 diff --git a/tests/string_triple.py.uast b/tests/string_triple.py.uast index 9b0b3d62..8ab27ac7 100644 --- a/tests/string_triple.py.uast +++ b/tests/string_triple.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: Str { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . TOKEN " Triple double-quoted string Second line @@ -49,7 +49,7 @@ Second line . . . } . . . Children: { . . . . 0: Str { -. . . . . Roles: StringLiteral,Expression +. . . . . Roles: Literal,String,Expression . . . . . TOKEN " Triple single-quoted string Second line diff --git a/tests/test.py.uast b/tests/test.py.uast index e2df1814..975931f7 100644 --- a/tests/test.py.uast +++ b/tests/test.py.uast @@ -22,7 +22,7 @@ Module { . . . } . . . Children: { . . . . 0: If.body { -. . . . . Roles: IfBody +. . . . . Roles: If,Body,Then . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -44,7 +44,7 @@ Module { . . . . . } . . . . } . . . . 1: Compare { -. . . . . Roles: BinaryExpression,Expression,IfCondition +. . . . . Roles: Expression,Binary,If,Condition . . . . . StartPosition: { . . . . . . Offset: 3 . . . . . . Line: 1 @@ -55,13 +55,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 7 @@ -77,7 +77,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,BinaryExpressionLeft +. . . . . . . Roles: Literal,Number,Expression,Expression,Binary,Left . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 3 @@ -94,13 +94,13 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Gt { -. . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } diff --git a/tests/unary.py.uast b/tests/unary.py.uast index bb6d6c00..c1c6139d 100644 --- a/tests/unary.py.uast +++ b/tests/unary.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: UnaryOp { -. . . . . Roles: Expression,Incomplete +. . . . . Roles: Operator,Unary,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: NumberLiteral,Expression +. . . . . . . Roles: Literal,Number,Expression . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 1 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Invert { -. . . . . . . Roles: OpBitwiseComplement +. . . . . . . Roles: Operator,Unary,Bitwise,Not . . . . . . . TOKEN "~" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -66,7 +66,7 @@ Module { . . . } . . . Children: { . . . . 0: UnaryOp { -. . . . . Roles: Expression,Incomplete +. . . . . Roles: Operator,Unary,Expression . . . . . StartPosition: { . . . . . . Offset: 3 . . . . . . Line: 2 @@ -77,7 +77,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 4 @@ -95,7 +95,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: USub { -. . . . . . . Roles: OpNegative +. . . . . . . Roles: Operator,Unary,Negative . . . . . . . TOKEN "-" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -117,7 +117,7 @@ Module { . . . } . . . Children: { . . . . 0: UnaryOp { -. . . . . Roles: Expression,Incomplete +. . . . . Roles: Operator,Unary,Expression . . . . . StartPosition: { . . . . . . Offset: 6 . . . . . . Line: 3 @@ -128,7 +128,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . Roles: Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 7 @@ -146,7 +146,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: UAdd { -. . . . . . . Roles: OpPositive +. . . . . . . Roles: Operator,Unary,Positive . . . . . . . TOKEN "+" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/while.py.uast b/tests/while.py.uast index 02c4c3ae..1db2c137 100644 --- a/tests/while.py.uast +++ b/tests/while.py.uast @@ -22,7 +22,7 @@ Module { . . . } . . . Children: { . . . . 0: While.body { -. . . . . Roles: WhileBody +. . . . . Roles: While,Body . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -36,7 +36,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 17 . . . . . . . . . . Line: 2 @@ -47,7 +47,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "surely here" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 23 @@ -64,7 +64,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 17 @@ -102,7 +102,7 @@ Module { . . . . . } . . . . } . . . . 1: While.orelse { -. . . . . Roles: IfElse +. . . . . Roles: While,Body,Else . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -116,7 +116,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Call { -. . . . . . . . . Roles: Call,Expression +. . . . . . . . . Roles: Function,Call,Expression . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 58 . . . . . . . . . . Line: 5 @@ -127,7 +127,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: StringLiteral,Expression,CallPositionalArgument +. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "while's else" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 64 @@ -144,7 +144,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Name { -. . . . . . . . . . . Roles: CallCallee,SimpleIdentifier,Expression +. . . . . . . . . . . Roles: Call,Callee,Identifier,Expression . . . . . . . . . . . TOKEN "print" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 58 @@ -168,7 +168,7 @@ Module { . . . . . } . . . . } . . . . 2: Compare { -. . . . . Roles: BinaryExpression,Expression,WhileCondition +. . . . . Roles: Expression,Binary,While,Condition . . . . . StartPosition: { . . . . . . Offset: 6 . . . . . . Line: 1 @@ -179,13 +179,13 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Compare.comparators { -. . . . . . . Roles: BinaryExpressionRight +. . . . . . . Roles: Expression,Binary,Right . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: NumberLiteral,Expression +. . . . . . . . . Roles: Literal,Number,Expression . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 10 @@ -201,7 +201,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: NumberLiteral,Expression,BinaryExpressionLeft +. . . . . . . Roles: Literal,Number,Expression,Expression,Binary,Left . . . . . . . TOKEN "3" . . . . . . . StartPosition: { . . . . . . . . Offset: 6 @@ -218,13 +218,13 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Compare.ops { -. . . . . . . Roles: BinaryExpressionOp +. . . . . . . Roles: Expression,Binary,Operator . . . . . . . Properties: { . . . . . . . . promotedPropertyList: true . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Gt { -. . . . . . . . . Roles: OpGreaterThan +. . . . . . . . . Roles: Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } diff --git a/tests/with.py.uast b/tests/with.py.uast index 3ac8999c..67d1ce1e 100644 --- a/tests/with.py.uast +++ b/tests/with.py.uast @@ -5,7 +5,7 @@ Module { . Roles: File . Children: { . . 0: With { -. . . Roles: BlockScope,Statement +. . . Roles: Block,Scope,Statement . . . TOKEN "with" . . . StartPosition: { . . . . Offset: 0 @@ -22,13 +22,13 @@ Module { . . . } . . . Children: { . . . . 0: With.body { -. . . . . Roles: BlockScope,Expression,Incomplete +. . . . . Roles: Block,Scope,Expression,Incomplete . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: Assign { -. . . . . . . Roles: Assignment,Expression +. . . . . . . Roles: Binary,Assignment,Expression . . . . . . . StartPosition: { . . . . . . . . Offset: 25 . . . . . . . . Line: 2 @@ -36,7 +36,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: AssignmentVariable,SimpleIdentifier,Expression +. . . . . . . . . Roles: Left,Identifier,Expression . . . . . . . . . TOKEN "a" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 25 @@ -54,7 +54,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: AssignmentValue,SimpleIdentifier,Expression +. . . . . . . . . Roles: Right,Identifier,Expression . . . . . . . . . TOKEN "s" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 29 @@ -76,16 +76,16 @@ Module { . . . . . } . . . . } . . . . 1: With.items { -. . . . . Roles: SimpleIdentifier,Expression,Incomplete +. . . . . Roles: Identifier,Expression,Incomplete . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } . . . . . Children: { . . . . . . 0: withitem { -. . . . . . . Roles: SimpleIdentifier,Incomplete +. . . . . . . Roles: Identifier,Incomplete . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "something" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 5 @@ -103,7 +103,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Name { -. . . . . . . . . Roles: SimpleIdentifier,Expression +. . . . . . . . . Roles: Identifier,Expression . . . . . . . . . TOKEN "s" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 18 From b3950cbab18394df972569c07ba0aa51bb01e14e Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Mon, 18 Sep 2017 10:27:54 +0200 Subject: [PATCH 2/3] Feedback from review --- ANNOTATION.md | 68 ++++++++++++------------- driver/normalizer/annotation.go | 68 ++++++++++++------------- tests/annotations.py.uast | 6 +-- tests/aritmeticops.py.uast | 14 ++--- tests/augassign.py.uast | 8 +-- tests/bitwise.py.uast | 22 ++++---- tests/classdef.py.uast | 22 ++++---- tests/comparisonop.py.uast | 16 +++--- tests/complex.py.uast | 2 +- tests/comprehension_dict.py.uast | 6 +-- tests/comprehension_list.py.uast | 10 ++-- tests/comprehension_set.py.uast | 6 +-- tests/continue_break.py.uast | 4 +- tests/except.py.uast | 10 ++-- tests/exec.py.uast | 2 +- tests/for.py.uast | 4 +- tests/functioncalls.py.uast | 20 ++++---- tests/functiondef_annotated.py.uast | 8 +-- tests/functiondef_decorated.py.uast | 14 ++--- tests/functiondef_defaultparams.py.uast | 18 +++---- tests/functiondef_docstring.py.uast | 2 +- tests/functiondef_kwarg.py.uast | 18 +++---- tests/functiondef_simple.py.uast | 20 ++++---- tests/functiondef_vararg.py.uast | 8 +-- tests/hello.py.uast | 2 +- tests/if.py.uast | 14 ++--- tests/ifexpression.py.uast | 2 +- tests/issue30.py.uast | 2 +- tests/issue62_b.py.uast | 42 +++++++-------- tests/issue76.py.uast | 12 ++--- tests/lambda.py.uast | 6 +-- tests/literals_assign.py.uast | 6 +-- tests/loop_if.py.uast | 2 +- tests/other_statements.py.uast | 2 +- tests/pass.py.uast | 4 +- tests/repr.py.uast | 2 +- tests/sameline.py.uast | 4 +- tests/sorting.py.uast | 2 +- tests/string_fstring.py.uast | 8 +-- tests/test.py.uast | 2 +- tests/while.py.uast | 6 +-- 41 files changed, 247 insertions(+), 247 deletions(-) diff --git a/ANNOTATION.md b/ANNOTATION.md index f4864d58..ecbcf450 100644 --- a/ANNOTATION.md +++ b/ANNOTATION.md @@ -6,29 +6,29 @@ | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='op'\] | Expression, Binary, Operator | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='left'\] | Expression, Binary, Left | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BinOp'\]/\*\[@internalRole\]\[@internalRole='right'\] | Expression, Binary, Right | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Eq'\] | Operator, Equal | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NotEq'\] | Operator, Equal, Not | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lt'\] | Operator, LessThan | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='LtE'\] | Operator, LessThanOrEqual | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Gt'\] | Operator, GreaterThan | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='GtE'\] | Operator, GreaterThanOrEqual | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Is'\] | Operator, Identical | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IsNot'\] | Operator, Identical, Not | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='In'\] | Operator, Contains | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NotIn'\] | Operator, Contains, Not | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Add'\] | Add | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Sub'\] | Substract | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Mult'\] | Multiply | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Div'\] | Divide | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Mod'\] | Modulo | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FloorDiv'\] | Divide, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Pow'\] | Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='MatMult'\] | Multiply, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='LShift'\] | Bitwise, LeftShift | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='RShift'\] | Bitwise, RightShift | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitOr'\] | Bitwise, Or | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitXor'\] | Bitwise, Xor | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitAnd'\] | Bitwise, And | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Eq'\] | Binary, Operator, Equal | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NotEq'\] | Binary, Operator, Equal, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lt'\] | Binary, Operator, LessThan | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='LtE'\] | Binary, Operator, LessThanOrEqual | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Gt'\] | Binary, Operator, GreaterThan | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='GtE'\] | Binary, Operator, GreaterThanOrEqual | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Is'\] | Binary, Operator, Identical | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='IsNot'\] | Binary, Operator, Identical, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='In'\] | Binary, Operator, Contains | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='NotIn'\] | Binary, Operator, Contains, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Add'\] | Binary, Operator, Add | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Sub'\] | Binary, Operator, Substract | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Mult'\] | Binary, Operator, Multiply | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Div'\] | Binary, Operator, Divide | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Mod'\] | Binary, Operator, Modulo | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FloorDiv'\] | Binary, Operator, Divide, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Pow'\] | Binary, Operator, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='MatMult'\] | Binary, Operator, Multiply, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='LShift'\] | Binary, Operator, Bitwise, LeftShift | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='RShift'\] | Binary, Operator, Bitwise, RightShift | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitOr'\] | Binary, Operator, Bitwise, Or | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitXor'\] | Binary, Operator, Bitwise, Xor | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitAnd'\] | Binary, Operator, Bitwise, And | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='And'\] | Operator, Boolean, And | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Or'\] | Operator, Boolean, Or | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Not'\] | Operator, Boolean, Not | @@ -53,15 +53,15 @@ | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Tuple'\] | Literal, Tuple, Expression | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef'\] | Function, Declaration, Name, Identifier | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef'\] | Function, Declaration, Name, Identifier, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.decorator\_list'\] | Function, Call, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.decorator\_list'\] | Function, Declaration, Call, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='FunctionDef\.body'\] | Function, Declaration, Body | -| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='arguments'\] | Argument, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='args'\] | Argument, Name, Identifier | -| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='vararg'\] | Argument, ArgsList, Name, Identifier | -| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='kwarg'\] | Argument, ArgsList, Map, Name, Identifier | -| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='kwonlyargs'\] | Argument, ArgsList, Map, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='arguments'\] | Function, Declaration, Argument, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='args'\] | Function, Declaration, Argument, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='vararg'\] | Function, Declaration, Argument, ArgsList, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='kwarg'\] | Function, Declaration, Argument, ArgsList, Map, Name, Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='kwonlyargs'\] | Function, Declaration, Argument, ArgsList, Map, Name, Identifier | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='arguments\.defaults'\] | Function, Declaration, Argument, Value, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef\.decorator\_list'\] | Function, Call, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef\.decorator\_list'\] | Function, Declaration, Call, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='AsyncFunctionDef\.body'\] | Function, Declaration, Body | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\] | Function, Declaration, Expression, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Lambda'\]/\*\[@InternalType='Lambda\.body'\] | Function, Declaration, Body | @@ -97,7 +97,7 @@ | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Try'\]/\*\[@InternalType='Try\.orelse'\] | Try, Body, Else | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='TryExcept'\] | Try, Catch, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ExceptHandler'\] | Try, Catch, Statement | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ExceptHandler\.name'\] | Identifier | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ExceptHandler\.name'\] | Try, Catch, Identifier | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='TryFinally'\] | Try, Finally, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Raise'\] | Throw, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='With'\] | Block, Scope, Statement | @@ -160,9 +160,9 @@ | /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='annotation'\] | Comment, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='returns'\] | Comment, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Ellipsis'\] | Identifier, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ListComp'\] | Literal, List, For, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='DictComp'\] | Literal, Map, For, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='SetComp'\] | Literal, Set, For, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ListComp'\] | List, For, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='DictComp'\] | Map, For, Expression, Incomplete | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='SetComp'\] | Set, For, Expression, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\] | For, Iterator, Expression | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@internalRole\]\[@internalRole='iter'\] | For, Update, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@internalRole\]\[@internalRole='target'\] | For, Expression | diff --git a/driver/normalizer/annotation.go b/driver/normalizer/annotation.go index 7711cb43..b29bfcf3 100644 --- a/driver/normalizer/annotation.go +++ b/driver/normalizer/annotation.go @@ -50,33 +50,33 @@ var AnnotationRules = On(Any).Self( ), // Comparison operators - On(pyast.Eq).Roles(uast.Operator, uast.Equal), - On(pyast.NotEq).Roles(uast.Operator, uast.Equal, uast.Not), - On(pyast.Lt).Roles(uast.Operator, uast.LessThan), - On(pyast.LtE).Roles(uast.Operator, uast.LessThanOrEqual), - On(pyast.Gt).Roles(uast.Operator, uast.GreaterThan), - On(pyast.GtE).Roles(uast.Operator, uast.GreaterThanOrEqual), - On(pyast.Is).Roles(uast.Operator, uast.Identical), - On(pyast.IsNot).Roles(uast.Operator, uast.Identical, uast.Not), - On(pyast.In).Roles(uast.Operator, uast.Contains), - On(pyast.NotIn).Roles(uast.Operator, uast.Contains, uast.Not), + On(pyast.Eq).Roles(uast.Binary, uast.Operator, uast.Equal), + On(pyast.NotEq).Roles(uast.Binary, uast.Operator, uast.Equal, uast.Not), + On(pyast.Lt).Roles(uast.Binary, uast.Operator, uast.LessThan), + On(pyast.LtE).Roles(uast.Binary, uast.Operator, uast.LessThanOrEqual), + On(pyast.Gt).Roles(uast.Binary, uast.Operator, uast.GreaterThan), + On(pyast.GtE).Roles(uast.Binary, uast.Operator, uast.GreaterThanOrEqual), + On(pyast.Is).Roles(uast.Binary, uast.Operator, uast.Identical), + On(pyast.IsNot).Roles(uast.Binary, uast.Operator, uast.Identical, uast.Not), + On(pyast.In).Roles(uast.Binary, uast.Operator, uast.Contains), + On(pyast.NotIn).Roles(uast.Binary, uast.Operator, uast.Contains, uast.Not), // Aritmetic operators - On(pyast.Add).Roles(uast.Add), - On(pyast.Sub).Roles(uast.Substract), - On(pyast.Mult).Roles(uast.Multiply), - On(pyast.Div).Roles(uast.Divide), - On(pyast.Mod).Roles(uast.Modulo), - On(pyast.FloorDiv).Roles(uast.Divide, uast.Incomplete), - On(pyast.Pow).Roles(uast.Incomplete), - On(pyast.MatMult).Roles(uast.Multiply, uast.Incomplete), + On(pyast.Add).Roles(uast.Binary, uast.Operator, uast.Add), + On(pyast.Sub).Roles(uast.Binary, uast.Operator, uast.Substract), + On(pyast.Mult).Roles(uast.Binary, uast.Operator, uast.Multiply), + On(pyast.Div).Roles(uast.Binary, uast.Operator, uast.Divide), + On(pyast.Mod).Roles(uast.Binary, uast.Operator, uast.Modulo), + On(pyast.FloorDiv).Roles(uast.Binary, uast.Operator, uast.Divide, uast.Incomplete), + On(pyast.Pow).Roles(uast.Binary, uast.Operator, uast.Incomplete), + On(pyast.MatMult).Roles(uast.Binary, uast.Operator, uast.Multiply, uast.Incomplete), // Bitwise operators - On(pyast.LShift).Roles(uast.Bitwise, uast.LeftShift), - On(pyast.RShift).Roles(uast.Bitwise, uast.RightShift), - On(pyast.BitOr).Roles(uast.Bitwise, uast.Or), - On(pyast.BitXor).Roles(uast.Bitwise, uast.Xor), - On(pyast.BitAnd).Roles(uast.Bitwise, uast.And), + On(pyast.LShift).Roles(uast.Binary, uast.Operator, uast.Bitwise, uast.LeftShift), + On(pyast.RShift).Roles(uast.Binary, uast.Operator, uast.Bitwise, uast.RightShift), + On(pyast.BitOr).Roles(uast.Binary, uast.Operator, uast.Bitwise, uast.Or), + On(pyast.BitXor).Roles(uast.Binary, uast.Operator, uast.Bitwise, uast.Xor), + On(pyast.BitAnd).Roles(uast.Binary, uast.Operator, uast.Bitwise, uast.And), // Boolean operators // Not applying the "Binary" role since even while in the Python code @@ -116,14 +116,14 @@ var AnnotationRules = On(Any).Self( // Type node Token (2 levels up) but the SDK doesn't allow this On(pyast.FunctionDef).Roles(uast.Function, uast.Declaration, uast.Name, uast.Identifier), On(pyast.AsyncFunctionDef).Roles(uast.Function, uast.Declaration, uast.Name, uast.Identifier, uast.Incomplete), - On(pyast.FuncDecorators).Roles(uast.Function, uast.Call, uast.Incomplete), + On(pyast.FuncDecorators).Roles(uast.Function, uast.Declaration, uast.Call, uast.Incomplete), On(pyast.FuncDefBody).Roles(uast.Function, uast.Declaration, uast.Body), // FIXME: arguments is a Groping node, update it we get a "Grouper" or "Container" role - On(HasInternalRole("arguments")).Roles(uast.Argument, uast.Incomplete), - On(HasInternalRole("args")).Roles(uast.Argument, uast.Name, uast.Identifier), - On(HasInternalRole("vararg")).Roles(uast.Argument, uast.ArgsList, uast.Name, uast.Identifier), - On(HasInternalRole("kwarg")).Roles(uast.Argument, uast.ArgsList, uast.Map, uast.Name, uast.Identifier), - On(HasInternalRole("kwonlyargs")).Roles(uast.Argument, uast.ArgsList, uast.Map, uast.Name, uast.Identifier), + On(HasInternalRole("arguments")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.Incomplete), + On(HasInternalRole("args")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.Name, uast.Identifier), + On(HasInternalRole("vararg")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.ArgsList, uast.Name, uast.Identifier), + On(HasInternalRole("kwarg")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.ArgsList, uast.Map, uast.Name, uast.Identifier), + On(HasInternalRole("kwonlyargs")).Roles(uast.Function, uast.Declaration, uast.Argument, uast.ArgsList, uast.Map, uast.Name, uast.Identifier), // Default arguments: Python's AST puts default arguments on a sibling list to the one of // arguments that must be mapped to the arguments right-aligned like: // a, b=2, c=3 -> @@ -131,7 +131,7 @@ var AnnotationRules = On(Any).Self( // defaults [2,3] // TODO: create an issue for the SDK On(pyast.ArgumentDefaults).Roles(uast.Function, uast.Declaration, uast.Argument, uast.Value, uast.Incomplete), - On(pyast.AsyncFuncDecorators).Roles(uast.Function, uast.Call, uast.Incomplete), + On(pyast.AsyncFuncDecorators).Roles(uast.Function, uast.Declaration, uast.Call, uast.Incomplete), On(pyast.AsyncFuncDefBody).Roles(uast.Function, uast.Declaration, uast.Body), // FIXME: change to Function, Declaration, ArgumentS once the PR has been merged On(pyast.Lambda).Roles(uast.Function, uast.Declaration, uast.Expression, uast.Incomplete).Children( @@ -191,7 +191,7 @@ var AnnotationRules = On(Any).Self( ), On(pyast.TryExcept).Roles(uast.Try, uast.Catch, uast.Statement), // py2 On(pyast.ExceptHandler).Roles(uast.Try, uast.Catch, uast.Statement), // py3 - On(pyast.ExceptHandlerName).Roles(uast.Identifier), + On(pyast.ExceptHandlerName).Roles(uast.Try, uast.Catch, uast.Identifier), On(pyast.TryFinally).Roles(uast.Try, uast.Finally, uast.Statement), On(pyast.Raise).Roles(uast.Throw, uast.Statement), // FIXME: review, add path for the body and items childs @@ -300,9 +300,9 @@ var AnnotationRules = On(Any).Self( // uast.List/uast.Map/uast.Set comprehensions. We map the "for x in y" to uast.For, uast.Iterator (foreach) // roles and the "if something" to uast.If* roles. FIXME: missing the top comprehension // roles in the UAST, change once they've been merged - On(pyast.ListComp).Roles(uast.Literal, uast.List, uast.For, uast.Expression, uast.Incomplete), - On(pyast.DictComp).Roles(uast.Literal, uast.Map, uast.For, uast.Expression, uast.Incomplete), - On(pyast.SetComp).Roles(uast.Literal, uast.Set, uast.For, uast.Expression, uast.Incomplete), + On(pyast.ListComp).Roles(uast.List, uast.For, uast.Expression, uast.Incomplete), + On(pyast.DictComp).Roles(uast.Map, uast.For, uast.Expression, uast.Incomplete), + On(pyast.SetComp).Roles(uast.Set, uast.For, uast.Expression, uast.Incomplete), On(pyast.Comprehension).Roles(uast.For, uast.Iterator, uast.Expression).Children( On(HasInternalRole("iter")).Roles(uast.For, uast.Update, uast.Statement), On(HasInternalRole("target")).Roles(uast.For, uast.Expression), diff --git a/tests/annotations.py.uast b/tests/annotations.py.uast index d2d8cee0..1722590d 100644 --- a/tests/annotations.py.uast +++ b/tests/annotations.py.uast @@ -140,7 +140,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -148,7 +148,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 33 @@ -185,7 +185,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "b" . . . . . . . StartPosition: { . . . . . . . . Offset: 41 diff --git a/tests/aritmeticops.py.uast b/tests/aritmeticops.py.uast index 3ec22994..f292df2e 100644 --- a/tests/aritmeticops.py.uast +++ b/tests/aritmeticops.py.uast @@ -61,7 +61,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Add { -. . . . . . . Roles: Expression,Binary,Operator,Add +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Add . . . . . . . TOKEN "+" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -128,7 +128,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Sub { -. . . . . . . Roles: Expression,Binary,Operator,Substract +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Substract . . . . . . . TOKEN "-" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -195,7 +195,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Mult { -. . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Multiply . . . . . . . TOKEN "*" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -262,7 +262,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Div { -. . . . . . . Roles: Expression,Binary,Operator,Divide +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Divide . . . . . . . TOKEN "/" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -329,7 +329,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: FloorDiv { -. . . . . . . Roles: Expression,Binary,Operator,Divide,Incomplete +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Divide,Incomplete . . . . . . . TOKEN "//" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -396,7 +396,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Mod { -. . . . . . . Roles: Expression,Binary,Operator,Modulo +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Modulo . . . . . . . TOKEN "%%" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -463,7 +463,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Pow { -. . . . . . . Roles: Expression,Binary,Operator,Incomplete +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Incomplete . . . . . . . TOKEN "**" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/augassign.py.uast b/tests/augassign.py.uast index 1db7f084..26198077 100644 --- a/tests/augassign.py.uast +++ b/tests/augassign.py.uast @@ -57,7 +57,7 @@ Module { . . . . . } . . . . } . . . . 2: Add { -. . . . . Roles: Add,Operator,Binary +. . . . . Roles: Binary,Operator,Add,Operator,Binary . . . . . TOKEN "+" . . . . . Properties: { . . . . . . internalRole: op @@ -113,7 +113,7 @@ Module { . . . . . } . . . . } . . . . 2: Sub { -. . . . . Roles: Substract,Operator,Binary +. . . . . Roles: Binary,Operator,Substract,Operator,Binary . . . . . TOKEN "-" . . . . . Properties: { . . . . . . internalRole: op @@ -169,7 +169,7 @@ Module { . . . . . } . . . . } . . . . 2: Mult { -. . . . . Roles: Multiply,Operator,Binary +. . . . . Roles: Binary,Operator,Multiply,Operator,Binary . . . . . TOKEN "*" . . . . . Properties: { . . . . . . internalRole: op @@ -225,7 +225,7 @@ Module { . . . . . } . . . . } . . . . 2: Div { -. . . . . Roles: Divide,Operator,Binary +. . . . . Roles: Binary,Operator,Divide,Operator,Binary . . . . . TOKEN "/" . . . . . Properties: { . . . . . . internalRole: op diff --git a/tests/bitwise.py.uast b/tests/bitwise.py.uast index 75155643..c03d7ac4 100644 --- a/tests/bitwise.py.uast +++ b/tests/bitwise.py.uast @@ -61,7 +61,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitAnd { -. . . . . . . Roles: Expression,Binary,Operator,Bitwise,And +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,And . . . . . . . TOKEN "&" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -128,7 +128,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitOr { -. . . . . . . Roles: Expression,Binary,Operator,Bitwise,Or +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,Or . . . . . . . TOKEN "|" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -195,7 +195,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitXor { -. . . . . . . Roles: Expression,Binary,Operator,Bitwise,Xor +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,Xor . . . . . . . TOKEN "^" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -262,7 +262,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: LShift { -. . . . . . . Roles: Expression,Binary,Operator,Bitwise,LeftShift +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,LeftShift . . . . . . . TOKEN "<<" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -329,7 +329,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: RShift { -. . . . . . . Roles: Expression,Binary,Operator,Bitwise,RightShift +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,RightShift . . . . . . . TOKEN ">>" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -418,7 +418,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: BitAnd { -. . . . . . . . . . . Roles: Expression,Binary,Operator,Bitwise,And +. . . . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,And . . . . . . . . . . . TOKEN "&" . . . . . . . . . . . Properties: { . . . . . . . . . . . . internalRole: op @@ -444,7 +444,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: BitAnd { -. . . . . . . . . Roles: Expression,Binary,Operator,Bitwise,And +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,And . . . . . . . . . TOKEN "&" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -470,7 +470,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitOr { -. . . . . . . Roles: Expression,Binary,Operator,Bitwise,Or +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,Or . . . . . . . TOKEN "|" . . . . . . . Properties: { . . . . . . . . internalRole: op @@ -549,7 +549,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: Expression,Binary,Operator,Add +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Add . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -604,7 +604,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: Expression,Binary,Operator,Add +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Add . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -613,7 +613,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: BitOr { -. . . . . . . Roles: Expression,Binary,Operator,Bitwise,Or +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Bitwise,Or . . . . . . . TOKEN "|" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/classdef.py.uast b/tests/classdef.py.uast index af49e461..00c18e7b 100644 --- a/tests/classdef.py.uast +++ b/tests/classdef.py.uast @@ -45,7 +45,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -53,7 +53,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 31 @@ -210,7 +210,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -218,7 +218,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 88 @@ -269,7 +269,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "arg1" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 94 @@ -420,7 +420,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: FunctionDef.decorator_list { -. . . . . . . . . Roles: Function,Call,Incomplete +. . . . . . . . . Roles: Function,Declaration,Call,Incomplete . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } @@ -445,7 +445,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: arguments { -. . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -467,7 +467,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -475,7 +475,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "newa" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 190 @@ -602,7 +602,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: FunctionDef.decorator_list { -. . . . . . . . . Roles: Function,Call,Incomplete +. . . . . . . . . Roles: Function,Declaration,Call,Incomplete . . . . . . . . . Properties: { . . . . . . . . . . promotedPropertyList: true . . . . . . . . . } @@ -1006,7 +1006,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,Number,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "5" . . . . . . . StartPosition: { . . . . . . . . Offset: 269 diff --git a/tests/comparisonop.py.uast b/tests/comparisonop.py.uast index 421fd2d7..49ff8ac7 100644 --- a/tests/comparisonop.py.uast +++ b/tests/comparisonop.py.uast @@ -72,7 +72,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Eq { -. . . . . . . . . Roles: Operator,Equal +. . . . . . . . . Roles: Binary,Operator,Equal . . . . . . . . . TOKEN "==" . . . . . . . . } . . . . . . . } @@ -149,7 +149,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: NotEq { -. . . . . . . . . Roles: Operator,Equal,Not +. . . . . . . . . Roles: Binary,Operator,Equal,Not . . . . . . . . . TOKEN "!=" . . . . . . . . } . . . . . . . } @@ -290,11 +290,11 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Eq { -. . . . . . . . . Roles: Operator,Equal +. . . . . . . . . Roles: Binary,Operator,Equal . . . . . . . . . TOKEN "==" . . . . . . . . } . . . . . . . . 1: Eq { -. . . . . . . . . Roles: Operator,Equal +. . . . . . . . . Roles: Binary,Operator,Equal . . . . . . . . . TOKEN "==" . . . . . . . . } . . . . . . . } @@ -385,11 +385,11 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Lt { -. . . . . . . . . Roles: Operator,LessThan +. . . . . . . . . Roles: Binary,Operator,LessThan . . . . . . . . . TOKEN "<" . . . . . . . . } . . . . . . . . 1: Gt { -. . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } @@ -480,11 +480,11 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Lt { -. . . . . . . . . Roles: Operator,LessThan +. . . . . . . . . Roles: Binary,Operator,LessThan . . . . . . . . . TOKEN "<" . . . . . . . . } . . . . . . . . 1: NotEq { -. . . . . . . . . Roles: Operator,Equal,Not +. . . . . . . . . Roles: Binary,Operator,Equal,Not . . . . . . . . . TOKEN "!=" . . . . . . . . } . . . . . . . } diff --git a/tests/complex.py.uast b/tests/complex.py.uast index 7e1a36cf..2cf997a5 100644 --- a/tests/complex.py.uast +++ b/tests/complex.py.uast @@ -87,7 +87,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Mult { -. . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Multiply . . . . . . . TOKEN "*" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/comprehension_dict.py.uast b/tests/comprehension_dict.py.uast index ab172a44..a6fda731 100644 --- a/tests/comprehension_dict.py.uast +++ b/tests/comprehension_dict.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: DictComp { -. . . . . Roles: Literal,Map,For,Expression,Incomplete +. . . . . Roles: Map,For,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -91,7 +91,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Gt { -. . . . . . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . . . . . TOKEN ">" . . . . . . . . . . . . } . . . . . . . . . . . } @@ -201,7 +201,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Mult { -. . . . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Multiply . . . . . . . . . TOKEN "*" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op diff --git a/tests/comprehension_list.py.uast b/tests/comprehension_list.py.uast index 6d4f897d..c16928f7 100644 --- a/tests/comprehension_list.py.uast +++ b/tests/comprehension_list.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: ListComp { -. . . . . Roles: Literal,List,For,Expression,Incomplete +. . . . . Roles: List,For,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 1 . . . . . . Line: 1 @@ -73,7 +73,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Mult { -. . . . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Multiply . . . . . . . . . TOKEN "*" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -146,7 +146,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Gt { -. . . . . . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . . . . . TOKEN ">" . . . . . . . . . . . . } . . . . . . . . . . . } @@ -207,7 +207,7 @@ Module { . . . } . . . Children: { . . . . 0: ListComp { -. . . . . Roles: Literal,List,For,Expression,Incomplete +. . . . . Roles: List,For,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 32 . . . . . . Line: 2 @@ -264,7 +264,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Mult { -. . . . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Multiply . . . . . . . . . TOKEN "*" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op diff --git a/tests/comprehension_set.py.uast b/tests/comprehension_set.py.uast index 7430e123..b01dae98 100644 --- a/tests/comprehension_set.py.uast +++ b/tests/comprehension_set.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: SetComp { -. . . . . Roles: Literal,Set,For,Expression,Incomplete +. . . . . Roles: Set,For,Expression,Incomplete . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -73,7 +73,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Mult { -. . . . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Multiply . . . . . . . . . TOKEN "*" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -146,7 +146,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Gt { -. . . . . . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . . . . . TOKEN ">" . . . . . . . . . . . . } . . . . . . . . . . . } diff --git a/tests/continue_break.py.uast b/tests/continue_break.py.uast index 0d2cbe32..da9fbf4a 100644 --- a/tests/continue_break.py.uast +++ b/tests/continue_break.py.uast @@ -121,7 +121,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Eq { -. . . . . . . . . . . . . Roles: Operator,Equal +. . . . . . . . . . . . . Roles: Binary,Operator,Equal . . . . . . . . . . . . . TOKEN "==" . . . . . . . . . . . . } . . . . . . . . . . . } @@ -224,7 +224,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Eq { -. . . . . . . . . . . . . Roles: Operator,Equal +. . . . . . . . . . . . . Roles: Binary,Operator,Equal . . . . . . . . . . . . . TOKEN "==" . . . . . . . . . . . . } . . . . . . . . . . . } diff --git a/tests/except.py.uast b/tests/except.py.uast index 9245a640..8e98ddcf 100644 --- a/tests/except.py.uast +++ b/tests/except.py.uast @@ -100,7 +100,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "gogogo" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 35 @@ -166,7 +166,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "here we are" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 153 @@ -246,7 +246,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "someexception catched" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 82 @@ -303,7 +303,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: ExceptHandler.name { -. . . . . . . Roles: Identifier +. . . . . . . Roles: Try,Catch,Identifier . . . . . . . TOKEN "e" . . . . . . . Properties: { . . . . . . . . promotedPropertyString: true @@ -347,7 +347,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "ayyyy" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 125 diff --git a/tests/exec.py.uast b/tests/exec.py.uast index c0b4b847..eb76529b 100644 --- a/tests/exec.py.uast +++ b/tests/exec.py.uast @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "print 1" . . . . . . . StartPosition: { . . . . . . . . Offset: 5 diff --git a/tests/for.py.uast b/tests/for.py.uast index 695e906b..fabfb2e7 100644 --- a/tests/for.py.uast +++ b/tests/for.py.uast @@ -77,7 +77,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: Add,Operator,Binary +. . . . . . . . . Roles: Binary,Operator,Add,Operator,Binary . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -105,7 +105,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . TOKEN "i" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 39 diff --git a/tests/functioncalls.py.uast b/tests/functioncalls.py.uast index 590f4a1d..1d85c5b9 100644 --- a/tests/functioncalls.py.uast +++ b/tests/functioncalls.py.uast @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "something1" . . . . . . . StartPosition: { . . . . . . . . Offset: 11 @@ -44,7 +44,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,Number,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "42" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 @@ -61,7 +61,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Name { -. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "somesymbbol" . . . . . . . StartPosition: { . . . . . . . . Offset: 29 @@ -123,7 +123,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "something" . . . . . . . StartPosition: { . . . . . . . . Offset: 58 @@ -140,7 +140,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Num { -. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,Number,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "42" . . . . . . . StartPosition: { . . . . . . . . Offset: 71 @@ -157,7 +157,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Name { -. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "somesymbol" . . . . . . . StartPosition: { . . . . . . . . Offset: 75 @@ -239,7 +239,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 95 @@ -353,7 +353,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 123 @@ -371,7 +371,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Starred { -. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . StartPosition: { . . . . . . . . Offset: 126 . . . . . . . . Line: 4 @@ -447,7 +447,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Name { -. . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . TOKEN "a" . . . . . . . StartPosition: { . . . . . . . . Offset: 155 diff --git a/tests/functiondef_annotated.py.uast b/tests/functiondef_annotated.py.uast index 43ec81b7..234a6fa0 100644 --- a/tests/functiondef_annotated.py.uast +++ b/tests/functiondef_annotated.py.uast @@ -22,7 +22,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -30,7 +30,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -67,7 +67,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 24 @@ -104,7 +104,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg3" . . . . . . . StartPosition: { . . . . . . . . Offset: 35 diff --git a/tests/functiondef_decorated.py.uast b/tests/functiondef_decorated.py.uast index 0f972d6c..23aa239f 100644 --- a/tests/functiondef_decorated.py.uast +++ b/tests/functiondef_decorated.py.uast @@ -43,7 +43,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.decorator_list { -. . . . . Roles: Function,Call,Incomplete +. . . . . Roles: Function,Declaration,Call,Incomplete . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -68,7 +68,7 @@ Module { . . . . . } . . . . } . . . . 2: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -149,7 +149,7 @@ Module { . . . . . } . . . . } . . . . 1: FunctionDef.decorator_list { -. . . . . Roles: Function,Call,Incomplete +. . . . . Roles: Function,Declaration,Call,Incomplete . . . . . Properties: { . . . . . . promotedPropertyList: true . . . . . } @@ -163,7 +163,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Num { -. . . . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . Roles: Literal,Number,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . TOKEN "1" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 64 @@ -180,7 +180,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 1: Num { -. . . . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . Roles: Literal,Number,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . TOKEN "2" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 67 @@ -197,7 +197,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Num { -. . . . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . Roles: Literal,Number,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . TOKEN "3" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 70 @@ -236,7 +236,7 @@ Module { . . . . . } . . . . } . . . . 2: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: diff --git a/tests/functiondef_defaultparams.py.uast b/tests/functiondef_defaultparams.py.uast index 6a450b47..fa19884b 100644 --- a/tests/functiondef_defaultparams.py.uast +++ b/tests/functiondef_defaultparams.py.uast @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -31,7 +31,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -49,7 +49,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -67,7 +67,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg3" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 @@ -85,7 +85,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg4" . . . . . . . StartPosition: { . . . . . . . . Offset: 33 @@ -103,7 +103,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 4: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg5" . . . . . . . StartPosition: { . . . . . . . . Offset: 50 @@ -218,7 +218,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -242,7 +242,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,ArgsList,Map,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,ArgsList,Map,Name,Identifier . . . . . . . TOKEN "thing" . . . . . . . StartPosition: { . . . . . . . . Offset: 86 @@ -260,7 +260,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: Argument,ArgsList,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,ArgsList,Name,Identifier . . . . . . . TOKEN "ignore" . . . . . . . StartPosition: { . . . . . . . . Offset: 78 diff --git a/tests/functiondef_docstring.py.uast b/tests/functiondef_docstring.py.uast index 20b638aa..2d88fb42 100644 --- a/tests/functiondef_docstring.py.uast +++ b/tests/functiondef_docstring.py.uast @@ -91,7 +91,7 @@ Module { . . . . . } . . . . } . . . . 1: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: diff --git a/tests/functiondef_kwarg.py.uast b/tests/functiondef_kwarg.py.uast index dc693f0c..c01b5b12 100644 --- a/tests/functiondef_kwarg.py.uast +++ b/tests/functiondef_kwarg.py.uast @@ -23,14 +23,14 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . vararg: . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -48,7 +48,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -66,7 +66,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: Argument,ArgsList,Map,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,ArgsList,Map,Name,Identifier . . . . . . . TOKEN "kwparameters" . . . . . . . StartPosition: { . . . . . . . . Offset: 27 @@ -128,13 +128,13 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 71 @@ -185,7 +185,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 77 @@ -203,7 +203,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: Argument,ArgsList,Map,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,ArgsList,Map,Name,Identifier . . . . . . . TOKEN "kwparameters2" . . . . . . . StartPosition: { . . . . . . . . Offset: 95 @@ -221,7 +221,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 3: arg { -. . . . . . . Roles: Argument,ArgsList,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,ArgsList,Name,Identifier . . . . . . . TOKEN "varargs" . . . . . . . StartPosition: { . . . . . . . . Offset: 84 diff --git a/tests/functiondef_simple.py.uast b/tests/functiondef_simple.py.uast index 580fef73..95c389a6 100644 --- a/tests/functiondef_simple.py.uast +++ b/tests/functiondef_simple.py.uast @@ -23,7 +23,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -31,7 +31,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -49,7 +49,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -67,7 +67,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg3" . . . . . . . StartPosition: { . . . . . . . . Offset: 25 @@ -163,7 +163,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -171,7 +171,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "n1" . . . . . . . StartPosition: { . . . . . . . . Offset: 70 @@ -222,7 +222,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "n2" . . . . . . . StartPosition: { . . . . . . . . Offset: 74 @@ -240,7 +240,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "n3" . . . . . . . StartPosition: { . . . . . . . . Offset: 78 @@ -385,7 +385,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -393,7 +393,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 125 diff --git a/tests/functiondef_vararg.py.uast b/tests/functiondef_vararg.py.uast index 70801b1f..0cb06c1e 100644 --- a/tests/functiondef_vararg.py.uast +++ b/tests/functiondef_vararg.py.uast @@ -23,14 +23,14 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg1" . . . . . . . StartPosition: { . . . . . . . . Offset: 13 @@ -48,7 +48,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "arg2" . . . . . . . StartPosition: { . . . . . . . . Offset: 19 @@ -66,7 +66,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: arg { -. . . . . . . Roles: Argument,ArgsList,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,ArgsList,Name,Identifier . . . . . . . TOKEN "otherargs" . . . . . . . StartPosition: { . . . . . . . . Offset: 26 diff --git a/tests/hello.py.uast b/tests/hello.py.uast index f885f8ab..5d74d177 100644 --- a/tests/hello.py.uast +++ b/tests/hello.py.uast @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "hello world" . . . . . . . StartPosition: { . . . . . . . . Offset: 6 diff --git a/tests/if.py.uast b/tests/if.py.uast index 04273b0b..9a74617d 100644 --- a/tests/if.py.uast +++ b/tests/if.py.uast @@ -47,7 +47,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: BoolLiteral { -. . . . . . . . . . . Roles: Literal,Boolean,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,Boolean,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "true" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 19 @@ -151,7 +151,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: BoolLiteral { -. . . . . . . . . . . Roles: Literal,Boolean,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,Boolean,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "true" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 55 @@ -645,7 +645,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Eq { -. . . . . . . . . . . . . Roles: Operator,Equal +. . . . . . . . . . . . . Roles: Binary,Operator,Equal . . . . . . . . . . . . . TOKEN "==" . . . . . . . . . . . . } . . . . . . . . . . . } @@ -750,7 +750,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Gt { -. . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } @@ -926,15 +926,15 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Gt { -. . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . . 1: Gt { -. . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . . 2: Gt { -. . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } diff --git a/tests/ifexpression.py.uast b/tests/ifexpression.py.uast index 049098b6..f57ff076 100644 --- a/tests/ifexpression.py.uast +++ b/tests/ifexpression.py.uast @@ -135,7 +135,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Gt { -. . . . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . . . TOKEN ">" . . . . . . . . . . } . . . . . . . . . } diff --git a/tests/issue30.py.uast b/tests/issue30.py.uast index a29780bf..59325ffa 100644 --- a/tests/issue30.py.uast +++ b/tests/issue30.py.uast @@ -48,7 +48,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "Hello world! " . . . . . . . StartPosition: { diff --git a/tests/issue62_b.py.uast b/tests/issue62_b.py.uast index 99cc7f23..d919948b 100644 --- a/tests/issue62_b.py.uast +++ b/tests/issue62_b.py.uast @@ -435,7 +435,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -443,7 +443,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 343 @@ -494,7 +494,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "root" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 349 @@ -512,7 +512,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 355 @@ -687,7 +687,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . 2: Add { -. . . . . . . . . . . . . . . . . . . . . Roles: Add,Operator,Binary +. . . . . . . . . . . . . . . . . . . . . Roles: Binary,Operator,Add,Operator,Binary . . . . . . . . . . . . . . . . . . . . . TOKEN "+" . . . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . . . internalRole: op @@ -778,7 +778,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . 0: In { -. . . . . . . . . . . . . . . . . . . . . Roles: Operator,Contains +. . . . . . . . . . . . . . . . . . . . . Roles: Binary,Operator,Contains . . . . . . . . . . . . . . . . . . . . . TOKEN "in" . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . } @@ -807,7 +807,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "ch" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 513 @@ -825,7 +825,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 517 @@ -966,7 +966,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arguments { -. . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . Properties: { . . . . . . . . . . internalRole: args . . . . . . . . . . kwarg: @@ -974,7 +974,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "self" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 548 @@ -1025,7 +1025,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: arg { -. . . . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . . . TOKEN "file_uast_generator" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 554 @@ -1090,7 +1090,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: BinOp { -. . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 655 . . . . . . . . . . . . . . . . . . . . Line: 25 @@ -1157,7 +1157,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . . . 2: Mult { -. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Multiply . . . . . . . . . . . . . . . . . . . . . . . . . TOKEN "*" . . . . . . . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . . . . . . . internalRole: op @@ -1183,7 +1183,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . . 2: Add { -. . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Add +. . . . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Add . . . . . . . . . . . . . . . . . . . . . . . TOKEN "+" . . . . . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . . . . . internalRole: op @@ -1203,7 +1203,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional +. . . . . . . . . . . . . . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional . . . . . . . . . . . . . . . . . . . . . . . TOKEN "filepath" . . . . . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . . . . . Offset: 671 @@ -1261,7 +1261,7 @@ Module { . . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . . . 2: Add { -. . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Add +. . . . . . . . . . . . . . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Add . . . . . . . . . . . . . . . . . . . . . TOKEN "+" . . . . . . . . . . . . . . . . . . . . . Properties: { . . . . . . . . . . . . . . . . . . . . . . internalRole: op @@ -1370,7 +1370,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional +. . . . . . . . . . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional . . . . . . . . . . . . . . . . . . . TOKEN "uast" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 764 @@ -1428,7 +1428,7 @@ Module { . . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . . 1: Name { -. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 770 @@ -1507,7 +1507,7 @@ Module { . . . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . . . . . . . TOKEN "id_cnt" . . . . . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . . . . . Offset: 796 @@ -1793,7 +1793,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Name { -. . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . TOKEN "repo" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 969 @@ -1958,7 +1958,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Eq { -. . . . . . . . . Roles: Operator,Equal +. . . . . . . . . Roles: Binary,Operator,Equal . . . . . . . . . TOKEN "==" . . . . . . . . } . . . . . . . } diff --git a/tests/issue76.py.uast b/tests/issue76.py.uast index 34378c3e..949f0ff3 100644 --- a/tests/issue76.py.uast +++ b/tests/issue76.py.uast @@ -47,7 +47,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Call { -. . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Function,Call,Expression +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Function,Call,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 81 . . . . . . . . . . . . Line: 2 @@ -58,7 +58,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Name { -. . . . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . . . . . TOKEN "chosen_words" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 91 @@ -180,7 +180,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Call { -. . . . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Function,Call,Expression +. . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Function,Call,Expression . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 10 . . . . . . . . . . . . Line: 1 @@ -191,7 +191,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: Attribute { -. . . . . . . . . . . . . Roles: Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional +. . . . . . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Identifier,Expression,Call,Argument,Positional . . . . . . . . . . . . . TOKEN "output" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 28 @@ -229,7 +229,7 @@ Module { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: Str { -. . . . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . . . TOKEN "row_vocab.txt" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 36 @@ -306,7 +306,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: Str { -. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "w" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 54 diff --git a/tests/lambda.py.uast b/tests/lambda.py.uast index de4e9b26..40304ef9 100644 --- a/tests/lambda.py.uast +++ b/tests/lambda.py.uast @@ -32,7 +32,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arguments { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . Properties: { . . . . . . . . internalRole: args . . . . . . . . kwarg: @@ -40,7 +40,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: arg { -. . . . . . . . . Roles: Argument,Name,Identifier +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . . . TOKEN "x" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 7 @@ -106,7 +106,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: Expression,Binary,Operator,Add +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Add . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op diff --git a/tests/literals_assign.py.uast b/tests/literals_assign.py.uast index 5ab7a98d..a0732333 100644 --- a/tests/literals_assign.py.uast +++ b/tests/literals_assign.py.uast @@ -855,7 +855,7 @@ Module { . . . . . . . . . } . . . . . . . . } . . . . . . . . 2: Add { -. . . . . . . . . Roles: Expression,Binary,Operator,Add +. . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Add . . . . . . . . . TOKEN "+" . . . . . . . . . Properties: { . . . . . . . . . . internalRole: op @@ -875,7 +875,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Name { -. . . . . . . . . Roles: Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression +. . . . . . . . . Roles: Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional,Identifier,Expression . . . . . . . . . TOKEN "d" . . . . . . . . . StartPosition: { . . . . . . . . . . Offset: 210 @@ -913,7 +913,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Sub { -. . . . . . . Roles: Expression,Binary,Operator,Substract +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Substract . . . . . . . TOKEN "-" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/loop_if.py.uast b/tests/loop_if.py.uast index 17b3bf07..1b2ee87c 100644 --- a/tests/loop_if.py.uast +++ b/tests/loop_if.py.uast @@ -87,7 +87,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "Python fors have elses" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 45 diff --git a/tests/other_statements.py.uast b/tests/other_statements.py.uast index cac02c13..dbded4cc 100644 --- a/tests/other_statements.py.uast +++ b/tests/other_statements.py.uast @@ -277,7 +277,7 @@ Module { . . . . . } . . . . } . . . . 1: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: diff --git a/tests/pass.py.uast b/tests/pass.py.uast index 74663d9f..4fba0def 100644 --- a/tests/pass.py.uast +++ b/tests/pass.py.uast @@ -114,7 +114,7 @@ Module { . . . . . } . . . . } . . . . 1: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -197,7 +197,7 @@ Module { . . . . . } . . . . } . . . . 1: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: diff --git a/tests/repr.py.uast b/tests/repr.py.uast index fc44dd67..eb60d4fa 100644 --- a/tests/repr.py.uast +++ b/tests/repr.py.uast @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Num { -. . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,Number,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "1" . . . . . . . StartPosition: { . . . . . . . . Offset: 5 diff --git a/tests/sameline.py.uast b/tests/sameline.py.uast index 728add1f..fd53e10e 100644 --- a/tests/sameline.py.uast +++ b/tests/sameline.py.uast @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "same line test" . . . . . . . StartPosition: { . . . . . . . . Offset: 6 @@ -88,7 +88,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: Str { -. . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . TOKEN "another call" . . . . . . . StartPosition: { . . . . . . . . Offset: 31 diff --git a/tests/sorting.py.uast b/tests/sorting.py.uast index bcd66d14..904a7bba 100644 --- a/tests/sorting.py.uast +++ b/tests/sorting.py.uast @@ -111,7 +111,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: Add { -. . . . . . . Roles: Expression,Binary,Operator,Add +. . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Add . . . . . . . TOKEN "+" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/string_fstring.py.uast b/tests/string_fstring.py.uast index 97b27266..67b2b1e8 100644 --- a/tests/string_fstring.py.uast +++ b/tests/string_fstring.py.uast @@ -643,7 +643,7 @@ Module { . . . } . . . Children: { . . . . 0: arguments { -. . . . . Roles: Argument,Name,Identifier +. . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . Properties: { . . . . . . internalRole: args . . . . . . kwarg: @@ -651,7 +651,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: arg { -. . . . . . . Roles: Argument,Name,Identifier +. . . . . . . Roles: Function,Declaration,Argument,Name,Identifier . . . . . . . TOKEN "i" . . . . . . . StartPosition: { . . . . . . . . Offset: 264 @@ -770,7 +770,7 @@ Module { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 2: Mult { -. . . . . . . . . . . Roles: Expression,Binary,Operator,Multiply +. . . . . . . . . . . Roles: Expression,Binary,Operator,Binary,Operator,Multiply . . . . . . . . . . . TOKEN "*" . . . . . . . . . . . Properties: { . . . . . . . . . . . . internalRole: op @@ -848,7 +848,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Num { -. . . . . . . . . . . Roles: Literal,Number,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,Number,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "10" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 0 diff --git a/tests/test.py.uast b/tests/test.py.uast index 975931f7..48d220a2 100644 --- a/tests/test.py.uast +++ b/tests/test.py.uast @@ -100,7 +100,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Gt { -. . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } diff --git a/tests/while.py.uast b/tests/while.py.uast index 1db2c137..43298afe 100644 --- a/tests/while.py.uast +++ b/tests/while.py.uast @@ -47,7 +47,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "surely here" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 23 @@ -127,7 +127,7 @@ Module { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: Str { -. . . . . . . . . . . Roles: Literal,String,Expression,Argument,Name,Identifier,Call,Argument,Positional +. . . . . . . . . . . Roles: Literal,String,Expression,Function,Declaration,Argument,Name,Identifier,Call,Argument,Positional . . . . . . . . . . . TOKEN "while's else" . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 64 @@ -224,7 +224,7 @@ Module { . . . . . . . } . . . . . . . Children: { . . . . . . . . 0: Gt { -. . . . . . . . . Roles: Operator,GreaterThan +. . . . . . . . . Roles: Binary,Operator,GreaterThan . . . . . . . . . TOKEN ">" . . . . . . . . } . . . . . . . } From a28480f2c357cc70822f0a1f1b0b1e27e0afdf98 Mon Sep 17 00:00:00 2001 From: Juanjo Alvarez Date: Mon, 18 Sep 2017 12:20:31 +0200 Subject: [PATCH 3/3] Added Binary(ish) role to the Boolean operators, move Comprehensions incomplete to the inner node --- ANNOTATION.md | 16 ++++++++-------- driver/normalizer/annotation.go | 16 ++++++++-------- tests/comparisonop.py.uast | 4 ++-- tests/comprehension_dict.py.uast | 4 ++-- tests/comprehension_list.py.uast | 10 +++++----- tests/comprehension_set.py.uast | 4 ++-- tests/unary.py.uast | 6 +++--- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ANNOTATION.md b/ANNOTATION.md index ecbcf450..6a34a71f 100644 --- a/ANNOTATION.md +++ b/ANNOTATION.md @@ -29,10 +29,10 @@ | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitOr'\] | Binary, Operator, Bitwise, Or | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitXor'\] | Binary, Operator, Bitwise, Xor | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='BitAnd'\] | Binary, Operator, Bitwise, And | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='And'\] | Operator, Boolean, And | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Or'\] | Operator, Boolean, Or | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Not'\] | Operator, Boolean, Not | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='UnaryOp'\] | Operator, Unary, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='And'\] | Binary, Operator, Boolean, And | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Or'\] | Binary, Operator, Boolean, Or | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Not'\] | Binary, Operator, Boolean, Not | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='UnaryOp'\] | Binary, Operator, Unary, Expression | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Invert'\] | Operator, Unary, Bitwise, Not | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='UAdd'\] | Operator, Unary, Positive | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='USub'\] | Operator, Unary, Negative | @@ -160,10 +160,10 @@ | /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='annotation'\] | Comment, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@internalRole\]\[@internalRole='returns'\] | Comment, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='Ellipsis'\] | Identifier, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ListComp'\] | List, For, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='DictComp'\] | Map, For, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='SetComp'\] | Set, For, Expression, Incomplete | -| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\] | For, Iterator, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='ListComp'\] | List, For, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='DictComp'\] | Map, For, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='SetComp'\] | Set, For, Expression | +| /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\] | For, Iterator, Expression, Incomplete | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@internalRole\]\[@internalRole='iter'\] | For, Update, Statement | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@internalRole\]\[@internalRole='target'\] | For, Expression | | /self::\*\[@InternalType='Module'\]//\*\[@InternalType='comprehension'\]/\*\[@InternalType='Compare'\] | If, Condition, Expression, Binary | diff --git a/driver/normalizer/annotation.go b/driver/normalizer/annotation.go index b29bfcf3..c107dd92 100644 --- a/driver/normalizer/annotation.go +++ b/driver/normalizer/annotation.go @@ -82,10 +82,10 @@ var AnnotationRules = On(Any).Self( // Not applying the "Binary" role since even while in the Python code // boolean operators use (seemingly binary) infix notation, the generated // AST nodes use prefix. - On(pyast.And).Roles(uast.Operator, uast.Boolean, uast.And), - On(pyast.Or).Roles(uast.Operator, uast.Boolean, uast.Or), - On(pyast.Not).Roles(uast.Operator, uast.Boolean, uast.Not), - On(pyast.UnaryOp).Roles(uast.Operator, uast.Unary, uast.Expression), + On(pyast.And).Roles(uast.Binary, uast.Operator, uast.Boolean, uast.And), + On(pyast.Or).Roles(uast.Binary, uast.Operator, uast.Boolean, uast.Or), + On(pyast.Not).Roles(uast.Binary, uast.Operator, uast.Boolean, uast.Not), + On(pyast.UnaryOp).Roles(uast.Binary, uast.Operator, uast.Unary, uast.Expression), // Unary operators On(pyast.Invert).Roles(uast.Operator, uast.Unary, uast.Bitwise, uast.Not), @@ -300,10 +300,10 @@ var AnnotationRules = On(Any).Self( // uast.List/uast.Map/uast.Set comprehensions. We map the "for x in y" to uast.For, uast.Iterator (foreach) // roles and the "if something" to uast.If* roles. FIXME: missing the top comprehension // roles in the UAST, change once they've been merged - On(pyast.ListComp).Roles(uast.List, uast.For, uast.Expression, uast.Incomplete), - On(pyast.DictComp).Roles(uast.Map, uast.For, uast.Expression, uast.Incomplete), - On(pyast.SetComp).Roles(uast.Set, uast.For, uast.Expression, uast.Incomplete), - On(pyast.Comprehension).Roles(uast.For, uast.Iterator, uast.Expression).Children( + On(pyast.ListComp).Roles(uast.List, uast.For, uast.Expression), + On(pyast.DictComp).Roles(uast.Map, uast.For, uast.Expression), + On(pyast.SetComp).Roles(uast.Set, uast.For, uast.Expression), + On(pyast.Comprehension).Roles(uast.For, uast.Iterator, uast.Expression, uast.Incomplete).Children( On(HasInternalRole("iter")).Roles(uast.For, uast.Update, uast.Statement), On(HasInternalRole("target")).Roles(uast.For, uast.Expression), // FIXME: see the comment on uast.If, uast.Condition above diff --git a/tests/comparisonop.py.uast b/tests/comparisonop.py.uast index 49ff8ac7..687cfbb6 100644 --- a/tests/comparisonop.py.uast +++ b/tests/comparisonop.py.uast @@ -170,7 +170,7 @@ Module { . . . } . . . Children: { . . . . 0: UnaryOp { -. . . . . Roles: Operator,Unary,Expression +. . . . . Roles: Binary,Operator,Unary,Expression . . . . . StartPosition: { . . . . . . Offset: 14 . . . . . . Line: 3 @@ -198,7 +198,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: Not { -. . . . . . . Roles: Operator,Boolean,Not +. . . . . . . Roles: Binary,Operator,Boolean,Not . . . . . . . TOKEN "!" . . . . . . . Properties: { . . . . . . . . internalRole: op diff --git a/tests/comprehension_dict.py.uast b/tests/comprehension_dict.py.uast index a6fda731..dc1f66f2 100644 --- a/tests/comprehension_dict.py.uast +++ b/tests/comprehension_dict.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: DictComp { -. . . . . Roles: Map,For,Expression,Incomplete +. . . . . Roles: Map,For,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -27,7 +27,7 @@ Module { . . . . . } . . . . . Children: { . . . . . . 0: comprehension { -. . . . . . . Roles: For,Iterator,Expression +. . . . . . . Roles: For,Iterator,Expression,Incomplete . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 diff --git a/tests/comprehension_list.py.uast b/tests/comprehension_list.py.uast index c16928f7..25eada85 100644 --- a/tests/comprehension_list.py.uast +++ b/tests/comprehension_list.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: ListComp { -. . . . . Roles: List,For,Expression,Incomplete +. . . . . Roles: List,For,Expression . . . . . StartPosition: { . . . . . . Offset: 1 . . . . . . Line: 1 @@ -82,7 +82,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: comprehension { -. . . . . . . Roles: For,Iterator,Expression +. . . . . . . Roles: For,Iterator,Expression,Incomplete . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 @@ -207,7 +207,7 @@ Module { . . . } . . . Children: { . . . . 0: ListComp { -. . . . . Roles: List,For,Expression,Incomplete +. . . . . Roles: List,For,Expression . . . . . StartPosition: { . . . . . . Offset: 32 . . . . . . Line: 2 @@ -273,7 +273,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: comprehension { -. . . . . . . Roles: For,Iterator,Expression +. . . . . . . Roles: For,Iterator,Expression,Incomplete . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 @@ -318,7 +318,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 2: comprehension { -. . . . . . . Roles: For,Iterator,Expression +. . . . . . . Roles: For,Iterator,Expression,Incomplete . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 diff --git a/tests/comprehension_set.py.uast b/tests/comprehension_set.py.uast index b01dae98..462b46c3 100644 --- a/tests/comprehension_set.py.uast +++ b/tests/comprehension_set.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: SetComp { -. . . . . Roles: Set,For,Expression,Incomplete +. . . . . Roles: Set,For,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -82,7 +82,7 @@ Module { . . . . . . . } . . . . . . } . . . . . . 1: comprehension { -. . . . . . . Roles: For,Iterator,Expression +. . . . . . . Roles: For,Iterator,Expression,Incomplete . . . . . . . Properties: { . . . . . . . . internalRole: generators . . . . . . . . is_async: 0 diff --git a/tests/unary.py.uast b/tests/unary.py.uast index c1c6139d..c7c7d8c4 100644 --- a/tests/unary.py.uast +++ b/tests/unary.py.uast @@ -16,7 +16,7 @@ Module { . . . } . . . Children: { . . . . 0: UnaryOp { -. . . . . Roles: Operator,Unary,Expression +. . . . . Roles: Binary,Operator,Unary,Expression . . . . . StartPosition: { . . . . . . Offset: 0 . . . . . . Line: 1 @@ -66,7 +66,7 @@ Module { . . . } . . . Children: { . . . . 0: UnaryOp { -. . . . . Roles: Operator,Unary,Expression +. . . . . Roles: Binary,Operator,Unary,Expression . . . . . StartPosition: { . . . . . . Offset: 3 . . . . . . Line: 2 @@ -117,7 +117,7 @@ Module { . . . } . . . Children: { . . . . 0: UnaryOp { -. . . . . Roles: Operator,Unary,Expression +. . . . . Roles: Binary,Operator,Unary,Expression . . . . . StartPosition: { . . . . . . Offset: 6 . . . . . . Line: 3