diff --git a/ANNOTATION.md b/ANNOTATION.md index 94e027f..dac34c0 100644 --- a/ANNOTATION.md +++ b/ANNOTATION.md @@ -52,6 +52,7 @@ | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='DoStatement'\] | DoWhile | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='DoStatement'\]/\*\[@internalRole\]\[@internalRole='expression'\] | DoWhileCondition | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='DoStatement'\]/\*\[@internalRole\]\[@internalRole='body'\] | DoWhileBody | +| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\] | BinaryExpression | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\]/self::\*\[@operator\]\[@operator='\+'\] | OpAdd | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\]/self::\*\[@operator\]\[@operator='\-'\] | OpSubstract | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\]/self::\*\[@operator\]\[@operator='\*'\] | OpMultiply | @@ -65,6 +66,8 @@ | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\]/self::\*\[@operator\]\[@operator='&&'\] | OpBooleanAnd | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\]/self::\*\[@operator\]\[@operator='\|\|'\] | OpBooleanOr | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\]/self::\*\[@operator\]\[@operator='^'\] | OpBooleanXor | +| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\]/\*\[@internalRole\]\[@internalRole='leftOperand'\] | BinaryExpressionLeft | +| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='InfixExpression'\]/\*\[@internalRole\]\[@internalRole='rightOperand'\] | BinaryExpressionRight | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='PostfixExpression'\]/self::\*\[@operator\]\[@operator='\+\+'\] | OpPostIncrement | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='PostfixExpression'\]/self::\*\[@operator\]\[@operator='\-\-'\] | OpPostDecrement | | /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='PrefixExpression'\]/self::\*\[@operator\]\[@operator='\+\+'\] | OpPreIncrement | diff --git a/driver/normalizer/annotation.go b/driver/normalizer/annotation.go index cfd1c9a..6c72397 100644 --- a/driver/normalizer/annotation.go +++ b/driver/normalizer/annotation.go @@ -109,7 +109,7 @@ var AnnotationRules = On(Any).Self( On(jdt.PropertyBody).Roles(DoWhileBody), ), - On(jdt.InfixExpression).Self( + On(jdt.InfixExpression).Roles(BinaryExpression, BinaryExpressionOp).Self( On(HasProperty("operator", "+")).Roles(OpAdd), On(HasProperty("operator", "-")).Roles(OpSubstract), On(HasProperty("operator", "*")).Roles(OpMultiply), @@ -123,6 +123,9 @@ var AnnotationRules = On(Any).Self( On(HasProperty("operator", "&&")).Roles(OpBooleanAnd), On(HasProperty("operator", "||")).Roles(OpBooleanOr), On(HasProperty("operator", "^")).Roles(OpBooleanXor), + ).Children( + On(jdt.PropertyLeftOperand).Roles(BinaryExpressionLeft), + On(jdt.PropertyRightOperand).Roles(BinaryExpressionRight), ), On(jdt.PostfixExpression).Self( diff --git a/tests/binary_expression.native b/tests/binary_expression.native new file mode 100644 index 0000000..b4c08fc --- /dev/null +++ b/tests/binary_expression.native @@ -0,0 +1,86 @@ +{ + "status": "ok", + "errors": [], + "ast": { + "CompilationUnit": { + "internalClass": "CompilationUnit", + "types": [ + { + "bodyDeclarations": [ + { + "body": { + "internalClass": "Block", + "statements": [ + { + "fragments": [ + { + "initializer": { + "internalClass": "InfixExpression", + "leftOperand": { + "internalClass": "NumberLiteral", + "line": 3, + "startPosition": 41, + "token": "3" + }, + "line": 3, + "operator": "+", + "rightOperand": { + "internalClass": "NumberLiteral", + "line": 3, + "startPosition": 45, + "token": "4" + }, + "startPosition": 41 + }, + "internalClass": "VariableDeclarationFragment", + "name": { + "identifier": "a", + "internalClass": "SimpleName", + "line": 3, + "startPosition": 37 + } + } + ], + "internalClass": "VariableDeclarationStatement", + "type": { + "internalClass": "PrimitiveType", + "line": 3, + "primitiveTypeCode": "int", + "startPosition": 33 + } + } + ] + }, + "constructor": "false", + "internalClass": "MethodDeclaration", + "line": 2, + "name": { + "identifier": "code", + "internalClass": "SimpleName", + "line": 2, + "startPosition": 20 + }, + "returnType2": { + "internalClass": "PrimitiveType", + "line": 2, + "primitiveTypeCode": "void", + "startPosition": 15 + }, + "startPosition": 15 + } + ], + "interface": "false", + "internalClass": "TypeDeclaration", + "line": 1, + "name": { + "identifier": "Code", + "internalClass": "SimpleName", + "line": 1, + "startPosition": 6 + }, + "startPosition": 0 + } + ] + } + } +} diff --git a/tests/binary_expression.source b/tests/binary_expression.source new file mode 100644 index 0000000..c7844ed --- /dev/null +++ b/tests/binary_expression.source @@ -0,0 +1,5 @@ +class Code { + void code() { + int a = 3 + 4; + } +} diff --git a/tests/binary_expression.uast b/tests/binary_expression.uast new file mode 100644 index 0000000..1ba69c3 --- /dev/null +++ b/tests/binary_expression.uast @@ -0,0 +1,155 @@ +Status: ok +Errors: +UAST: +CompilationUnit { +. Roles: File +. Children: { +. . 0: TypeDeclaration { +. . . Roles: VisibleFromPackage,TypeDeclaration +. . . StartPosition: { +. . . . Offset: 0 +. . . . Line: 1 +. . . . Col: 0 +. . . } +. . . Properties: { +. . . . interface: false +. . . . internalRole: types +. . . } +. . . Children: { +. . . . 0: SimpleName { +. . . . . Roles: SimpleIdentifier +. . . . . TOKEN "Code" +. . . . . StartPosition: { +. . . . . . Offset: 6 +. . . . . . Line: 1 +. . . . . . Col: 0 +. . . . . } +. . . . . Properties: { +. . . . . . internalRole: name +. . . . . } +. . . . } +. . . . 1: MethodDeclaration { +. . . . . Roles: VisibleFromPackage,FunctionDeclaration +. . . . . StartPosition: { +. . . . . . Offset: 15 +. . . . . . Line: 2 +. . . . . . Col: 0 +. . . . . } +. . . . . Properties: { +. . . . . . constructor: false +. . . . . . internalRole: bodyDeclarations +. . . . . } +. . . . . Children: { +. . . . . . 0: PrimitiveType { +. . . . . . . TOKEN "void" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 15 +. . . . . . . . Line: 2 +. . . . . . . . Col: 0 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: returnType2 +. . . . . . . } +. . . . . . } +. . . . . . 1: SimpleName { +. . . . . . . Roles: SimpleIdentifier,FunctionDeclarationName +. . . . . . . TOKEN "code" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 20 +. . . . . . . . Line: 2 +. . . . . . . . Col: 0 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: name +. . . . . . . } +. . . . . . } +. . . . . . 2: Block { +. . . . . . . Roles: FunctionDeclarationBody,BlockScope,Block +. . . . . . . Properties: { +. . . . . . . . internalRole: body +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: VariableDeclarationStatement { +. . . . . . . . . Properties: { +. . . . . . . . . . internalRole: statements +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: PrimitiveType { +. . . . . . . . . . . TOKEN "int" +. . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . Offset: 33 +. . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . Col: 0 +. . . . . . . . . . . } +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: type +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 1: VariableDeclarationFragment { +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: fragments +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: SimpleName { +. . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . TOKEN "a" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 37 +. . . . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . . . Col: 0 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . internalRole: name +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . . 1: InfixExpression { +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpAdd +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 41 +. . . . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . . . Col: 0 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . internalRole: initializer +. . . . . . . . . . . . . . operator: + +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Children: { +. . . . . . . . . . . . . . 0: NumberLiteral { +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft +. . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . Offset: 41 +. . . . . . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . . . . . Col: 0 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . internalRole: leftOperand +. . . . . . . . . . . . . . . . token: 3 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . } +. . . . . . . . . . . . . . 1: NumberLiteral { +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight +. . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . Offset: 45 +. . . . . . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . . . . . Col: 0 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . internalRole: rightOperand +. . . . . . . . . . . . . . . . token: 4 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . } +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . } +. . } +. } +} + diff --git a/tests/boolean_operators.uast b/tests/boolean_operators.uast index cbc72f4..a4a2b6a 100644 --- a/tests/boolean_operators.uast +++ b/tests/boolean_operators.uast @@ -103,7 +103,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpBooleanAnd +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpBooleanAnd . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 45 . . . . . . . . . . . . . . Line: 3 @@ -115,7 +115,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: BooleanLiteral { -. . . . . . . . . . . . . . . Roles: BooleanLiteral +. . . . . . . . . . . . . . . Roles: BooleanLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 45 . . . . . . . . . . . . . . . . Line: 3 @@ -127,7 +127,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: BooleanLiteral { -. . . . . . . . . . . . . . . Roles: BooleanLiteral +. . . . . . . . . . . . . . . Roles: BooleanLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 53 . . . . . . . . . . . . . . . . Line: 3 @@ -175,7 +175,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpBooleanOr,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpBooleanOr,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 68 . . . . . . . . . . . . . . Line: 4 @@ -187,7 +187,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: SimpleName { -. . . . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . . . Roles: SimpleIdentifier,BinaryExpressionLeft . . . . . . . . . . . . . . . TOKEN "i" . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 68 @@ -199,7 +199,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: BooleanLiteral { -. . . . . . . . . . . . . . . Roles: BooleanLiteral +. . . . . . . . . . . . . . . Roles: BooleanLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 73 . . . . . . . . . . . . . . . . Line: 4 diff --git a/tests/do_while.uast b/tests/do_while.uast index 3826bf8..e5349b2 100644 --- a/tests/do_while.uast +++ b/tests/do_while.uast @@ -239,7 +239,7 @@ CompilationUnit { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . Roles: DoWhileCondition +. . . . . . . . . . . Roles: DoWhileCondition,BinaryExpression,BinaryExpressionOp . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 120 . . . . . . . . . . . . Line: 7 @@ -251,7 +251,7 @@ CompilationUnit { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: SimpleName { -. . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . Roles: SimpleIdentifier,BinaryExpressionLeft . . . . . . . . . . . . . TOKEN "i" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 120 @@ -263,7 +263,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 124 . . . . . . . . . . . . . . Line: 7 diff --git a/tests/for.uast b/tests/for.uast index a811818..80836f3 100644 --- a/tests/for.uast +++ b/tests/for.uast @@ -126,7 +126,7 @@ CompilationUnit { . . . . . . . . . . . } . . . . . . . . . . } . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . Roles: ForExpression +. . . . . . . . . . . Roles: ForExpression,BinaryExpression,BinaryExpressionOp . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 49 . . . . . . . . . . . . Line: 3 @@ -138,7 +138,7 @@ CompilationUnit { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: SimpleName { -. . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . Roles: SimpleIdentifier,BinaryExpressionLeft . . . . . . . . . . . . . TOKEN "i" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 49 @@ -150,7 +150,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 53 . . . . . . . . . . . . . . Line: 3 diff --git a/tests/operators.uast b/tests/operators.uast index 949adc0..522e7c3 100644 --- a/tests/operators.uast +++ b/tests/operators.uast @@ -137,7 +137,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpAdd,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpAdd,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 43 . . . . . . . . . . . . . . Line: 4 @@ -149,7 +149,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 43 . . . . . . . . . . . . . . . . Line: 4 @@ -161,7 +161,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 47 . . . . . . . . . . . . . . . . Line: 4 @@ -209,7 +209,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpSubstract,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpSubstract,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 56 . . . . . . . . . . . . . . Line: 5 @@ -221,7 +221,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 56 . . . . . . . . . . . . . . . . Line: 5 @@ -233,7 +233,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 60 . . . . . . . . . . . . . . . . Line: 5 @@ -281,7 +281,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpMultiply,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpMultiply,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 69 . . . . . . . . . . . . . . Line: 6 @@ -293,7 +293,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 69 . . . . . . . . . . . . . . . . Line: 6 @@ -305,7 +305,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 73 . . . . . . . . . . . . . . . . Line: 6 @@ -353,7 +353,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpDivide,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpDivide,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 82 . . . . . . . . . . . . . . Line: 7 @@ -365,7 +365,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 82 . . . . . . . . . . . . . . . . Line: 7 @@ -377,7 +377,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 86 . . . . . . . . . . . . . . . . Line: 7 @@ -425,7 +425,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpMod,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpMod,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 95 . . . . . . . . . . . . . . Line: 8 @@ -437,7 +437,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 95 . . . . . . . . . . . . . . . . Line: 8 @@ -449,7 +449,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 99 . . . . . . . . . . . . . . . . Line: 8 @@ -813,7 +813,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpBitwiseAnd,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpBitwiseAnd,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 171 . . . . . . . . . . . . . . Line: 21 @@ -825,7 +825,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 171 . . . . . . . . . . . . . . . . Line: 21 @@ -837,7 +837,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 173 . . . . . . . . . . . . . . . . Line: 21 @@ -885,7 +885,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpBooleanXor,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpBooleanXor,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 182 . . . . . . . . . . . . . . Line: 22 @@ -897,7 +897,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 182 . . . . . . . . . . . . . . . . Line: 22 @@ -909,7 +909,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 184 . . . . . . . . . . . . . . . . Line: 22 @@ -957,7 +957,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpBitwiseOr,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpBitwiseOr,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 193 . . . . . . . . . . . . . . Line: 23 @@ -969,7 +969,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 193 . . . . . . . . . . . . . . . . Line: 23 @@ -981,7 +981,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 195 . . . . . . . . . . . . . . . . Line: 23 @@ -1029,7 +1029,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpBitwiseLeftShift,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpBitwiseLeftShift,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 204 . . . . . . . . . . . . . . Line: 24 @@ -1041,7 +1041,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 204 . . . . . . . . . . . . . . . . Line: 24 @@ -1053,7 +1053,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 209 . . . . . . . . . . . . . . . . Line: 24 @@ -1101,7 +1101,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpBitwiseRightShift,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpBitwiseRightShift,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 218 . . . . . . . . . . . . . . Line: 25 @@ -1113,7 +1113,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 218 . . . . . . . . . . . . . . . . Line: 25 @@ -1125,7 +1125,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 223 . . . . . . . . . . . . . . . . Line: 25 @@ -1173,7 +1173,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: OpBitwiseUnsignedRightShift,AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,OpBitwiseUnsignedRightShift,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 232 . . . . . . . . . . . . . . Line: 26 @@ -1185,7 +1185,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 232 . . . . . . . . . . . . . . . . Line: 26 @@ -1197,7 +1197,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 238 . . . . . . . . . . . . . . . . Line: 26 @@ -1933,7 +1933,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 413 . . . . . . . . . . . . . . Line: 46 @@ -1945,7 +1945,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 413 . . . . . . . . . . . . . . . . Line: 46 @@ -1957,7 +1957,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 418 . . . . . . . . . . . . . . . . Line: 46 @@ -2005,7 +2005,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 427 . . . . . . . . . . . . . . Line: 47 @@ -2017,7 +2017,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 427 . . . . . . . . . . . . . . . . Line: 47 @@ -2029,7 +2029,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 431 . . . . . . . . . . . . . . . . Line: 47 @@ -2077,7 +2077,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 440 . . . . . . . . . . . . . . Line: 48 @@ -2089,7 +2089,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 440 . . . . . . . . . . . . . . . . Line: 48 @@ -2101,7 +2101,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 445 . . . . . . . . . . . . . . . . Line: 48 @@ -2149,7 +2149,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 454 . . . . . . . . . . . . . . Line: 49 @@ -2161,7 +2161,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 454 . . . . . . . . . . . . . . . . Line: 49 @@ -2173,7 +2173,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 458 . . . . . . . . . . . . . . . . Line: 49 @@ -2221,7 +2221,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: InfixExpression { -. . . . . . . . . . . . . Roles: AssignmentValue +. . . . . . . . . . . . . Roles: BinaryExpression,BinaryExpressionOp,AssignmentValue . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 467 . . . . . . . . . . . . . . Line: 50 @@ -2233,7 +2233,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . . Children: { . . . . . . . . . . . . . . 0: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionLeft . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 467 . . . . . . . . . . . . . . . . Line: 50 @@ -2245,7 +2245,7 @@ CompilationUnit { . . . . . . . . . . . . . . . } . . . . . . . . . . . . . . } . . . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . . . Offset: 472 . . . . . . . . . . . . . . . . Line: 50 diff --git a/tests/qualified_identifier.native b/tests/qualified_identifier.native new file mode 100644 index 0000000..8807fad --- /dev/null +++ b/tests/qualified_identifier.native @@ -0,0 +1,89 @@ +{ + "status": "ok", + "errors": [], + "ast": { + "CompilationUnit": { + "internalClass": "CompilationUnit", + "types": [ + { + "bodyDeclarations": [ + { + "body": { + "internalClass": "Block", + "statements": [ + { + "fragments": [ + { + "internalClass": "VariableDeclarationFragment", + "name": { + "identifier": "cons", + "internalClass": "SimpleName", + "line": 3, + "startPosition": 49 + } + } + ], + "internalClass": "VariableDeclarationStatement", + "type": { + "internalClass": "SimpleType", + "name": { + "internalClass": "QualifiedName", + "name": { + "identifier": "Console", + "internalClass": "SimpleName", + "line": 3, + "startPosition": 41 + }, + "qualifier": { + "internalClass": "QualifiedName", + "name": { + "identifier": "io", + "internalClass": "SimpleName", + "line": 3, + "startPosition": 38 + }, + "qualifier": { + "identifier": "Java", + "internalClass": "SimpleName", + "line": 3, + "startPosition": 33 + } + } + } + } + } + ] + }, + "constructor": "false", + "internalClass": "MethodDeclaration", + "line": 2, + "name": { + "identifier": "code", + "internalClass": "SimpleName", + "line": 2, + "startPosition": 20 + }, + "returnType2": { + "internalClass": "PrimitiveType", + "line": 2, + "primitiveTypeCode": "void", + "startPosition": 15 + }, + "startPosition": 15 + } + ], + "interface": "false", + "internalClass": "TypeDeclaration", + "line": 1, + "name": { + "identifier": "Code", + "internalClass": "SimpleName", + "line": 1, + "startPosition": 6 + }, + "startPosition": 0 + } + ] + } + } +} diff --git a/tests/qualified_identifier.source b/tests/qualified_identifier.source new file mode 100644 index 0000000..6950843 --- /dev/null +++ b/tests/qualified_identifier.source @@ -0,0 +1,5 @@ +class Code { + void code() { + Java.io.Console cons; + } +} diff --git a/tests/qualified_identifier.uast b/tests/qualified_identifier.uast new file mode 100644 index 0000000..f6e7707 --- /dev/null +++ b/tests/qualified_identifier.uast @@ -0,0 +1,165 @@ +Status: ok +Errors: +UAST: +CompilationUnit { +. Roles: File +. Children: { +. . 0: TypeDeclaration { +. . . Roles: VisibleFromPackage,TypeDeclaration +. . . StartPosition: { +. . . . Offset: 0 +. . . . Line: 1 +. . . . Col: 0 +. . . } +. . . Properties: { +. . . . interface: false +. . . . internalRole: types +. . . } +. . . Children: { +. . . . 0: SimpleName { +. . . . . Roles: SimpleIdentifier +. . . . . TOKEN "Code" +. . . . . StartPosition: { +. . . . . . Offset: 6 +. . . . . . Line: 1 +. . . . . . Col: 0 +. . . . . } +. . . . . Properties: { +. . . . . . internalRole: name +. . . . . } +. . . . } +. . . . 1: MethodDeclaration { +. . . . . Roles: VisibleFromPackage,FunctionDeclaration +. . . . . StartPosition: { +. . . . . . Offset: 15 +. . . . . . Line: 2 +. . . . . . Col: 0 +. . . . . } +. . . . . Properties: { +. . . . . . constructor: false +. . . . . . internalRole: bodyDeclarations +. . . . . } +. . . . . Children: { +. . . . . . 0: PrimitiveType { +. . . . . . . TOKEN "void" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 15 +. . . . . . . . Line: 2 +. . . . . . . . Col: 0 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: returnType2 +. . . . . . . } +. . . . . . } +. . . . . . 1: SimpleName { +. . . . . . . Roles: SimpleIdentifier,FunctionDeclarationName +. . . . . . . TOKEN "code" +. . . . . . . StartPosition: { +. . . . . . . . Offset: 20 +. . . . . . . . Line: 2 +. . . . . . . . Col: 0 +. . . . . . . } +. . . . . . . Properties: { +. . . . . . . . internalRole: name +. . . . . . . } +. . . . . . } +. . . . . . 2: Block { +. . . . . . . Roles: FunctionDeclarationBody,BlockScope,Block +. . . . . . . Properties: { +. . . . . . . . internalRole: body +. . . . . . . } +. . . . . . . Children: { +. . . . . . . . 0: VariableDeclarationStatement { +. . . . . . . . . Properties: { +. . . . . . . . . . internalRole: statements +. . . . . . . . . } +. . . . . . . . . Children: { +. . . . . . . . . . 0: SimpleType { +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: type +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: QualifiedName { +. . . . . . . . . . . . . Roles: QualifiedIdentifier +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . internalRole: name +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Children: { +. . . . . . . . . . . . . . 0: QualifiedName { +. . . . . . . . . . . . . . . Roles: QualifiedIdentifier +. . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . internalRole: qualifier +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . Children: { +. . . . . . . . . . . . . . . . 0: SimpleName { +. . . . . . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . . . . . TOKEN "Java" +. . . . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . . . Offset: 33 +. . . . . . . . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . . . . . . . Col: 0 +. . . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . . . internalRole: qualifier +. . . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . . 1: SimpleName { +. . . . . . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . . . . . TOKEN "io" +. . . . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . . . Offset: 38 +. . . . . . . . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . . . . . . . Col: 0 +. . . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . . . internalRole: name +. . . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . } +. . . . . . . . . . . . . . 1: SimpleName { +. . . . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . . . TOKEN "Console" +. . . . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . . . Offset: 41 +. . . . . . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . . . . . Col: 0 +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . . . internalRole: name +. . . . . . . . . . . . . . . } +. . . . . . . . . . . . . . } +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . . 1: VariableDeclarationFragment { +. . . . . . . . . . . Properties: { +. . . . . . . . . . . . internalRole: fragments +. . . . . . . . . . . } +. . . . . . . . . . . Children: { +. . . . . . . . . . . . 0: SimpleName { +. . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . TOKEN "cons" +. . . . . . . . . . . . . StartPosition: { +. . . . . . . . . . . . . . Offset: 49 +. . . . . . . . . . . . . . Line: 3 +. . . . . . . . . . . . . . Col: 0 +. . . . . . . . . . . . . } +. . . . . . . . . . . . . Properties: { +. . . . . . . . . . . . . . internalRole: name +. . . . . . . . . . . . . } +. . . . . . . . . . . . } +. . . . . . . . . . . } +. . . . . . . . . . } +. . . . . . . . . } +. . . . . . . . } +. . . . . . . } +. . . . . . } +. . . . . } +. . . . } +. . . } +. . } +. } +} + diff --git a/tests/while.uast b/tests/while.uast index f7d1d8f..a478058 100644 --- a/tests/while.uast +++ b/tests/while.uast @@ -125,7 +125,7 @@ CompilationUnit { . . . . . . . . . } . . . . . . . . . Children: { . . . . . . . . . . 0: InfixExpression { -. . . . . . . . . . . Roles: WhileCondition +. . . . . . . . . . . Roles: WhileCondition,BinaryExpression,BinaryExpressionOp . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . Offset: 56 . . . . . . . . . . . . Line: 4 @@ -137,7 +137,7 @@ CompilationUnit { . . . . . . . . . . . } . . . . . . . . . . . Children: { . . . . . . . . . . . . 0: SimpleName { -. . . . . . . . . . . . . Roles: SimpleIdentifier +. . . . . . . . . . . . . Roles: SimpleIdentifier,BinaryExpressionLeft . . . . . . . . . . . . . TOKEN "i" . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 56 @@ -149,7 +149,7 @@ CompilationUnit { . . . . . . . . . . . . . } . . . . . . . . . . . . } . . . . . . . . . . . . 1: NumberLiteral { -. . . . . . . . . . . . . Roles: NumberLiteral +. . . . . . . . . . . . . Roles: NumberLiteral,BinaryExpressionRight . . . . . . . . . . . . . StartPosition: { . . . . . . . . . . . . . . Offset: 60 . . . . . . . . . . . . . . Line: 4