Support diamond operator, improved support for explicit generic invocations
This commit is contained in:
parent
df336b4e59
commit
4b6d0d9ea2
|
@ -732,9 +732,8 @@ expression
|
|||
: primary
|
||||
| expression '.' Identifier
|
||||
| expression '.' 'this'
|
||||
| expression '.' 'super' '(' expressionList? ')'
|
||||
| expression '.' 'new' Identifier '(' expressionList? ')'
|
||||
| expression '.' 'super' '.' Identifier arguments?
|
||||
| expression '.' 'new' nonWildcardTypeArguments? innerCreator
|
||||
| expression '.' 'super' superSuffix
|
||||
| expression '.' explicitGenericInvocation
|
||||
| 'new' creator
|
||||
| expression '[' expression ']'
|
||||
|
@ -780,6 +779,7 @@ primary
|
|||
| Identifier
|
||||
| type '.' 'class'
|
||||
| 'void' '.' 'class'
|
||||
| nonWildcardTypeArguments (explicitGenericInvocationSuffix | 'this' arguments)
|
||||
;
|
||||
|
||||
creator
|
||||
|
@ -788,12 +788,12 @@ creator
|
|||
;
|
||||
|
||||
createdName
|
||||
: classOrInterfaceType
|
||||
: Identifier typeArgumentsOrDiamond? ('.' Identifier typeArgumentsOrDiamond?)*
|
||||
| primitiveType
|
||||
;
|
||||
|
||||
innerCreator
|
||||
: nonWildcardTypeArguments? Identifier classCreatorRest
|
||||
: Identifier nonWildcardTypeArgumentsOrDiamond? classCreatorRest
|
||||
;
|
||||
|
||||
arrayCreatorRest
|
||||
|
@ -808,18 +808,33 @@ classCreatorRest
|
|||
;
|
||||
|
||||
explicitGenericInvocation
|
||||
: nonWildcardTypeArguments Identifier arguments
|
||||
: nonWildcardTypeArguments explicitGenericInvocationSuffix
|
||||
;
|
||||
|
||||
nonWildcardTypeArguments
|
||||
: '<' typeList '>'
|
||||
;
|
||||
|
||||
typeArgumentsOrDiamond
|
||||
: '<' '>'
|
||||
| typeArguments
|
||||
;
|
||||
|
||||
nonWildcardTypeArgumentsOrDiamond
|
||||
: '<' '>'
|
||||
| nonWildcardTypeArguments
|
||||
;
|
||||
|
||||
superSuffix
|
||||
: arguments
|
||||
| '.' Identifier arguments?
|
||||
;
|
||||
|
||||
explicitGenericInvocationSuffix
|
||||
: 'super' superSuffix
|
||||
| Identifier arguments
|
||||
;
|
||||
|
||||
arguments
|
||||
: '(' expressionList? ')'
|
||||
;
|
||||
|
|
|
@ -854,10 +854,11 @@ castExpression
|
|||
|
||||
primary
|
||||
: parExpression
|
||||
| 'this' ('.' Identifier)* identifierSuffix?
|
||||
| 'this' arguments?
|
||||
| 'super' superSuffix
|
||||
| literal
|
||||
| 'new' creator
|
||||
| nonWildcardTypeArguments (explicitGenericInvocationSuffix | 'this' arguments)
|
||||
| Identifier ('.' Identifier)* identifierSuffix?
|
||||
| primitiveType ('[' ']')* '.' 'class'
|
||||
| 'void' '.' 'class'
|
||||
|
@ -865,13 +866,13 @@ primary
|
|||
|
||||
identifierSuffix
|
||||
: ('[' ']')+ '.' 'class'
|
||||
| ('[' expression ']')+ // can also be matched by selector, but do here
|
||||
| '[' expression ']'
|
||||
| arguments
|
||||
| '.' 'class'
|
||||
| '.' explicitGenericInvocation
|
||||
| '.' 'this'
|
||||
| '.' 'super' arguments
|
||||
| '.' 'new' innerCreator
|
||||
| '.' 'new' nonWildcardTypeArguments? innerCreator
|
||||
;
|
||||
|
||||
creator
|
||||
|
@ -880,12 +881,12 @@ creator
|
|||
;
|
||||
|
||||
createdName
|
||||
: classOrInterfaceType
|
||||
| primitiveType
|
||||
: Identifier typeArgumentsOrDiamond? ('.' Identifier typeArgumentsOrDiamond?)*
|
||||
| primitiveType
|
||||
;
|
||||
|
||||
innerCreator
|
||||
: nonWildcardTypeArguments? Identifier classCreatorRest
|
||||
: Identifier nonWildcardTypeArgumentsOrDiamond? classCreatorRest
|
||||
;
|
||||
|
||||
arrayCreatorRest
|
||||
|
@ -900,18 +901,29 @@ classCreatorRest
|
|||
;
|
||||
|
||||
explicitGenericInvocation
|
||||
: nonWildcardTypeArguments Identifier arguments
|
||||
: nonWildcardTypeArguments explicitGenericInvocationSuffix
|
||||
;
|
||||
|
||||
nonWildcardTypeArguments
|
||||
: '<' typeList '>'
|
||||
;
|
||||
|
||||
|
||||
typeArgumentsOrDiamond
|
||||
: '<' '>'
|
||||
| typeArguments
|
||||
;
|
||||
|
||||
nonWildcardTypeArgumentsOrDiamond
|
||||
: '<' '>'
|
||||
| nonWildcardTypeArguments
|
||||
;
|
||||
|
||||
selector
|
||||
: '.' Identifier arguments?
|
||||
| '.' explicitGenericInvocation
|
||||
| '.' 'this'
|
||||
| '.' 'super' superSuffix
|
||||
| '.' 'new' innerCreator
|
||||
| '.' 'new' nonWildcardTypeArguments? innerCreator
|
||||
| '[' expression ']'
|
||||
;
|
||||
|
||||
|
@ -920,6 +932,11 @@ superSuffix
|
|||
| '.' Identifier arguments?
|
||||
;
|
||||
|
||||
explicitGenericInvocationSuffix
|
||||
: 'super' superSuffix
|
||||
| Identifier arguments
|
||||
;
|
||||
|
||||
arguments
|
||||
: '(' expressionList? ')'
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue