}
@Override
public Token eval(AbstractClass<?> caller, Token parameters, AbstractFrame frame) throws ArrayIndexOutOfBoundsException, IllegalArgumentException, InterpreterException {
if (parameters.getCarType().equals(Interpreter.curlyBracesType)) { //This is a contents-initialized array
Token value = (Token) parameters.getCar();
ArrayList<Variable<?>> values = new ArrayList<>();
do {
Token val = new Token(), head = val;
do {
head = head.append(value.singular());
} while (!(value = value.getNextToken()).isNull() && !value.getCarType().equals(Interpreter.separatorType));
if ((Variable<?>) getSource() instanceof ArrayClass)
values.add((Variable<?>) (val.getCarType().equals(Interpreter.curlyBracesType) ? getSource().eval(caller, val, frame).getCar() : Interpreter.evalInner(caller, val, frame).getCar()));
else
values.add((Variable<?>) frame.getInterpreter().eval(caller, val.getFirstToken(), frame).getCar());
} while (!(value = value.getNextToken()).isNull());
Object source = Array.newInstance(Variable.class, values.size());
for (int i = 0; i < values.size(); i++)
Array.set(source, i, values.get(i));
return new Token(new ArrayObject((AbstractClass<Object>) getSource(), source), getTokenType());
}
int length = ((Variable<Integer>) parameters.getCar()).getSource();
Object source = Array.newInstance(Variable.class, length);
if ((parameters = parameters.getNextToken()).isNull())
for (int i = 0; i < length; i++)
Array.set(source, i, Interpreter.NULL);
else
for (int i = 0; i < length; i++)
Array.set(source, i, getSource().eval(caller, parameters, frame).getCar());
return new Token(new ArrayObject(this, source), getTokenType());
}