From 92e0b4114d3c4b8fc0642588468d312c95775893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Thu, 15 Aug 2019 13:54:52 +0200 Subject: [PATCH] Fix lookaheads --- pmd-java/etc/grammar/Java.jjt | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 512abfc35b..222202a074 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -2313,7 +2313,7 @@ void Expression() #AssignmentExpression(>1): { ConditionalExpression() [ - LOOKAHEAD(2) op=AssignmentOperator() {jjtThis.setOp(op);} Expression() + LOOKAHEAD(1) op=AssignmentOperator() {jjtThis.setOp(op);} Expression() ] } @@ -2327,44 +2327,44 @@ AssignmentOp AssignmentOperator() #void: void ConditionalExpression() #ConditionalExpression(>1) : {} { - ConditionalOrExpression() [ "?" Expression() ":" ConditionalExpression() ] + ConditionalOrExpression() [LOOKAHEAD(1) "?" Expression() ":" ConditionalExpression() ] } void ConditionalOrExpression() #void: {} { - ConditionalAndExpression() (("||" {jjtThis.setOp(BinaryOp.CONDITIONAL_OR);} ConditionalAndExpression()) #InfixExpression(2))* + ConditionalAndExpression() (LOOKAHEAD(1) ("||" {jjtThis.setOp(BinaryOp.CONDITIONAL_OR);} ConditionalAndExpression()) #InfixExpression(2))* } void ConditionalAndExpression() #void: {} { - InclusiveOrExpression() (("&&" {jjtThis.setOp(BinaryOp.CONDITIONAL_AND);} InclusiveOrExpression()) #InfixExpression(2))* + InclusiveOrExpression() (LOOKAHEAD(1) ("&&" {jjtThis.setOp(BinaryOp.CONDITIONAL_AND);} InclusiveOrExpression()) #InfixExpression(2))* } void InclusiveOrExpression() #void: {} { - ExclusiveOrExpression() (("|" {jjtThis.setOp(BinaryOp.OR);} ExclusiveOrExpression()) #InfixExpression(2))* + ExclusiveOrExpression() (LOOKAHEAD(1) ("|" {jjtThis.setOp(BinaryOp.OR);} ExclusiveOrExpression()) #InfixExpression(2))* } void ExclusiveOrExpression() #void: {} { - AndExpression() ( ("^" {jjtThis.setOp(BinaryOp.XOR);} AndExpression()) #InfixExpression(2))* + AndExpression() (LOOKAHEAD(1) ("^" {jjtThis.setOp(BinaryOp.XOR);} AndExpression()) #InfixExpression(2))* } void AndExpression() #void: {} { - EqualityExpression() (("&" {jjtThis.setOp(BinaryOp.AND);} EqualityExpression()) #InfixExpression(2))* + EqualityExpression() (LOOKAHEAD(1) ("&" {jjtThis.setOp(BinaryOp.AND);} EqualityExpression()) #InfixExpression(2))* } void EqualityExpression() #void: {} { InstanceOfExpression() - ( + (LOOKAHEAD(1) ( ( "==" {jjtThis.setOp(BinaryOp.EQ);} | "!=" {jjtThis.setOp(BinaryOp.NE);} @@ -2377,7 +2377,7 @@ void EqualityExpression() #void: void InstanceOfExpression() #InstanceOfExpression(>1): {} { - RelationalExpression() [ LOOKAHEAD(2) "instanceof" AnnotatedRefType() ] + RelationalExpression() [ LOOKAHEAD(1) "instanceof" AnnotatedRefType() ] } void RelationalExpression() #void: @@ -2390,7 +2390,7 @@ void RelationalExpression() #void: // error, because the type of a