first commit

This commit is contained in:
2025-07-28 13:56:49 +05:30
commit e9eb805edb
3438 changed files with 520990 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package org.nfunk.jep.function;
import java.util.Stack;
import org.nfunk.jep.ASTVarNode;
import org.nfunk.jep.Node;
import org.nfunk.jep.ParseException;
import org.nfunk.jep.ParserVisitor;
import org.nfunk.jep.Variable;
public class Assign extends PostfixMathCommand implements SpecialEvaluationI {
public Object evaluate(Node paramNode, Object paramObject, ParserVisitor paramParserVisitor, Stack paramStack) throws ParseException {
if (paramNode.jjtGetNumChildren() != 2)
throw new ParseException("Assignment opperator must have 2 operators.");
paramNode.jjtGetChild(1).jjtAccept(paramParserVisitor, paramObject);
checkStack(paramStack);
Object object = paramStack.peek();
Node node = paramNode.jjtGetChild(0);
if (node instanceof ASTVarNode) {
ASTVarNode aSTVarNode = (ASTVarNode)node;
Variable variable = aSTVarNode.getVar();
variable.setValue(object);
return object;
}
throw new ParseException("Assignment should have a variable for the lhs.");
}
}