diff --git a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/ast/ApexParsingHelper.java b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/ast/ApexParsingHelper.java
index 6b2dfecf23..5fb0ea501d 100644
--- a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/ast/ApexParsingHelper.java
+++ b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/ast/ApexParsingHelper.java
@@ -4,6 +4,8 @@
package net.sourceforge.pmd.lang.apex.ast;
+import net.sourceforge.pmd.lang.LanguageVersion;
+import net.sourceforge.pmd.lang.LanguageVersionHandler;
import net.sourceforge.pmd.lang.apex.ApexLanguageModule;
import net.sourceforge.pmd.lang.ast.RootNode;
import net.sourceforge.pmd.lang.ast.test.BaseParsingHelper;
@@ -22,4 +24,9 @@ public class ApexParsingHelper extends BaseParsingHelper
-
-
+
+
- "Lexical error in file " + net.sourceforge.pmd.lang.ast.impl.javacc.AbstractTokenManager.getFileName() + " at line "
+ "Lexical error in file " + net.sourceforge.pmd.lang.ast.AbstractTokenManager.getFileName() + " at line "
documentMaker) {
+ return new SimpleCharStream(input);
+ }
+
+ /**
+ * A char stream that translates java unicode sequences.
+ */
+ public static CharStream javaCharStream(Reader input) {
+ return javaCharStream(input, TokenDocument::new);
+ }
+
+ /**
+ * A char stream that translates java unicode sequences.
+ */
+ public static CharStream javaCharStream(Reader input, Function super String, ? extends TokenDocument> documentMaker) {
+ String source = toString(input);
+ return new JavaCharStream(source);
+ }
+
+ /**
+ * @deprecated This shouldn't be used. IOExceptions should be handled properly,
+ * ie it should be expected that creating a parse may throw an IOException,
+ * in both CPD and PMD
+ */
+ @Deprecated
+ public static String toString(Reader dstream) {
+ try (Reader r = dstream) {
+ return IOUtils.toString(r);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/pmd-cpp/etc/grammar/cpp.jj b/pmd-cpp/etc/grammar/cpp.jj
index ed0145dda2..6367635f4d 100644
--- a/pmd-cpp/etc/grammar/cpp.jj
+++ b/pmd-cpp/etc/grammar/cpp.jj
@@ -32,7 +32,7 @@ options {
PARSER_BEGIN(CppParser)
package net.sourceforge.pmd.lang.cpp.ast;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
public final class CppParser {
diff --git a/pmd-cpp/src/main/ant/alljavacc.xml b/pmd-cpp/src/main/ant/alljavacc.xml
index 13a825f14a..d78f708cbb 100644
--- a/pmd-cpp/src/main/ant/alljavacc.xml
+++ b/pmd-cpp/src/main/ant/alljavacc.xml
@@ -36,7 +36,7 @@
javacchome="${javacc-home.path}" />
+ value="class CppParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-cpp/src/main/java/net/sourceforge/pmd/lang/cpp/CppCharStream.java b/pmd-cpp/src/main/java/net/sourceforge/pmd/lang/cpp/CppCharStream.java
index 8afb53f0d9..97e9540b85 100644
--- a/pmd-cpp/src/main/java/net/sourceforge/pmd/lang/cpp/CppCharStream.java
+++ b/pmd-cpp/src/main/java/net/sourceforge/pmd/lang/cpp/CppCharStream.java
@@ -8,7 +8,7 @@ import java.io.IOException;
import java.io.Reader;
import java.util.regex.Pattern;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.SimpleCharStream;
/**
* A SimpleCharStream, that supports the continuation of lines via backslash+newline,
diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt
index c938b8aed5..6ade4c23d3 100644
--- a/pmd-java/etc/grammar/Java.jjt
+++ b/pmd-java/etc/grammar/Java.jjt
@@ -250,7 +250,7 @@ package net.sourceforge.pmd.lang.java.ast;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.GenericToken;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
@@ -394,7 +394,7 @@ TOKEN_MGR_DECLS :
SPECIAL_TOKEN :
{
- // those are private, just for code organisation
+ // those are private, just for code organisation
< #HORIZONTAL_WHITESPACE: [" ", "\t", "\f"] >
| < #LINE_TERMINATOR: "\n" | "\r" | "\r\n" >
// this one is pushed, notice the (..)+ construct, to avoid
@@ -1551,7 +1551,7 @@ ASTCompilationUnit CompilationUnit() :
{
jjtThis.setComments(token_source.comments);
- jjtThis.setTokenDocument(((net.sourceforge.pmd.lang.ast.impl.javacc.JavaCharStream) token_source.input_stream).getTokenDocument());
+ jjtThis.setTokenDocument(((net.sourceforge.pmd.lang.ast.JavaCharStream) token_source.input_stream).getTokenDocument());
return jjtThis;
}
}
@@ -3003,15 +3003,15 @@ void AssertStatement() :
void RUNSIGNEDSHIFT() #void:
{}
{
- LOOKAHEAD({ JavaTokenFactory.getRealKind(getToken(1)) == RUNSIGNEDSHIFT})
- ">" ">" ">"
+ LOOKAHEAD({ JavaTokenFactory.getRealKind(getToken(1)) == RUNSIGNEDSHIFT})
+ ">" ">" ">"
}
void RSIGNEDSHIFT() #void:
{}
{
- LOOKAHEAD({ JavaTokenFactory.getRealKind(getToken(1)) == RSIGNEDSHIFT})
- ">" ">"
+ LOOKAHEAD({ JavaTokenFactory.getRealKind(getToken(1)) == RSIGNEDSHIFT})
+ ">" ">"
}
/* Annotation syntax follows. */
diff --git a/pmd-java/src/main/ant/alljavacc.xml b/pmd-java/src/main/ant/alljavacc.xml
index e16d618d9a..e62ef6c23d 100644
--- a/pmd-java/src/main/ant/alljavacc.xml
+++ b/pmd-java/src/main/ant/alljavacc.xml
@@ -15,6 +15,10 @@
+
+
+
+
-
-
+
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -177,8 +174,8 @@
+ token="class JavaParserTokenManager"
+ value="class JavaParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
@@ -193,8 +190,6 @@
-
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaTokenManager.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaTokenManager.java
index ca7297c43a..4371e11903 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaTokenManager.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaTokenManager.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.java;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.JavaCharStream;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.java.ast.JavaParserTokenManager;
/**
@@ -17,7 +17,7 @@ public class JavaTokenManager implements TokenManager {
private final JavaParserTokenManager tokenManager;
public JavaTokenManager(Reader source) {
- tokenManager = new JavaParserTokenManager(new JavaCharStream(source));
+ tokenManager = new JavaParserTokenManager(CharStreamFactory.javaCharStream(source));
}
@Override
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AbstractJavaNode.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AbstractJavaNode.java
index 3d90298a70..00cc064de6 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AbstractJavaNode.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AbstractJavaNode.java
@@ -7,10 +7,14 @@ package net.sourceforge.pmd.lang.java.ast;
import org.apache.commons.lang3.ArrayUtils;
import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.NonNull;
+
+import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.AbstractNode;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.java.symbols.table.JSymbolTable;
+import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.symboltable.Scope;
abstract class AbstractJavaNode extends AbstractNode implements JavaNode {
@@ -58,6 +62,7 @@ abstract class AbstractJavaNode extends AbstractNode implements JavaNode {
}
}
+
@Override
public JavaNode jjtGetParent() {
return (JavaNode) super.jjtGetParent();
@@ -105,7 +110,6 @@ abstract class AbstractJavaNode extends AbstractNode implements JavaNode {
return scope;
}
-
@Override
public CharSequence getText() {
if (text == null) {
@@ -295,7 +299,7 @@ abstract class AbstractJavaNode extends AbstractNode implements JavaNode {
}
@Override
- public String getXPathNodeName() {
+ public final String getXPathNodeName() {
return JavaParserTreeConstants.jjtNodeName[id];
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/Comment.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/Comment.java
index c745c9f741..fa66566766 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/Comment.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/Comment.java
@@ -14,7 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import net.sourceforge.pmd.PMD;
import net.sourceforge.pmd.lang.ast.AbstractNode;
-import net.sourceforge.pmd.lang.ast.GenericToken;
+import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
public abstract class Comment extends AbstractNode {
// single regex, that captures: the start of a multi-line comment (/**|/*), the start of a single line comment (//)
@@ -24,10 +24,12 @@ public abstract class Comment extends AbstractNode {
// Same as "\\R" - but \\R is only available with java8+
static final Pattern NEWLINES_PATTERN = Pattern.compile("\\u000D\\u000A|[\\u000A\\u000B\\u000C\\u000D\\u0085\\u2028\\u2029]");
- protected Comment(GenericToken t) {
+ protected Comment(JavaccToken t) {
super(-1);
setImage(t.getImage());
+ jjtSetFirstToken(t);
+ jjtSetLastToken(t);
}
@Override
@@ -35,6 +37,7 @@ public abstract class Comment extends AbstractNode {
return getImage();
}
+
/**
* Filters the comment by removing the leading comment marker (like {@code *}) of each line
* as well as the start markers ({@code //}, {@code /*} or {@code /**}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/DummyJavaNode.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/DummyJavaNode.java
index d0a27568dd..6eb44ab97b 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/DummyJavaNode.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/DummyJavaNode.java
@@ -26,16 +26,13 @@ public class DummyJavaNode extends AbstractJavaNode {
super(parser, id);
}
-
@Override
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
- return visitor.visit(this, data);
+ return data;
}
-
@Override
public void jjtAccept(SideEffectingVisitor visitor, T data) {
- visitor.visit(this, data);
+ // do nothing
}
-
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/FormalComment.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/FormalComment.java
index 7faa85c011..8920d25414 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/FormalComment.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/FormalComment.java
@@ -9,15 +9,15 @@ import java.util.Collection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import net.sourceforge.pmd.lang.ast.GenericToken;
import net.sourceforge.pmd.lang.ast.Node;
+import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.java.javadoc.JavadocTag;
public class FormalComment extends Comment {
private static final Pattern JAVADOC_TAG = Pattern.compile("@([A-Za-z0-9]+)");
- public FormalComment(GenericToken t) {
+ public FormalComment(JavaccToken t) {
super(t);
findJavadocs();
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/InternalApiBridge.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/InternalApiBridge.java
index 59ee0d9a48..1524dcdb48 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/InternalApiBridge.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/InternalApiBridge.java
@@ -8,8 +8,8 @@ import java.io.Reader;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ParserOptions;
-import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractTokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.JavaCharStream;
+import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.java.ast.internal.LanguageLevelChecker;
import net.sourceforge.pmd.lang.java.qname.JavaOperationQualifiedName;
import net.sourceforge.pmd.lang.java.qname.JavaTypeQualifiedName;
@@ -69,7 +69,7 @@ public final class InternalApiBridge {
}
public static ASTCompilationUnit parseInternal(String fileName, Reader source, LanguageLevelChecker> checker, ParserOptions options) {
- JavaParser parser = new JavaParser(new JavaCharStream(source));
+ JavaParser parser = new JavaParser(CharStreamFactory.javaCharStream(source));
String suppressMarker = options.getSuppressMarker();
if (suppressMarker != null) {
parser.setSuppressMarker(suppressMarker);
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaTokenFactory.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaTokenFactory.java
index 3b82883821..8ae7dea203 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaTokenFactory.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/JavaTokenFactory.java
@@ -5,8 +5,8 @@
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.lang.ast.impl.TokenDocument;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
-import net.sourceforge.pmd.lang.ast.impl.javacc.JavaCharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
+import net.sourceforge.pmd.lang.ast.JavaCharStream;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
/**
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/MultiLineComment.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/MultiLineComment.java
index 9eb08301a6..c8532e9a00 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/MultiLineComment.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/MultiLineComment.java
@@ -4,11 +4,11 @@
package net.sourceforge.pmd.lang.java.ast;
-import net.sourceforge.pmd.lang.ast.GenericToken;
+import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
public class MultiLineComment extends Comment {
- public MultiLineComment(GenericToken t) {
+ public MultiLineComment(JavaccToken t) {
super(t);
}
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SingleLineComment.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SingleLineComment.java
index a8f9832682..f02ba836d0 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SingleLineComment.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/SingleLineComment.java
@@ -4,11 +4,11 @@
package net.sourceforge.pmd.lang.java.ast;
-import net.sourceforge.pmd.lang.ast.GenericToken;
+import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
public class SingleLineComment extends Comment {
- public SingleLineComment(GenericToken t) {
+ public SingleLineComment(JavaccToken t) {
super(t);
}
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java
index 11a956f110..644c9daac7 100644
--- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java
@@ -16,6 +16,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import net.sourceforge.pmd.lang.ast.ParseException;
import net.sourceforge.pmd.lang.java.JavaParsingHelper;
import net.sourceforge.pmd.lang.symboltable.NameDeclaration;
import net.sourceforge.pmd.lang.symboltable.NameOccurrence;
@@ -24,7 +25,7 @@ public class ParserCornersTest {
private static final String MULTICATCH = "public class Foo { public void bar() { "
+ "try { System.out.println(); } catch (RuntimeException | IOException e) {} } }";
- private final JavaParsingHelper java = JavaParsingHelper.JUST_PARSE.withResourceContext(ParserCornersTest.class);
+ private final JavaParsingHelper java = JavaParsingHelper.WITH_PROCESSING.withResourceContext(ParserCornersTest.class);
private final JavaParsingHelper java8 = java.withDefaultVersion("1.8");
private final JavaParsingHelper java4 = java.withDefaultVersion("1.4");
private final JavaParsingHelper java5 = java.withDefaultVersion("1.5");
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/dfa/StructureTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/dfa/StructureTest.java
index 33f145751e..4bba4dad93 100644
--- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/dfa/StructureTest.java
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/dfa/StructureTest.java
@@ -10,19 +10,19 @@ import org.junit.Ignore;
import org.junit.Test;
import net.sourceforge.pmd.lang.LanguageRegistry;
-import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.dfa.Structure;
import net.sourceforge.pmd.lang.java.JavaLanguageModule;
import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
+import net.sourceforge.pmd.lang.java.symboltable.BaseNonParserTest;
@Ignore
-public class StructureTest {
+public class StructureTest extends BaseNonParserTest {
@Test
public void testAddResultsinDFANodeContainingAddedNode() {
+ ASTMethodDeclaration n = java.parse("class Foo { void foo() { } }").descendants(ASTMethodDeclaration.class).first();
Structure s = new Structure(LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getDefaultVersion()
- .getLanguageVersionHandler().getDataFlowHandler());
- Node n = new ASTMethodDeclaration(1);
+ .getLanguageVersionHandler().getDataFlowHandler());
assertEquals(n, s.createNewNode(n).getNode());
}
diff --git a/pmd-javascript/etc/grammar/es5.jj b/pmd-javascript/etc/grammar/es5.jj
index 4878bc295f..688692d61d 100644
--- a/pmd-javascript/etc/grammar/es5.jj
+++ b/pmd-javascript/etc/grammar/es5.jj
@@ -15,7 +15,7 @@ options {
PARSER_BEGIN(Ecmascript5Parser)
package net.sourceforge.pmd.lang.ecmascript5.ast;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
public class Ecmascript5Parser {
diff --git a/pmd-javascript/src/main/ant/alljavacc.xml b/pmd-javascript/src/main/ant/alljavacc.xml
index 8cbcad70bd..6f7a0a7bc4 100644
--- a/pmd-javascript/src/main/ant/alljavacc.xml
+++ b/pmd-javascript/src/main/ant/alljavacc.xml
@@ -36,7 +36,7 @@
javacchome="${javacc-home.path}" />
+ value="class Ecmascript5ParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript5/Ecmascript5TokenManager.java b/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript5/Ecmascript5TokenManager.java
index 292801dd6f..634a1283d1 100644
--- a/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript5/Ecmascript5TokenManager.java
+++ b/pmd-javascript/src/main/java/net/sourceforge/pmd/lang/ecmascript5/Ecmascript5TokenManager.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.ecmascript5;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.ecmascript5.ast.Ecmascript5ParserTokenManager;
/**
@@ -23,7 +23,7 @@ public class Ecmascript5TokenManager implements TokenManager {
* the source code
*/
public Ecmascript5TokenManager(Reader source) {
- tokenManager = new Ecmascript5ParserTokenManager(new SimpleCharStream(source));
+ tokenManager = new Ecmascript5ParserTokenManager(CharStreamFactory.simpleCharStream(source));
}
@Override
diff --git a/pmd-jsp/etc/grammar/JspParser.jjt b/pmd-jsp/etc/grammar/JspParser.jjt
index af2c3540e7..9e27e3550a 100644
--- a/pmd-jsp/etc/grammar/JspParser.jjt
+++ b/pmd-jsp/etc/grammar/JspParser.jjt
@@ -31,7 +31,7 @@ options {
PARSER_BEGIN(JspParser)
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
/**
diff --git a/pmd-jsp/src/main/ant/alljavacc.xml b/pmd-jsp/src/main/ant/alljavacc.xml
index 87aaa7524e..34207aa4a6 100644
--- a/pmd-jsp/src/main/ant/alljavacc.xml
+++ b/pmd-jsp/src/main/ant/alljavacc.xml
@@ -45,7 +45,7 @@
+ value="class JspParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspParser.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspParser.java
index 780670c391..0ee4e8ab22 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspParser.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspParser.java
@@ -11,8 +11,8 @@ import net.sourceforge.pmd.lang.ParserOptions;
import net.sourceforge.pmd.lang.TokenManager;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.ParseException;
-import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractTokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
/**
* Adapter for the JspParser.
@@ -31,7 +31,7 @@ public class JspParser extends AbstractParser {
@Override
public Node parse(String fileName, Reader source) throws ParseException {
AbstractTokenManager.setFileName(fileName);
- return new net.sourceforge.pmd.lang.jsp.ast.JspParser(new SimpleCharStream(source)).CompilationUnit();
+ return new net.sourceforge.pmd.lang.jsp.ast.JspParser(CharStreamFactory.simpleCharStream(source)).CompilationUnit();
}
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspTokenManager.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspTokenManager.java
index 1342951e4a..e10a66daf0 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspTokenManager.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspTokenManager.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.jsp;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.JavaCharStream;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.jsp.ast.JspParserTokenManager;
/**
@@ -17,7 +17,7 @@ public class JspTokenManager implements TokenManager {
private final JspParserTokenManager tokenManager;
public JspTokenManager(Reader source) {
- tokenManager = new JspParserTokenManager(new JavaCharStream(source));
+ tokenManager = new JspParserTokenManager(CharStreamFactory.javaCharStream(source));
}
@Override
diff --git a/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/ast/test/BaseParsingHelper.kt b/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/ast/test/BaseParsingHelper.kt
index 1c509ab5e0..6a58f5cd0c 100644
--- a/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/ast/test/BaseParsingHelper.kt
+++ b/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/ast/test/BaseParsingHelper.kt
@@ -128,7 +128,7 @@ abstract class BaseParsingHelper, T : RootNode
/**
* Called only if [Params.doProcess] is true.
*/
- protected open fun postProcessing(handler: LanguageVersionHandler, lversion: LanguageVersion, rootNode: T?) {
+ protected open fun postProcessing(handler: LanguageVersionHandler, lversion: LanguageVersion, rootNode: T) {
val astAnalysisContext = object : AstAnalysisContext {
override fun getTypeResolutionClassLoader(): ClassLoader = javaClass.classLoader
diff --git a/pmd-matlab/etc/grammar/matlab.jj b/pmd-matlab/etc/grammar/matlab.jj
index 2ab9d58fe0..90042f37e8 100644
--- a/pmd-matlab/etc/grammar/matlab.jj
+++ b/pmd-matlab/etc/grammar/matlab.jj
@@ -21,7 +21,7 @@ options {
PARSER_BEGIN(MatlabParser)
package net.sourceforge.pmd.lang.matlab.ast;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
public class MatlabParser {
diff --git a/pmd-matlab/src/main/ant/alljavacc.xml b/pmd-matlab/src/main/ant/alljavacc.xml
index a9bd18eeca..ecf431f7b6 100644
--- a/pmd-matlab/src/main/ant/alljavacc.xml
+++ b/pmd-matlab/src/main/ant/alljavacc.xml
@@ -36,7 +36,7 @@
javacchome="${javacc-home.path}" />
+ value="class MatlabParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-matlab/src/main/java/net/sourceforge/pmd/lang/matlab/MatlabTokenManager.java b/pmd-matlab/src/main/java/net/sourceforge/pmd/lang/matlab/MatlabTokenManager.java
index 4ce5151c09..911edc29fc 100644
--- a/pmd-matlab/src/main/java/net/sourceforge/pmd/lang/matlab/MatlabTokenManager.java
+++ b/pmd-matlab/src/main/java/net/sourceforge/pmd/lang/matlab/MatlabTokenManager.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.matlab;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.matlab.ast.MatlabParserTokenManager;
/**
@@ -23,7 +23,7 @@ public class MatlabTokenManager implements TokenManager {
* the source code
*/
public MatlabTokenManager(Reader source) {
- tokenManager = new MatlabParserTokenManager(new SimpleCharStream(source));
+ tokenManager = new MatlabParserTokenManager(CharStreamFactory.simpleCharStream(source));
}
@Override
diff --git a/pmd-modelica/etc/grammar/Modelica.jjt b/pmd-modelica/etc/grammar/Modelica.jjt
index 494156de46..33a786817d 100644
--- a/pmd-modelica/etc/grammar/Modelica.jjt
+++ b/pmd-modelica/etc/grammar/Modelica.jjt
@@ -48,7 +48,7 @@ options {
PARSER_BEGIN(ModelicaParser)
package net.sourceforge.pmd.lang.modelica.ast;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
public class ModelicaParser {
diff --git a/pmd-modelica/pom.xml b/pmd-modelica/pom.xml
index cea911d768..31c8498ea8 100644
--- a/pmd-modelica/pom.xml
+++ b/pmd-modelica/pom.xml
@@ -77,18 +77,6 @@
pmd-core
-
-
- org.junit.vintage
- junit-vintage-engine
- test
-
-
- net.sourceforge.pmd
- pmd-lang-test
- test
-
-
net.sourceforge.pmd
pmd-lang-test
diff --git a/pmd-modelica/src/main/ant/alljavacc.xml b/pmd-modelica/src/main/ant/alljavacc.xml
index f6d3e73e2d..866f4be282 100644
--- a/pmd-modelica/src/main/ant/alljavacc.xml
+++ b/pmd-modelica/src/main/ant/alljavacc.xml
@@ -44,7 +44,7 @@
+ value="class ModelicaParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ModelicaParser.java b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ModelicaParser.java
index c0afd23d0b..4533c03c48 100644
--- a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ModelicaParser.java
+++ b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ModelicaParser.java
@@ -11,8 +11,8 @@ import net.sourceforge.pmd.lang.ParserOptions;
import net.sourceforge.pmd.lang.TokenManager;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.ParseException;
-import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractTokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
public class ModelicaParser extends AbstractParser {
@@ -28,7 +28,7 @@ public class ModelicaParser extends AbstractParser {
@Override
public Node parse(String fileName, Reader source) throws ParseException {
AbstractTokenManager.setFileName(fileName);
- return new net.sourceforge.pmd.lang.modelica.ast.ModelicaParser(new SimpleCharStream(source)).StoredDefinition();
+ return new net.sourceforge.pmd.lang.modelica.ast.ModelicaParser(CharStreamFactory.simpleCharStream(source)).StoredDefinition();
}
}
diff --git a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ModelicaTokenManager.java b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ModelicaTokenManager.java
index ff1d17ea84..4d4b75ccd9 100644
--- a/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ModelicaTokenManager.java
+++ b/pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ModelicaTokenManager.java
@@ -7,8 +7,8 @@ package net.sourceforge.pmd.lang.modelica;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractTokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.modelica.ast.ModelicaParserTokenManager;
@@ -16,7 +16,7 @@ public class ModelicaTokenManager implements TokenManager {
private final ModelicaParserTokenManager modelicaParserTokenManager;
public ModelicaTokenManager(final Reader source) {
- modelicaParserTokenManager = new ModelicaParserTokenManager(new SimpleCharStream(source));
+ modelicaParserTokenManager = new ModelicaParserTokenManager(CharStreamFactory.simpleCharStream(source));
}
@Override
diff --git a/pmd-objectivec/etc/grammar/ObjC2.0.jj b/pmd-objectivec/etc/grammar/ObjC2.0.jj
index 37837f282b..f25936bdfa 100644
--- a/pmd-objectivec/etc/grammar/ObjC2.0.jj
+++ b/pmd-objectivec/etc/grammar/ObjC2.0.jj
@@ -21,7 +21,7 @@ package net.sourceforge.pmd.lang.objectivec.ast;
import java.io.*;
import java.util.*;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
/**
diff --git a/pmd-objectivec/src/main/ant/alljavacc.xml b/pmd-objectivec/src/main/ant/alljavacc.xml
index 3e6cae2ad5..26ab8cd3d9 100644
--- a/pmd-objectivec/src/main/ant/alljavacc.xml
+++ b/pmd-objectivec/src/main/ant/alljavacc.xml
@@ -36,7 +36,7 @@
javacchome="${javacc-home.path}" />
+ value="class ObjectiveCParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-objectivec/src/main/java/net/sourceforge/pmd/lang/objectivec/ObjectiveCTokenManager.java b/pmd-objectivec/src/main/java/net/sourceforge/pmd/lang/objectivec/ObjectiveCTokenManager.java
index 0d95984498..28ff5c6ebb 100644
--- a/pmd-objectivec/src/main/java/net/sourceforge/pmd/lang/objectivec/ObjectiveCTokenManager.java
+++ b/pmd-objectivec/src/main/java/net/sourceforge/pmd/lang/objectivec/ObjectiveCTokenManager.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.objectivec;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.objectivec.ast.ObjectiveCParserTokenManager;
/**
@@ -23,7 +23,7 @@ public class ObjectiveCTokenManager implements TokenManager {
* the source code
*/
public ObjectiveCTokenManager(Reader source) {
- tokenManager = new ObjectiveCParserTokenManager(new SimpleCharStream(source));
+ tokenManager = new ObjectiveCParserTokenManager(CharStreamFactory.simpleCharStream(source));
}
@Override
diff --git a/pmd-plsql/etc/grammar/PldocAST.jjt b/pmd-plsql/etc/grammar/PldocAST.jjt
index ce35c24916..bf99e5a152 100644
--- a/pmd-plsql/etc/grammar/PldocAST.jjt
+++ b/pmd-plsql/etc/grammar/PldocAST.jjt
@@ -115,7 +115,7 @@ options {
JAVA_UNICODE_ESCAPE = false; //true
UNICODE_INPUT = true;
USER_TOKEN_MANAGER = false;
- USER_CHAR_STREAM = false;
+ USER_CHAR_STREAM = true;
BUILD_PARSER = true;
BUILD_TOKEN_MANAGER = true;
SANITY_CHECK = true;
@@ -155,32 +155,11 @@ package net.sourceforge.pmd.lang.plsql.ast;
import java.io.*;
import net.sourceforge.pmd.lang.ast.Node;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
public class PLSQLParser {
- /**
- * main method, for testing only.
- * @param args
- */
- public static void main(String[] args)
- throws ParseException {
-
- PLSQLParser parser = new PLSQLParser(System.in);
- PLSQLNode node = parser.Input("");
-
- String s;
- s = "qwerty";
-// System.err.println(s + " -> " + parser.purifyIdentifier(s));
- s = "\"qwerty\"";
-// System.err.println(s + " -> " + parser.purifyIdentifier(s));
- s = "\"qwerty\".uiop";
-// System.err.println(s + " -> " + parser.purifyIdentifier(s));
- s = "\"qwerty\".\"uiop\"";
-// System.err.println(s + " -> " + parser.purifyIdentifier(s));
- }
-
/**
Return canonical version of the Oracle
*/
diff --git a/pmd-plsql/src/main/ant/alljavacc.xml b/pmd-plsql/src/main/ant/alljavacc.xml
index 3636d10959..aa78c81a12 100644
--- a/pmd-plsql/src/main/ant/alljavacc.xml
+++ b/pmd-plsql/src/main/ant/alljavacc.xml
@@ -33,14 +33,13 @@
javacchome="${javacc-home.path}" />
-
+
@@ -80,7 +79,7 @@
value="PLSQLNode" />
+ value="class PLSQLParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
public class
+ value="class PythonParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-python/src/main/java/net/sourceforge/pmd/lang/python/PythonTokenManager.java b/pmd-python/src/main/java/net/sourceforge/pmd/lang/python/PythonTokenManager.java
index c80b6be501..881c190b57 100644
--- a/pmd-python/src/main/java/net/sourceforge/pmd/lang/python/PythonTokenManager.java
+++ b/pmd-python/src/main/java/net/sourceforge/pmd/lang/python/PythonTokenManager.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.python;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.python.ast.PythonParserTokenManager;
/**
@@ -23,7 +23,7 @@ public class PythonTokenManager implements TokenManager {
* the source code
*/
public PythonTokenManager(Reader source) {
- tokenManager = new PythonParserTokenManager(new SimpleCharStream(source));
+ tokenManager = new PythonParserTokenManager(CharStreamFactory.simpleCharStream(source));
}
@Override
diff --git a/pmd-visualforce/etc/grammar/VfParser.jjt b/pmd-visualforce/etc/grammar/VfParser.jjt
index f1ae19b8f3..5e1bbf20d1 100644
--- a/pmd-visualforce/etc/grammar/VfParser.jjt
+++ b/pmd-visualforce/etc/grammar/VfParser.jjt
@@ -14,7 +14,7 @@ options {
PARSER_BEGIN(VfParser)
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
public class VfParser {
diff --git a/pmd-visualforce/src/main/ant/alljavacc.xml b/pmd-visualforce/src/main/ant/alljavacc.xml
index f3e8198e2f..c3650bdc0e 100644
--- a/pmd-visualforce/src/main/ant/alljavacc.xml
+++ b/pmd-visualforce/src/main/ant/alljavacc.xml
@@ -46,7 +46,7 @@
+ value="class VfParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfParser.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfParser.java
index b23c992d87..79cd8f5e01 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfParser.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfParser.java
@@ -9,9 +9,10 @@ import java.io.Reader;
import net.sourceforge.pmd.lang.AbstractParser;
import net.sourceforge.pmd.lang.ParserOptions;
import net.sourceforge.pmd.lang.TokenManager;
+import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.ParseException;
-import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractTokenManager;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
/**
* Adapter for the VfParser.
@@ -30,7 +31,7 @@ public class VfParser extends AbstractParser {
@Override
public Node parse(String fileName, Reader source) throws ParseException {
AbstractTokenManager.setFileName(fileName);
- return new net.sourceforge.pmd.lang.vf.ast.VfParser(new VfSimpleCharStream(source)).CompilationUnit();
+ return new net.sourceforge.pmd.lang.vf.ast.VfParser(CharStreamFactory.simpleCharStream(source)).CompilationUnit();
}
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfSimpleCharStream.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfSimpleCharStream.java
deleted file mode 100644
index b3b1bda907..0000000000
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfSimpleCharStream.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.vf;
-
-import java.io.Reader;
-
-import net.sourceforge.pmd.lang.ast.impl.javacc.SimpleCharStream;
-
-/**
- * @author sergey.gorbaty
- *
- */
-public class VfSimpleCharStream extends SimpleCharStream {
-
- public VfSimpleCharStream(Reader dstream) {
- super(dstream);
- tabSize = 4;
- }
-
-}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfTokenManager.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfTokenManager.java
index 9d531d4f1c..42b55f3ba6 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfTokenManager.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfTokenManager.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.vf;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.JavaCharStream;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
import net.sourceforge.pmd.lang.vf.ast.VfParserTokenManager;
/**
@@ -17,7 +17,7 @@ public class VfTokenManager implements TokenManager {
private final VfParserTokenManager tokenManager;
public VfTokenManager(Reader source) {
- tokenManager = new VfParserTokenManager(new JavaCharStream(source));
+ tokenManager = new VfParserTokenManager(CharStreamFactory.javaCharStream(source));
}
@Override
diff --git a/pmd-vm/etc/grammar/VmParser.jjt b/pmd-vm/etc/grammar/VmParser.jjt
index 497449a2c8..4fab39c65a 100644
--- a/pmd-vm/etc/grammar/VmParser.jjt
+++ b/pmd-vm/etc/grammar/VmParser.jjt
@@ -93,7 +93,7 @@ import java.util.List;
import java.util.HashMap;
import java.util.Map;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.vm.directive.Directive;
import net.sourceforge.pmd.lang.vm.util.VelocityCharStream;
import net.sourceforge.pmd.lang.vm.util.DirectiveMapper;
diff --git a/pmd-vm/src/main/ant/alljavacc.xml b/pmd-vm/src/main/ant/alljavacc.xml
index d71ec6bbfb..845e8da6f7 100644
--- a/pmd-vm/src/main/ant/alljavacc.xml
+++ b/pmd-vm/src/main/ant/alljavacc.xml
@@ -46,7 +46,7 @@
+ value="class VmParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmParser.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmParser.java
index c124a87ba3..812d924b86 100644
--- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmParser.java
+++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmParser.java
@@ -9,9 +9,9 @@ import java.io.Reader;
import net.sourceforge.pmd.lang.AbstractParser;
import net.sourceforge.pmd.lang.ParserOptions;
import net.sourceforge.pmd.lang.TokenManager;
+import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.ParseException;
-import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractTokenManager;
import net.sourceforge.pmd.lang.vm.util.VelocityCharStream;
/**
diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmTokenManager.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmTokenManager.java
index 228bbabbfc..4d8f01e46c 100644
--- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmTokenManager.java
+++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmTokenManager.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.lang.vm;
import java.io.Reader;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractTokenManager;
+import net.sourceforge.pmd.lang.ast.AbstractTokenManager;
import net.sourceforge.pmd.lang.vm.ast.VmParserTokenManager;
import net.sourceforge.pmd.lang.vm.util.VelocityCharStream;
diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/VelocityCharStream.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/VelocityCharStream.java
index cd6b536ec6..78a3e91fa3 100644
--- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/VelocityCharStream.java
+++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/VelocityCharStream.java
@@ -1,7 +1,7 @@
package net.sourceforge.pmd.lang.vm.util;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
+import net.sourceforge.pmd.lang.ast.CharStream;
/*
* Licensed to the Apache Software Foundation (ASF) under one