All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.plsql.ast.AbstractPLSQLNode Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
/*
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */

package net.sourceforge.pmd.lang.plsql.ast;

import net.sourceforge.pmd.lang.ast.AstVisitor;
import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode;
import net.sourceforge.pmd.lang.symboltable.Scope;

abstract class AbstractPLSQLNode extends AbstractJjtreeNode implements PLSQLNode {

    protected Object value;
    protected PLSQLParser parser;
    protected Scope scope;

    AbstractPLSQLNode(int i) {
        super(i);
    }

    @Override // override to make protected member accessible to parser
    protected void setImage(String image) {
        super.setImage(image);
    }

    protected void jjtSetValue(Object value) {
        this.value = value;
    }

    public Object jjtGetValue() {
        return value;
    }

    protected abstract  R acceptPlsqlVisitor(PlsqlVisitor visitor, P data);

    @Override
    @SuppressWarnings("unchecked")
    public final  R acceptVisitor(AstVisitor visitor, P data) {
        if (visitor instanceof PlsqlVisitor) {
            return acceptPlsqlVisitor((PlsqlVisitor) visitor, data);
        }
        return visitor.cannotVisit(this, data);
    }

    @Override
    public String getXPathNodeName() {
        return PLSQLParserImplTreeConstants.jjtNodeName[id];
    }


    @Override
    public Scope getScope() {
        if (scope == null) {
            return getParent().getScope();
        }
        return scope;
    }

    void setScope(Scope scope) {
        this.scope = scope;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy