Don"t add publicly supported API

This commit is contained in:
Clément Fournier
2024-05-11 23:15:31 +02:00
parent 2e9aa06273
commit ffc71e83a2
3 changed files with 11 additions and 9 deletions

View File

@ -6,6 +6,10 @@
package net.sourceforge.pmd.lang.plsql.ast; package net.sourceforge.pmd.lang.plsql.ast;
import net.sourceforge.pmd.annotation.InternalApi; import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.TokenManager;
import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.document.TextDocument;
import net.sourceforge.pmd.lang.symboltable.NameDeclaration; import net.sourceforge.pmd.lang.symboltable.NameDeclaration;
import net.sourceforge.pmd.lang.symboltable.Scope; import net.sourceforge.pmd.lang.symboltable.Scope;
@ -36,4 +40,8 @@ public final class InternalApiBridge {
public static void setNameDeclaration(ASTVariableOrConstantDeclaratorId node, NameDeclaration decl) { public static void setNameDeclaration(ASTVariableOrConstantDeclaratorId node, NameDeclaration decl) {
node.setNameDeclaration(decl); node.setNameDeclaration(decl);
} }
public static TokenManager<JavaccToken> newTokenManager(TextDocument doc) {
return PLSQLTokenKinds.newTokenManager(CharStream.create(doc, PLSQLParser.TOKEN_BEHAVIOR));
}
} }

View File

@ -9,7 +9,6 @@ import java.util.Locale;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import net.sourceforge.pmd.benchmark.TimeTracker; import net.sourceforge.pmd.benchmark.TimeTracker;
import net.sourceforge.pmd.lang.TokenManager;
import net.sourceforge.pmd.lang.ast.ParseException; import net.sourceforge.pmd.lang.ast.ParseException;
import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream; import net.sourceforge.pmd.lang.ast.impl.javacc.CharStream;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
@ -17,7 +16,6 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccTokenDocument;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumentBehavior; import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccTokenDocument.TokenDocumentBehavior;
import net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeParserAdapter; import net.sourceforge.pmd.lang.ast.impl.javacc.JjtreeParserAdapter;
import net.sourceforge.pmd.lang.document.Chars; import net.sourceforge.pmd.lang.document.Chars;
import net.sourceforge.pmd.lang.document.TextDocument;
import net.sourceforge.pmd.lang.plsql.symboltable.SymbolFacade; import net.sourceforge.pmd.lang.plsql.symboltable.SymbolFacade;
public class PLSQLParser extends JjtreeParserAdapter<ASTInput> { public class PLSQLParser extends JjtreeParserAdapter<ASTInput> {
@ -44,7 +42,7 @@ public class PLSQLParser extends JjtreeParserAdapter<ASTInput> {
} }
} }
private static final TokenDocumentBehavior TOKEN_BEHAVIOR = new TokenDocumentBehavior(PLSQLTokenKinds.TOKEN_NAMES) { static final TokenDocumentBehavior TOKEN_BEHAVIOR = new TokenDocumentBehavior(PLSQLTokenKinds.TOKEN_NAMES) {
@Override @Override
public JavaccToken createToken(JavaccTokenDocument self, int kind, CharStream cs, @Nullable String image) { public JavaccToken createToken(JavaccTokenDocument self, int kind, CharStream cs, @Nullable String image) {
if (image == null) { if (image == null) {
@ -90,8 +88,4 @@ public class PLSQLParser extends JjtreeParserAdapter<ASTInput> {
return root; return root;
} }
public static TokenManager<JavaccToken> newTokenManager(TextDocument doc) {
return PLSQLTokenKinds.newTokenManager(CharStream.create(doc, TOKEN_BEHAVIOR));
}
} }

View File

@ -10,7 +10,7 @@ import net.sourceforge.pmd.lang.LanguagePropertyBundle;
import net.sourceforge.pmd.lang.TokenManager; import net.sourceforge.pmd.lang.TokenManager;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken; import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.document.TextDocument; import net.sourceforge.pmd.lang.document.TextDocument;
import net.sourceforge.pmd.lang.plsql.ast.PLSQLParser; import net.sourceforge.pmd.lang.plsql.ast.InternalApiBridge;
import net.sourceforge.pmd.lang.plsql.ast.PLSQLTokenKinds; import net.sourceforge.pmd.lang.plsql.ast.PLSQLTokenKinds;
/** /**
@ -54,6 +54,6 @@ public class PLSQLCpdLexer extends JavaccCpdLexer {
@Override @Override
protected TokenManager<JavaccToken> makeLexerImpl(TextDocument doc) { protected TokenManager<JavaccToken> makeLexerImpl(TextDocument doc) {
return PLSQLParser.newTokenManager(doc); return InternalApiBridge.newTokenManager(doc);
} }
} }