Ugly workaround that don't need to change AST
This commit is contained in:
Juan Martín Sotuyo Dodero
committed by
Andreas Dangel
parent
907972f0ca
commit
8f22e69560
@ -1788,7 +1788,13 @@ void UnaryExpressionNotPlusMinus() #UnaryExpressionNotPlusMinus((jjtn000.getImag
|
|||||||
{}
|
{}
|
||||||
{
|
{
|
||||||
( "~" {jjtThis.setImage("~");} | "!" {jjtThis.setImage("!");} ) UnaryExpression()
|
( "~" {jjtThis.setImage("~");} | "!" {jjtThis.setImage("!");} ) UnaryExpression()
|
||||||
| LOOKAHEAD(CastExpression()) CastExpression()
|
/*
|
||||||
|
* This is really ugly... we are repeting the CastExpression lookahead and full expression...
|
||||||
|
* If we don't the lookahead within CastExpression is ignored, and it simply looks for the expression,
|
||||||
|
* meaning we can't be explicit as to what can be casted depending on the cast type (primitive or otherwhise)
|
||||||
|
*/
|
||||||
|
| LOOKAHEAD("(" (Annotation())* PrimitiveType() ")") CastExpression()
|
||||||
|
| LOOKAHEAD("(" (Annotation())* Type() ( "&" ReferenceType() )* ")" UnaryExpressionNotPlusMinus()) CastExpression()
|
||||||
| PostfixExpression()
|
| PostfixExpression()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1803,7 +1809,7 @@ void CastExpression() :
|
|||||||
{
|
{
|
||||||
LOOKAHEAD(
|
LOOKAHEAD(
|
||||||
"(" (Annotation())* PrimitiveType() ")"
|
"(" (Annotation())* PrimitiveType() ")"
|
||||||
) "(" (Annotation() {checkForBadTypeAnnotations();})* PrimitiveType() ")" UnaryExpression()
|
) "(" (Annotation() {checkForBadTypeAnnotations();})* Type() ")" UnaryExpression()
|
||||||
| "(" (Annotation() {checkForBadTypeAnnotations();})* Type() ( "&" {checkForBadIntersectionTypesInCasts(); jjtThis.setIntersectionTypes(true);} ReferenceType() )* ")" UnaryExpressionNotPlusMinus()
|
| "(" (Annotation() {checkForBadTypeAnnotations();})* Type() ( "&" {checkForBadIntersectionTypesInCasts(); jjtThis.setIntersectionTypes(true);} ReferenceType() )* ")" UnaryExpressionNotPlusMinus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ adverse impacts on performance.
|
|||||||
<property name="xpath">
|
<property name="xpath">
|
||||||
<value>
|
<value>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
//PrimitiveType[@Image = 'short'][name(..) != 'CastExpression']
|
//PrimitiveType[@Image = 'short'][name(../..) != 'CastExpression']
|
||||||
]]>
|
]]>
|
||||||
</value>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
|
Reference in New Issue
Block a user