this.parser.eatWhiteSpace();
if (varName.toString().equals("true")) {
if (neg) {
throw new EACompileError("Invalid negative sign.");
}
ProgramNode v = this.holder.getFunctions().factorProgramNode("#const",
holder, new ProgramNode[] {});
v.getData()[0] = new ExpressionValue(true);
outputQueue(v);
} else if (varName.toString().equals("false")) {
if (neg) {
throw new EACompileError("Invalid negative sign.");
}
ProgramNode v = this.holder.getFunctions().factorProgramNode("#const",
holder, new ProgramNode[] {});
v.getData()[0] = new ExpressionValue(false);
outputQueue(v);
} else if (this.parser.peek() != '(') {
ProgramNode v;
// either a variable or a const, see which
if (this.holder.getFunctions().isDefined(varName.toString(), 0)) {
v = this.holder.getFunctions().factorProgramNode(
varName.toString(), holder, new ProgramNode[] {});
} else {
this.holder.getVariables().setVariable(varName.toString(),
new ExpressionValue(0));
v = this.holder.getFunctions().factorProgramNode("#var", holder,
new ProgramNode[] {});
v.getData()[0] = new ExpressionValue((int) this.holder.getVariables()
.getVariableIndex(varName.toString()));
}
if (neg) {
v = this.holder.getFunctions().factorProgramNode("-", holder,
new ProgramNode[] { v });
}
outputQueue(v);
} else {
ProgramExtensionTemplate temp = this.holder.getFunctions()
.findFunction(varName.toString());
if (temp == null) {
throw new EACompileError("Undefined function: "
+ varName.toString());
}
functionQueue(temp);
}
}