forked from antlr/grammars-v4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add hashed labels to expression rule in JavaParser (antlr#4310)
* add hashed labels to expression rule in JavaParser * fix hashed labels names * add EOF to compilationUnit rule * fix trees in tests --------- Co-authored-by: asamatova <asamatova@ptsecurity.com>
- Loading branch information
Showing
7 changed files
with
47 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(compilationUnit (importDeclaration import (qualifiedName (identifier java) . (identifier util) . (identifier regex) . (identifier Pattern) . (identifier CharPredicate)) ;) (typeDeclaration (classOrInterfaceModifier public) (classDeclaration class (identifier ExpressionOrder) (classBody { (classBodyDeclaration (modifier (classOrInterfaceModifier public)) (modifier (classOrInterfaceModifier static)) (memberDeclaration (methodDeclaration (typeTypeOrVoid void) (identifier main) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier String)) [ ]) (variableDeclaratorId (identifier args)))) )) (methodBody (block { (blockStatement (localVariableDeclaration (typeType (classOrInterfaceType (typeIdentifier Charpredicate))) (variableDeclarators (variableDeclarator (variableDeclaratorId (identifier a)) = (variableInitializer (expression (methodCall (identifier func) (arguments ( (expressionList (expression (primary (literal "a"))) , (expression (primary (literal true)))) )))))))) ;) }))))) (classBodyDeclaration (modifier (classOrInterfaceModifier public)) (modifier (classOrInterfaceModifier static)) (memberDeclaration (methodDeclaration (typeTypeOrVoid (typeType (classOrInterfaceType (typeIdentifier CharPredicate)))) (identifier func) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier String))) (variableDeclaratorId (identifier name))) , (formalParameter (typeType (primitiveType boolean)) (variableDeclaratorId (identifier caseIns)))) )) (methodBody (block { (blockStatement (statement return (expression (expression (primary (identifier caseIns))) ? (expression (lambdaExpression (lambdaParameters (identifier c)) -> (lambdaBody (expression (expression (expression (expression (primary (identifier Character))) . (methodCall (identifier isUpperCase) (arguments ( (expressionList (expression (primary (identifier c)))) )))) || (expression (expression (primary (identifier Character))) . (methodCall (identifier isLowerCase) (arguments ( (expressionList (expression (primary (identifier c)))) ))))) || (expression (expression (primary (identifier Character))) . (methodCall (identifier isTitleCase) (arguments ( (expressionList (expression (primary (identifier c)))) )))))))) : (expression (expression (primary (identifier Character))) :: (identifier isUpperCase))) ;)) (blockStatement (statement ;)) }))))) (classBodyDeclaration (memberDeclaration (methodDeclaration (typeTypeOrVoid void) (identifier forEachRemaining) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier Consumer) (typeArguments < (typeArgument ? super (typeType (classOrInterfaceType (typeIdentifier Double)))) >))) (variableDeclaratorId (identifier action)))) )) (methodBody (block { (blockStatement (statement (expression (methodCall (identifier forEachRemaining) (arguments ( (expressionList (expression ( (typeType (classOrInterfaceType (typeIdentifier DoubleConsumer))) ) (expression (expression (primary (identifier action))) :: (identifier accept)))) )))) ;)) }))))) })))) | ||
(compilationUnit (importDeclaration import (qualifiedName (identifier java) . (identifier util) . (identifier regex) . (identifier Pattern) . (identifier CharPredicate)) ;) (typeDeclaration (classOrInterfaceModifier public) (classDeclaration class (identifier ExpressionOrder) (classBody { (classBodyDeclaration (modifier (classOrInterfaceModifier public)) (modifier (classOrInterfaceModifier static)) (memberDeclaration (methodDeclaration (typeTypeOrVoid void) (identifier main) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier String)) [ ]) (variableDeclaratorId (identifier args)))) )) (methodBody (block { (blockStatement (localVariableDeclaration (typeType (classOrInterfaceType (typeIdentifier Charpredicate))) (variableDeclarators (variableDeclarator (variableDeclaratorId (identifier a)) = (variableInitializer (expression (methodCall (identifier func) (arguments ( (expressionList (expression (primary (literal "a"))) , (expression (primary (literal true)))) )))))))) ;) }))))) (classBodyDeclaration (modifier (classOrInterfaceModifier public)) (modifier (classOrInterfaceModifier static)) (memberDeclaration (methodDeclaration (typeTypeOrVoid (typeType (classOrInterfaceType (typeIdentifier CharPredicate)))) (identifier func) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier String))) (variableDeclaratorId (identifier name))) , (formalParameter (typeType (primitiveType boolean)) (variableDeclaratorId (identifier caseIns)))) )) (methodBody (block { (blockStatement (statement return (expression (expression (primary (identifier caseIns))) ? (expression (lambdaExpression (lambdaParameters (identifier c)) -> (lambdaBody (expression (expression (expression (expression (primary (identifier Character))) . (methodCall (identifier isUpperCase) (arguments ( (expressionList (expression (primary (identifier c)))) )))) || (expression (expression (primary (identifier Character))) . (methodCall (identifier isLowerCase) (arguments ( (expressionList (expression (primary (identifier c)))) ))))) || (expression (expression (primary (identifier Character))) . (methodCall (identifier isTitleCase) (arguments ( (expressionList (expression (primary (identifier c)))) )))))))) : (expression (expression (primary (identifier Character))) :: (identifier isUpperCase))) ;)) (blockStatement (statement ;)) }))))) (classBodyDeclaration (memberDeclaration (methodDeclaration (typeTypeOrVoid void) (identifier forEachRemaining) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier Consumer) (typeArguments < (typeArgument ? super (typeType (classOrInterfaceType (typeIdentifier Double)))) >))) (variableDeclaratorId (identifier action)))) )) (methodBody (block { (blockStatement (statement (expression (methodCall (identifier forEachRemaining) (arguments ( (expressionList (expression ( (typeType (classOrInterfaceType (typeIdentifier DoubleConsumer))) ) (expression (expression (primary (identifier action))) :: (identifier accept)))) )))) ;)) }))))) }))) <EOF>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(compilationUnit (importDeclaration import (qualifiedName (identifier java) . (identifier util) . (identifier ArrayList)) ;) (typeDeclaration (classOrInterfaceModifier public) (classDeclaration class (identifier GenericConstructor) (classBody { (classBodyDeclaration (modifier (classOrInterfaceModifier public)) (modifier (classOrInterfaceModifier static)) (memberDeclaration (methodDeclaration (typeTypeOrVoid void) (identifier main) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier String)) [ ]) (variableDeclaratorId (identifier args)))) )) (methodBody (block { (blockStatement (localVariableDeclaration (typeType (classOrInterfaceType (typeIdentifier ArrayList) (typeArguments < (typeArgument (typeType (classOrInterfaceType (typeIdentifier Integer)))) >))) (variableDeclarators (variableDeclarator (variableDeclaratorId (identifier myList)) = (variableInitializer (expression new (creator (createdName (identifier ArrayList) (typeArgumentsOrDiamond < >)) (classCreatorRest (arguments ( ))))))))) ;) }))))) })))) | ||
(compilationUnit (importDeclaration import (qualifiedName (identifier java) . (identifier util) . (identifier ArrayList)) ;) (typeDeclaration (classOrInterfaceModifier public) (classDeclaration class (identifier GenericConstructor) (classBody { (classBodyDeclaration (modifier (classOrInterfaceModifier public)) (modifier (classOrInterfaceModifier static)) (memberDeclaration (methodDeclaration (typeTypeOrVoid void) (identifier main) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier String)) [ ]) (variableDeclaratorId (identifier args)))) )) (methodBody (block { (blockStatement (localVariableDeclaration (typeType (classOrInterfaceType (typeIdentifier ArrayList) (typeArguments < (typeArgument (typeType (classOrInterfaceType (typeIdentifier Integer)))) >))) (variableDeclarators (variableDeclarator (variableDeclaratorId (identifier myList)) = (variableInitializer (expression new (creator (createdName (identifier ArrayList) (typeArgumentsOrDiamond < >)) (classCreatorRest (arguments ( ))))))))) ;) }))))) }))) <EOF>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(compilationUnit (importDeclaration import (qualifiedName (identifier java) . (identifier util) . (identifier ArrayList)) ;) (typeDeclaration (classOrInterfaceModifier public) (classDeclaration class (identifier LocalVariableDeclaration) (classBody { (classBodyDeclaration (modifier (classOrInterfaceModifier public)) (modifier (classOrInterfaceModifier static)) (memberDeclaration (methodDeclaration (typeTypeOrVoid void) (identifier main) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier String)) [ ]) (variableDeclaratorId (identifier args)))) )) (methodBody (block { (blockStatement (localVariableDeclaration (typeType (classOrInterfaceType (typeIdentifier ArrayList) (typeArguments < (typeArgument (typeType (classOrInterfaceType (typeIdentifier Integer)))) >))) (variableDeclarators (variableDeclarator (variableDeclaratorId (identifier myList)) = (variableInitializer (expression new (creator (createdName (identifier ArrayList) (typeArgumentsOrDiamond (typeArguments < (typeArgument (typeType (classOrInterfaceType (typeIdentifier Integer)))) >))) (classCreatorRest (arguments ( ))))))))) ;) (blockStatement (statement (expression (expression (primary (identifier myList))) . (methodCall (identifier add) (arguments ( (expressionList (expression (primary (literal (integerLiteral 2))))) )))) ;)) (blockStatement (localVariableDeclaration var (identifier myVal) = (expression (expression (primary (identifier myList))) . (methodCall (identifier get) (arguments ( (expressionList (expression (primary (literal (integerLiteral 0))))) ))))) ;) }))))) })))) | ||
(compilationUnit (importDeclaration import (qualifiedName (identifier java) . (identifier util) . (identifier ArrayList)) ;) (typeDeclaration (classOrInterfaceModifier public) (classDeclaration class (identifier LocalVariableDeclaration) (classBody { (classBodyDeclaration (modifier (classOrInterfaceModifier public)) (modifier (classOrInterfaceModifier static)) (memberDeclaration (methodDeclaration (typeTypeOrVoid void) (identifier main) (formalParameters ( (formalParameterList (formalParameter (typeType (classOrInterfaceType (typeIdentifier String)) [ ]) (variableDeclaratorId (identifier args)))) )) (methodBody (block { (blockStatement (localVariableDeclaration (typeType (classOrInterfaceType (typeIdentifier ArrayList) (typeArguments < (typeArgument (typeType (classOrInterfaceType (typeIdentifier Integer)))) >))) (variableDeclarators (variableDeclarator (variableDeclaratorId (identifier myList)) = (variableInitializer (expression new (creator (createdName (identifier ArrayList) (typeArgumentsOrDiamond (typeArguments < (typeArgument (typeType (classOrInterfaceType (typeIdentifier Integer)))) >))) (classCreatorRest (arguments ( ))))))))) ;) (blockStatement (statement (expression (expression (primary (identifier myList))) . (methodCall (identifier add) (arguments ( (expressionList (expression (primary (literal (integerLiteral 2))))) )))) ;)) (blockStatement (localVariableDeclaration var (identifier myVal) = (expression (expression (primary (identifier myList))) . (methodCall (identifier get) (arguments ( (expressionList (expression (primary (literal (integerLiteral 0))))) ))))) ;) }))))) }))) <EOF>) |
Oops, something went wrong.