use of net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor in project pmd by pmd.
the class PLSQLRuleChainVisitor method indexNodes.
@Override
protected void indexNodes(List<Node> nodes, RuleContext ctx) {
LOGGER.entering(CLASS_NAME, "indexNodes");
PLSQLParserVisitor plsqlParserVistor = new PLSQLParserVisitorAdapter() {
// Perform a visitation of the AST to index nodes which need
// visiting by type
@Override
public Object visit(PLSQLNode node, Object data) {
indexNode(node);
return super.visit(node, data);
}
};
for (int i = 0; i < nodes.size(); i++) {
plsqlParserVistor.visit((ASTInput) nodes.get(i), ctx);
}
LOGGER.exiting(CLASS_NAME, "indexNodes");
}
use of net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor in project pmd by pmd.
the class AbstractPLSQLParserTst method getNodes.
public <E> Set<E> getNodes(LanguageVersion languageVersion, Class<E> clazz, String plsqlCode) {
Collector<E> coll = new Collector<>(clazz);
LanguageVersionHandler languageVersionHandler = languageVersion.getLanguageVersionHandler();
ASTInput cu = (ASTInput) languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions()).parse(null, new StringReader(plsqlCode));
PLSQLParserVisitor jpv = (PLSQLParserVisitor) Proxy.newProxyInstance(PLSQLParserVisitor.class.getClassLoader(), new Class[] { PLSQLParserVisitor.class }, coll);
jpv.visit(cu, null);
return (Set<E>) coll.getCollection();
}
use of net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor in project pmd by pmd.
the class AbstractPLSQLParserTst method buildDFA.
public ASTInput buildDFA(String plsqlCode) {
LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(PLSQLLanguageModule.NAME).getDefaultVersion().getLanguageVersionHandler();
ASTInput cu = (ASTInput) languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions()).parse(null, new StringReader(plsqlCode));
PLSQLParserVisitor jpv = (PLSQLParserVisitor) Proxy.newProxyInstance(PLSQLParserVisitor.class.getClassLoader(), new Class[] { PLSQLParserVisitor.class }, new Collector<>(ASTInput.class));
jpv.visit(cu, null);
new SymbolFacade().initializeWith(cu);
new DataFlowFacade().initializeWith(languageVersionHandler.getDataFlowHandler(), cu);
return cu;
}
use of net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor in project pmd by pmd.
the class AbstractPLSQLParserTst method getOrderedNodes.
public <E> List<E> getOrderedNodes(Class<E> clazz, String plsqlCode) {
Collector<E> coll = new Collector<>(clazz, new ArrayList<E>());
LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(PLSQLLanguageModule.NAME).getDefaultVersion().getLanguageVersionHandler();
ASTInput cu = (ASTInput) languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions()).parse(null, new StringReader(plsqlCode));
PLSQLParserVisitor jpv = (PLSQLParserVisitor) Proxy.newProxyInstance(PLSQLParserVisitor.class.getClassLoader(), new Class[] { PLSQLParserVisitor.class }, coll);
jpv.visit(cu, null);
SymbolFacade sf = new SymbolFacade();
sf.initializeWith(cu);
DataFlowFacade dff = new DataFlowFacade();
dff.initializeWith(languageVersionHandler.getDataFlowHandler(), cu);
return (List<E>) coll.getCollection();
}
Aggregations