Merge branch 'faster-parse' of https://github.com/Monits/pmd into pr-115

# Conflicts:
#	pmd-java/etc/grammar/Java.jjt
This commit is contained in:
Andreas Dangel
2016-10-30 18:12:54 +01:00

View File

@ -1,4 +1,8 @@
/**
* Improve lambda detection in PrimaryPrefix to improve parsing performance.
*
* Juan Martin Sotuyo Dodero 10/2016
*====================================================================
* Fix for regression introduced in previous changeset.
* The syntactic lookahead was not properly handled by javacc,
* so it was converted to a semantic one
@ -1815,13 +1819,9 @@ void PrimaryPrefix() :
Literal()
| LOOKAHEAD(2) "this" {jjtThis.setUsesThisModifier();}
| "super" {jjtThis.setUsesSuperModifier();}
| LOOKAHEAD( "(" ")" "->" ) LambdaExpression()
| LOOKAHEAD( <IDENTIFIER> "->" ) LambdaExpression()
| LOOKAHEAD( "(" VariableDeclaratorId() ")" "->" ) LambdaExpression()
| LOOKAHEAD( "(" VariableDeclaratorId() "," VariableDeclaratorId() ["," VariableDeclaratorId()] ")" "->" ) LambdaExpression()
| LOOKAHEAD( "(" FormalParameter() ")" "->" ) LambdaExpression()
| LOOKAHEAD( "(" FormalParameter() "," FormalParameter() ["," FormalParameter() ] ")" "->" ) LambdaExpression()
| LOOKAHEAD( LambdaExpression() ) LambdaExpression()
| LOOKAHEAD( "(" VariableDeclaratorId() ( "," VariableDeclaratorId() )* ")" "->" ) LambdaExpression()
| LOOKAHEAD( FormalParameters() "->" ) LambdaExpression()
| LOOKAHEAD(3) "(" Expression() ")"
| AllocationExpression()
| LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class"