Search in sources :

Example 1 with SymbolFacade

use of net.sourceforge.pmd.lang.plsql.symboltable.SymbolFacade 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;
}
Also used : PLSQLParserVisitor(net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor) SymbolFacade(net.sourceforge.pmd.lang.plsql.symboltable.SymbolFacade) StringReader(java.io.StringReader) DataFlowFacade(net.sourceforge.pmd.lang.plsql.dfa.DataFlowFacade) ASTInput(net.sourceforge.pmd.lang.plsql.ast.ASTInput) LanguageVersionHandler(net.sourceforge.pmd.lang.LanguageVersionHandler)

Example 2 with SymbolFacade

use of net.sourceforge.pmd.lang.plsql.symboltable.SymbolFacade 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();
}
Also used : PLSQLParserVisitor(net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor) SymbolFacade(net.sourceforge.pmd.lang.plsql.symboltable.SymbolFacade) StringReader(java.io.StringReader) DataFlowFacade(net.sourceforge.pmd.lang.plsql.dfa.DataFlowFacade) ASTInput(net.sourceforge.pmd.lang.plsql.ast.ASTInput) ArrayList(java.util.ArrayList) List(java.util.List) LanguageVersionHandler(net.sourceforge.pmd.lang.LanguageVersionHandler)

Aggregations

StringReader (java.io.StringReader)2 LanguageVersionHandler (net.sourceforge.pmd.lang.LanguageVersionHandler)2 ASTInput (net.sourceforge.pmd.lang.plsql.ast.ASTInput)2 PLSQLParserVisitor (net.sourceforge.pmd.lang.plsql.ast.PLSQLParserVisitor)2 DataFlowFacade (net.sourceforge.pmd.lang.plsql.dfa.DataFlowFacade)2 SymbolFacade (net.sourceforge.pmd.lang.plsql.symboltable.SymbolFacade)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1