diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AntlrTokenizer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/internal/AntlrTokenizer.java similarity index 86% rename from pmd-core/src/main/java/net/sourceforge/pmd/cpd/AntlrTokenizer.java rename to pmd-core/src/main/java/net/sourceforge/pmd/cpd/internal/AntlrTokenizer.java index 46097b54fb..3310732cb0 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AntlrTokenizer.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/internal/AntlrTokenizer.java @@ -1,25 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.cpd; +package net.sourceforge.pmd.cpd.internal; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.CharStreams; -import net.sourceforge.pmd.annotation.InternalApi; +import net.sourceforge.pmd.cpd.SourceCode; +import net.sourceforge.pmd.cpd.TokenEntry; +import net.sourceforge.pmd.cpd.Tokenizer; +import net.sourceforge.pmd.cpd.Tokens; import net.sourceforge.pmd.cpd.token.AntlrToken; import net.sourceforge.pmd.cpd.token.AntlrTokenFilter; -import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; import net.sourceforge.pmd.lang.ast.TokenMgrError; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager; /** * Generic implementation of a {@link Tokenizer} useful to any Antlr grammar. - * - * @deprecated This is an internal API. */ -@Deprecated -@InternalApi public abstract class AntlrTokenizer implements Tokenizer { protected abstract AntlrTokenManager getLexerForSource(SourceCode sourceCode); @@ -53,7 +52,7 @@ public abstract class AntlrTokenizer implements Tokenizer { return new AntlrTokenFilter(tokenManager); } - /* default */ static CharStream getCharStreamFromSourceCode(final SourceCode sourceCode) { + public static CharStream getCharStreamFromSourceCode(final SourceCode sourceCode) { StringBuilder buffer = sourceCode.getCodeBuffer(); return CharStreams.fromString(buffer.toString()); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/token/AntlrTokenFilter.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/token/AntlrTokenFilter.java index c76332d69e..f358bddfc9 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/token/AntlrTokenFilter.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/token/AntlrTokenFilter.java @@ -7,7 +7,7 @@ package net.sourceforge.pmd.cpd.token; import static org.antlr.v4.runtime.Token.EOF; import net.sourceforge.pmd.cpd.token.internal.BaseTokenFilter; -import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager; /** * A generic filter for Antlr-based token managers that allows to use comments diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AbstractAntlrVisitor.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AbstractAntlrVisitor.java similarity index 95% rename from pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AbstractAntlrVisitor.java rename to pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AbstractAntlrVisitor.java index 2a8c7a832e..299d541422 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AbstractAntlrVisitor.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AbstractAntlrVisitor.java @@ -1,8 +1,8 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.antlr; +package net.sourceforge.pmd.lang.ast.impl.antlr4; import java.util.List; @@ -13,7 +13,6 @@ import org.antlr.v4.runtime.tree.RuleNode; import org.antlr.v4.runtime.tree.TerminalNode; import net.sourceforge.pmd.RuleContext; -import net.sourceforge.pmd.lang.ast.AntlrBaseNode; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.rule.AbstractRule; diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AntlrBaseNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseNode.java similarity index 96% rename from pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AntlrBaseNode.java rename to pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseNode.java index c3db1237e2..42bedee6c4 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AntlrBaseNode.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseNode.java @@ -1,13 +1,14 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.ast; +package net.sourceforge.pmd.lang.ast.impl.antlr4; import java.util.stream.Stream; import org.antlr.v4.runtime.ParserRuleContext; +import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.dfa.DataFlowNode; public class AntlrBaseNode extends ParserRuleContext implements AntlrNode { @@ -101,7 +102,7 @@ public class AntlrBaseNode extends ParserRuleContext implements AntlrNode { public int jjtGetNumChildren() { return (int) childrenStream().count(); } - + private Stream childrenStream() { return children == null ? Stream.empty() : children.stream().filter(e -> e instanceof Node).map(e -> (Node) e); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrBaseParser.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseParser.java similarity index 94% rename from pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrBaseParser.java rename to pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseParser.java index acca252b9c..f827bc4e1a 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrBaseParser.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseParser.java @@ -1,8 +1,8 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.antlr; +package net.sourceforge.pmd.lang.ast.impl.antlr4; import java.io.IOException; import java.io.Reader; @@ -14,7 +14,6 @@ import org.antlr.v4.runtime.Lexer; import net.sourceforge.pmd.lang.Parser; import net.sourceforge.pmd.lang.ParserOptions; import net.sourceforge.pmd.lang.TokenManager; -import net.sourceforge.pmd.lang.ast.AntlrBaseNode; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.ast.ParseException; diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseRootNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseRootNode.java new file mode 100644 index 0000000000..e31bfd728a --- /dev/null +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrBaseRootNode.java @@ -0,0 +1,31 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.ast.impl.antlr4; + +import org.antlr.v4.runtime.ParserRuleContext; + +import net.sourceforge.pmd.lang.ast.RootNode; + +public class AntlrBaseRootNode extends AntlrBaseNode implements RootNode { + + /** + * Constructor required by {@link ParserRuleContext} + */ + @SuppressWarnings("unused") + public AntlrBaseRootNode() { + super(); + } + + /** + * Constructor required by {@link ParserRuleContext} + * + * @param parent The parent + * @param invokingStateNumber the invokingState defined by {@link org.antlr.v4.runtime.RuleContext} parent + */ + @SuppressWarnings("unused") + public AntlrBaseRootNode(final ParserRuleContext parent, final int invokingStateNumber) { + super(parent, invokingStateNumber); + } +} diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AntlrNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrNode.java similarity index 95% rename from pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AntlrNode.java rename to pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrNode.java index a246f368de..810d8e78bf 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AntlrNode.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrNode.java @@ -1,8 +1,10 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.ast; +package net.sourceforge.pmd.lang.ast.impl.antlr4; + +import net.sourceforge.pmd.lang.ast.Node; /** * Base interface for all Antlr-based implementation of Node interface. diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrRuleChainVisitor.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrRuleChainVisitor.java similarity index 93% rename from pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrRuleChainVisitor.java rename to pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrRuleChainVisitor.java index b20d6146de..b23a978275 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrRuleChainVisitor.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrRuleChainVisitor.java @@ -1,14 +1,13 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.antlr; +package net.sourceforge.pmd.lang.ast.impl.antlr4; import java.util.List; import net.sourceforge.pmd.Rule; import net.sourceforge.pmd.RuleContext; -import net.sourceforge.pmd.lang.ast.AntlrBaseNode; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.rule.AbstractRuleChainVisitor; import net.sourceforge.pmd.lang.rule.XPathRule; diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrRuleViolationFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrRuleViolationFactory.java similarity index 93% rename from pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrRuleViolationFactory.java rename to pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrRuleViolationFactory.java index 8d2584643e..b7d74c45a7 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrRuleViolationFactory.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrRuleViolationFactory.java @@ -1,13 +1,12 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.antlr; +package net.sourceforge.pmd.lang.ast.impl.antlr4; import net.sourceforge.pmd.Rule; import net.sourceforge.pmd.RuleContext; import net.sourceforge.pmd.RuleViolation; -import net.sourceforge.pmd.lang.ast.AntlrBaseNode; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.rule.AbstractRuleViolationFactory; import net.sourceforge.pmd.lang.rule.ParametricRuleViolation; diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrTokenManager.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrTokenManager.java similarity index 98% rename from pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrTokenManager.java rename to pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrTokenManager.java index 55cb99e124..19905322e3 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/antlr/AntlrTokenManager.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/impl/antlr4/AntlrTokenManager.java @@ -1,8 +1,8 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -package net.sourceforge.pmd.lang.antlr; +package net.sourceforge.pmd.lang.ast.impl.antlr4; import org.antlr.v4.runtime.BaseErrorListener; import org.antlr.v4.runtime.Lexer; diff --git a/pmd-dart/src/main/java/net/sourceforge/pmd/cpd/DartTokenizer.java b/pmd-dart/src/main/java/net/sourceforge/pmd/cpd/DartTokenizer.java index d8a53823d6..9afb02b1dd 100644 --- a/pmd-dart/src/main/java/net/sourceforge/pmd/cpd/DartTokenizer.java +++ b/pmd-dart/src/main/java/net/sourceforge/pmd/cpd/DartTokenizer.java @@ -6,9 +6,10 @@ package net.sourceforge.pmd.cpd; import org.antlr.v4.runtime.CharStream; +import net.sourceforge.pmd.cpd.internal.AntlrTokenizer; import net.sourceforge.pmd.cpd.token.AntlrToken; import net.sourceforge.pmd.cpd.token.AntlrTokenFilter; -import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager; import net.sourceforge.pmd.lang.dart.antlr4.Dart2Lexer; /** diff --git a/pmd-go/src/main/java/net/sourceforge/pmd/cpd/GoTokenizer.java b/pmd-go/src/main/java/net/sourceforge/pmd/cpd/GoTokenizer.java index 2d46bbf82b..ff99a98129 100644 --- a/pmd-go/src/main/java/net/sourceforge/pmd/cpd/GoTokenizer.java +++ b/pmd-go/src/main/java/net/sourceforge/pmd/cpd/GoTokenizer.java @@ -6,7 +6,8 @@ package net.sourceforge.pmd.cpd; import org.antlr.v4.runtime.CharStream; -import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; +import net.sourceforge.pmd.cpd.internal.AntlrTokenizer; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager; import net.sourceforge.pmd.lang.go.antlr4.GolangLexer; /** diff --git a/pmd-kotlin/src/main/java/net/sourceforge/pmd/cpd/KotlinTokenizer.java b/pmd-kotlin/src/main/java/net/sourceforge/pmd/cpd/KotlinTokenizer.java index dcfe0da1c0..963ea09c3c 100644 --- a/pmd-kotlin/src/main/java/net/sourceforge/pmd/cpd/KotlinTokenizer.java +++ b/pmd-kotlin/src/main/java/net/sourceforge/pmd/cpd/KotlinTokenizer.java @@ -6,9 +6,10 @@ package net.sourceforge.pmd.cpd; import org.antlr.v4.runtime.CharStream; +import net.sourceforge.pmd.cpd.internal.AntlrTokenizer; import net.sourceforge.pmd.cpd.token.AntlrToken; import net.sourceforge.pmd.cpd.token.AntlrTokenFilter; -import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager; import net.sourceforge.pmd.lang.kotlin.antlr4.Kotlin; /** diff --git a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java index 23c292dbe7..effae4f797 100644 --- a/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java +++ b/pmd-lua/src/main/java/net/sourceforge/pmd/cpd/LuaTokenizer.java @@ -6,8 +6,9 @@ package net.sourceforge.pmd.cpd; import org.antlr.v4.runtime.CharStream; +import net.sourceforge.pmd.cpd.internal.AntlrTokenizer; import net.sourceforge.pmd.cpd.token.AntlrTokenFilter; -import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager; import net.sourceforge.pmd.lang.lua.antlr4.LuaLexer; /** diff --git a/pmd-swift/pom.xml b/pmd-swift/pom.xml index 1a36cd7acf..9d696d4aaa 100644 --- a/pmd-swift/pom.xml +++ b/pmd-swift/pom.xml @@ -27,7 +27,7 @@ true - antlr-generation + antlr-cleanup generate-sources diff --git a/pmd-swift/src/main/ant/antlr4.xml b/pmd-swift/src/main/ant/antlr4.xml index 223ee17f10..14b0522aa4 100644 --- a/pmd-swift/src/main/ant/antlr4.xml +++ b/pmd-swift/src/main/ant/antlr4.xml @@ -1,19 +1,16 @@ - + + token="TopLevelContext extends AntlrBaseNode" + value="TopLevelContext extends AntlrBaseRootNode" /> - - \ No newline at end of file + diff --git a/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/antlr4/Swift.g4 b/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/ast/Swift.g4 similarity index 99% rename from pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/antlr4/Swift.g4 rename to pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/ast/Swift.g4 index 0eb9f7517e..a5345ee6c5 100644 --- a/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/antlr4/Swift.g4 +++ b/pmd-swift/src/main/antlr4/net/sourceforge/pmd/lang/swift/ast/Swift.g4 @@ -33,11 +33,13 @@ */ grammar Swift; -/* @header { -package com.sleekbyte.tailor.antlr; +import net.sourceforge.pmd.lang.ast.impl.antlr4.*; +} + +options { + contextSuperClass = AntlrBaseNode; } -*/ topLevel : statements? EOF ; diff --git a/pmd-swift/src/main/java/net/sourceforge/pmd/cpd/SwiftTokenizer.java b/pmd-swift/src/main/java/net/sourceforge/pmd/cpd/SwiftTokenizer.java index d97b1e6426..d18cd28793 100644 --- a/pmd-swift/src/main/java/net/sourceforge/pmd/cpd/SwiftTokenizer.java +++ b/pmd-swift/src/main/java/net/sourceforge/pmd/cpd/SwiftTokenizer.java @@ -6,8 +6,9 @@ package net.sourceforge.pmd.cpd; import org.antlr.v4.runtime.CharStream; -import net.sourceforge.pmd.lang.antlr.AntlrTokenManager; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftLexer; +import net.sourceforge.pmd.cpd.internal.AntlrTokenizer; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrTokenManager; +import net.sourceforge.pmd.lang.swift.ast.SwiftLexer; /** * SwiftTokenizer diff --git a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/AbstractSwiftRule.java b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/AbstractSwiftRule.java index 62c94cc4a6..a6003aabee 100644 --- a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/AbstractSwiftRule.java +++ b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/AbstractSwiftRule.java @@ -5,7 +5,7 @@ package net.sourceforge.pmd.lang.swift; import net.sourceforge.pmd.lang.LanguageRegistry; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftBaseVisitor; +import net.sourceforge.pmd.lang.swift.ast.SwiftBaseVisitor; public abstract class AbstractSwiftRule extends SwiftBaseVisitor { public AbstractSwiftRule() { diff --git a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftHandler.java b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftHandler.java index 0ed33998ab..3a40fd323f 100644 --- a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftHandler.java +++ b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftHandler.java @@ -8,7 +8,7 @@ import net.sourceforge.pmd.lang.AbstractPmdLanguageVersionHandler; import net.sourceforge.pmd.lang.Parser; import net.sourceforge.pmd.lang.ParserOptions; import net.sourceforge.pmd.lang.XPathHandler; -import net.sourceforge.pmd.lang.antlr.AntlrRuleViolationFactory; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrRuleViolationFactory; import net.sourceforge.pmd.lang.ast.xpath.DefaultASTXPathHandler; import net.sourceforge.pmd.lang.rule.RuleViolationFactory; diff --git a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java index abb1a9406c..0099446c35 100644 --- a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java +++ b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.java @@ -5,7 +5,7 @@ package net.sourceforge.pmd.lang.swift; import net.sourceforge.pmd.lang.BaseLanguageModule; -import net.sourceforge.pmd.lang.antlr.AntlrRuleChainVisitor; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrRuleChainVisitor; /** * Language Module for Swift diff --git a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftParserAdapter.java b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftParserAdapter.java index c7082ef804..064e9cbf28 100644 --- a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftParserAdapter.java +++ b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/SwiftParserAdapter.java @@ -12,10 +12,10 @@ import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.Lexer; import net.sourceforge.pmd.lang.ParserOptions; -import net.sourceforge.pmd.lang.antlr.AntlrBaseParser; -import net.sourceforge.pmd.lang.ast.AntlrBaseNode; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftLexer; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftParser; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrBaseParser; +import net.sourceforge.pmd.lang.ast.impl.antlr4.AntlrBaseNode; +import net.sourceforge.pmd.lang.swift.ast.SwiftLexer; +import net.sourceforge.pmd.lang.swift.ast.SwiftParser; /** * Adapter for the SwiftParser. diff --git a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/ProhibitedInterfaceBuilderRule.java b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/ProhibitedInterfaceBuilderRule.java index 494c92e0a9..cd20f4d4fe 100644 --- a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/ProhibitedInterfaceBuilderRule.java +++ b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/ProhibitedInterfaceBuilderRule.java @@ -8,9 +8,9 @@ import java.util.List; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.swift.AbstractSwiftRule; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftParser; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftParser.FunctionHeadContext; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftParser.VariableDeclarationHeadContext; +import net.sourceforge.pmd.lang.swift.ast.SwiftParser; +import net.sourceforge.pmd.lang.swift.ast.SwiftParser.FunctionHeadContext; +import net.sourceforge.pmd.lang.swift.ast.SwiftParser.VariableDeclarationHeadContext; public class ProhibitedInterfaceBuilderRule extends AbstractSwiftRule { @@ -22,7 +22,7 @@ public class ProhibitedInterfaceBuilderRule extends AbstractSwiftRule { addRuleChainVisit(FunctionHeadContext.class); addRuleChainVisit(VariableDeclarationHeadContext.class); } - + @Override public Void visitFunctionHead(FunctionHeadContext ctx) { if (ctx == null || ctx.attributes() == null) { diff --git a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java index 5033ac773a..31935d0b2b 100644 --- a/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java +++ b/pmd-swift/src/main/java/net/sourceforge/pmd/lang/swift/rule/bestpractices/UnavailableFunctionRule.java @@ -7,9 +7,9 @@ package net.sourceforge.pmd.lang.swift.rule.bestpractices; import java.util.List; import net.sourceforge.pmd.lang.swift.AbstractSwiftRule; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftParser; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftParser.FunctionDeclarationContext; -import net.sourceforge.pmd.lang.swift.antlr4.SwiftParser.InitializerDeclarationContext; +import net.sourceforge.pmd.lang.swift.ast.SwiftParser; +import net.sourceforge.pmd.lang.swift.ast.SwiftParser.FunctionDeclarationContext; +import net.sourceforge.pmd.lang.swift.ast.SwiftParser.InitializerDeclarationContext; public class UnavailableFunctionRule extends AbstractSwiftRule {