Merge branch 'pr-72' into pmd/5.4.x

This commit is contained in:
Andreas Dangel
2015-10-10 17:40:29 +02:00
7 changed files with 53 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import javax.xml.parsers.ParserConfigurationException;
import net.sourceforge.pmd.lang.ast.xpath.Attribute;
import net.sourceforge.pmd.lang.ast.xpath.DocumentNavigator;
import net.sourceforge.pmd.lang.dfa.DataFlowNode;
import net.sourceforge.pmd.lang.ast.GenericToken;
import org.jaxen.BaseXPath;
import org.jaxen.JaxenException;
@ -397,4 +398,22 @@ public abstract class AbstractNode implements Node {
public void setUserData(Object userData) {
this.userData = userData;
}
protected GenericToken firstToken, lastToken;
public GenericToken jjtGetFirstToken() {
return firstToken;
}
public void jjtSetFirstToken(GenericToken token) {
this.firstToken = token;
}
public GenericToken jjtGetLastToken() {
return lastToken;
}
public void jjtSetLastToken(GenericToken token) {
this.lastToken = token;
}
}

View File

@ -0,0 +1,8 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.ast;
public class GenericToken {
}

View File

@ -1,4 +1,8 @@
/**
* Added capability for Tracking Tokens.
*
* Amit Kumar Prasad 10/2015
*====================================================================
* Fix for Cast Expression not detected properly in Return statements
* Bug #1429
*
@ -109,6 +113,7 @@ options {
MULTI = true;
VISITOR = true;
NODE_USES_PARSER = true;
TRACK_TOKENS = true;
NODE_PACKAGE="net.sourceforge.pmd.lang.java.ast";
//DEBUG_PARSER = true;

View File

@ -81,6 +81,12 @@ public class]]></replacevalue>
}
]]></replacevalue>
</replace>
<replace file="${target}/net/sourceforge/pmd/lang/java/ast/Token.java">
<replacetoken>public class Token</replacetoken>
<replacevalue><![CDATA[import net.sourceforge.pmd.lang.ast.GenericToken;
public class Token extends GenericToken]]></replacevalue>
</replace>
<delete>
<fileset dir="${target}/net/sourceforge/pmd/lang/java/ast">

View File

@ -1,4 +1,9 @@
/* JSP Parser for PMD.
/*
* Added capability for Tracking Tokens.
*
* Amit Kumar Prasad 10/2015
*====================================================================
* JSP Parser for PMD.
* It supports supports more-or-less well written JSP files.
* The JSP Document style is supported, except for inline DTD.
* The JSP Page style (<% ... %>) is supported.
@ -16,6 +21,7 @@ options {
MULTI=true;
VISITOR=true;
TRACK_TOKENS = true;
}
PARSER_BEGIN(JspParser)

View File

@ -61,6 +61,12 @@
public class]]></replacevalue>
</replace>
<replace file="${target}/net/sourceforge/pmd/lang/jsp/ast/Token.java">
<replacetoken>public class Token</replacetoken>
<replacevalue><![CDATA[import net.sourceforge.pmd.lang.ast.GenericToken;
public class Token extends GenericToken]]></replacevalue>
</replace>
<delete>
<fileset dir="${target}/net/sourceforge/pmd/lang/jsp/ast">

View File

@ -10,6 +10,8 @@
**Pull Requests:**
* [#72](https://github.com/pmd/pmd/pull/72): Added capability in Java and JSP parser for tracking tokens.
**Bugfixes:**
* [#1429](https://sourceforge.net/p/pmd/bugs/1429/): Java - Parse Error: Cast in return expression