use of net.sourceforge.pmd.lang.plsql.ast.ASTInput 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.ASTInput 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.ASTInput 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