Search in sources :

Example 6 with Structure

use of net.sourceforge.pmd.lang.dfa.Structure in project pmd by pmd.

the class StatementAndBraceFinder method visit.

@Override
public Object visit(ASTContinueStatement node, Object data) {
    if (!(data instanceof Structure)) {
        return data;
    }
    Structure dataFlow = (Structure) data;
    dataFlow.createNewNode(node);
    dataFlow.pushOnStack(NodeType.CONTINUE_STATEMENT, dataFlow.getLast());
    tryToLog(NodeType.CONTINUE_STATEMENT, node);
    return super.visit(node, data);
}
Also used : Structure(net.sourceforge.pmd.lang.dfa.Structure)

Example 7 with Structure

use of net.sourceforge.pmd.lang.dfa.Structure in project pmd by pmd.

the class StatementAndBraceFinder method visit.

@Override
public Object visit(ASTVariableDeclarator node, Object data) {
    if (!(data instanceof Structure)) {
        return data;
    }
    Structure dataFlow = (Structure) data;
    if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("createNewNode ASTVariableDeclarator: line " + node.getBeginLine() + ", column " + node.getBeginColumn());
    }
    dataFlow.createNewNode(node);
    return super.visit(node, data);
}
Also used : Structure(net.sourceforge.pmd.lang.dfa.Structure)

Example 8 with Structure

use of net.sourceforge.pmd.lang.dfa.Structure in project pmd by pmd.

the class StatementAndBraceFinder method buildDataFlowFor.

public void buildDataFlowFor(PLSQLNode node) {
    LOGGER.entering(this.getClass().getCanonicalName(), "buildDataFlowFor");
    if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("buildDataFlowFor: node class " + node.getClass().getCanonicalName() + " @ line " + node.getBeginLine() + ", column " + node.getBeginColumn() + " --- " + new Throwable().getStackTrace());
    }
    if (!(node instanceof ASTMethodDeclaration) && !(node instanceof ASTProgramUnit) && !(node instanceof ASTTypeMethod) && !(node instanceof ASTTriggerUnit) && !(node instanceof ASTTriggerTimingPointSection)) {
        throw new RuntimeException("Can't build a data flow for anything other than a Method or a Trigger");
    }
    this.dataFlow = new Structure(dataFlowHandler);
    this.dataFlow.createStartNode(node.getBeginLine());
    this.dataFlow.createNewNode(node);
    node.jjtAccept(this, dataFlow);
    this.dataFlow.createEndNode(node.getEndLine());
    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("DataFlow is " + this.dataFlow.dump());
    }
    Linker linker = new Linker(dataFlowHandler, dataFlow.getBraceStack(), dataFlow.getContinueBreakReturnStack());
    try {
        linker.computePaths();
    } catch (LinkerException e) {
        LOGGER.severe("LinkerException");
        e.printStackTrace();
    } catch (SequenceException e) {
        LOGGER.severe("SequenceException");
        e.printStackTrace();
    }
    LOGGER.exiting(this.getClass().getCanonicalName(), "buildDataFlowFor");
}
Also used : ASTTypeMethod(net.sourceforge.pmd.lang.plsql.ast.ASTTypeMethod) LinkerException(net.sourceforge.pmd.lang.dfa.LinkerException) ASTTriggerUnit(net.sourceforge.pmd.lang.plsql.ast.ASTTriggerUnit) ASTMethodDeclaration(net.sourceforge.pmd.lang.plsql.ast.ASTMethodDeclaration) SequenceException(net.sourceforge.pmd.lang.dfa.SequenceException) ASTTriggerTimingPointSection(net.sourceforge.pmd.lang.plsql.ast.ASTTriggerTimingPointSection) Structure(net.sourceforge.pmd.lang.dfa.Structure) Linker(net.sourceforge.pmd.lang.dfa.Linker) ASTProgramUnit(net.sourceforge.pmd.lang.plsql.ast.ASTProgramUnit)

Example 9 with Structure

use of net.sourceforge.pmd.lang.dfa.Structure in project pmd by pmd.

the class StatementAndBraceFinder method visit.

@Override
public Object visit(ASTPipelineStatement node, Object data) {
    if (!(data instanceof Structure)) {
        return data;
    }
    Structure dataFlow = (Structure) data;
    dataFlow.createNewNode(node);
    if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("createNewNode ASTPipelineStatement: line " + node.getBeginLine() + ", column " + node.getBeginColumn());
    }
    return super.visit(node, data);
}
Also used : Structure(net.sourceforge.pmd.lang.dfa.Structure)

Example 10 with Structure

use of net.sourceforge.pmd.lang.dfa.Structure in project pmd by pmd.

the class StatementAndBraceFinder method visit.

/**
 * Treat a PLSQL CONTINUE like a Java "continue"
 *
 * @param node
 * @param data
 * @return
 */
@Override
public Object visit(ASTContinueStatement node, Object data) {
    if (!(data instanceof Structure)) {
        return data;
    }
    Structure dataFlow = (Structure) data;
    dataFlow.createNewNode(node);
    dataFlow.pushOnStack(NodeType.CONTINUE_STATEMENT, dataFlow.getLast());
    if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("pushOnStack (ASTContinueStatement) CONTINUE_STATEMENT: line " + node.getBeginLine() + ", column " + node.getBeginColumn());
    }
    return super.visit(node, data);
}
Also used : Structure(net.sourceforge.pmd.lang.dfa.Structure)

Aggregations

Structure (net.sourceforge.pmd.lang.dfa.Structure)36 Node (net.sourceforge.pmd.lang.ast.Node)2 Linker (net.sourceforge.pmd.lang.dfa.Linker)2 LinkerException (net.sourceforge.pmd.lang.dfa.LinkerException)2 SequenceException (net.sourceforge.pmd.lang.dfa.SequenceException)2 ASTDoStatement (net.sourceforge.pmd.lang.java.ast.ASTDoStatement)2 ASTForStatement (net.sourceforge.pmd.lang.java.ast.ASTForStatement)2 ASTIfStatement (net.sourceforge.pmd.lang.java.ast.ASTIfStatement)2 ASTMethodDeclaration (net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration)2 ASTWhileStatement (net.sourceforge.pmd.lang.java.ast.ASTWhileStatement)2 ASTElseClause (net.sourceforge.pmd.lang.plsql.ast.ASTElseClause)2 ASTElsifClause (net.sourceforge.pmd.lang.plsql.ast.ASTElsifClause)2 ASTForStatement (net.sourceforge.pmd.lang.plsql.ast.ASTForStatement)2 ASTIfStatement (net.sourceforge.pmd.lang.plsql.ast.ASTIfStatement)2 ASTLabelledStatement (net.sourceforge.pmd.lang.plsql.ast.ASTLabelledStatement)2 ASTLoopStatement (net.sourceforge.pmd.lang.plsql.ast.ASTLoopStatement)2 ASTWhileStatement (net.sourceforge.pmd.lang.plsql.ast.ASTWhileStatement)2 List (java.util.List)1 ASTAssertStatement (net.sourceforge.pmd.lang.java.ast.ASTAssertStatement)1 ASTConstructorDeclaration (net.sourceforge.pmd.lang.java.ast.ASTConstructorDeclaration)1