Programming-Language-Design / src / ast / expression / classes / ArrayIndexing.java
ArrayIndexing.java
Raw
package ast.expression.classes;

import ast.expression.AbstractExpression;
import ast.expression.Expression;
import visitor.Visitor;

public class ArrayIndexing extends AbstractExpression {

    Expression array;
    Expression index;

    public ArrayIndexing(int line, int column, Expression array, Expression index) {
        super(line, column);
        this.array = array;
        this.index = index;
    }

    public Expression getArray() {
        return array;
    }

    public Expression getIndex() {
        return index;
    }

    @Override
    public String toString() {
        return getArray() + "[" + getIndex() + "]";
    }

    @Override
    public <TP, TR> TR accept(Visitor<TP, TR> v, TP param) {
        return v.visit(this, param);
    }
}