public class Define extends PostfixMathCommand implements CommandVisitorI
XJep > Define("half",1,"x/2")
XJep > half(5)
Currently the Define function is handled in the preprocessing step
Node n = xj.parse("Define(\"sumToX\",1,\"x*(x+1)/2\")");
Node preproc = xj.preprocess(n);
and preproc will be null if a Define statement is encountered.
This is probably a bug.
TODO improve syntax. So can have Define("half(x)",x/2)
TODO work out how to simplify and evaluate Define statements which don't really have a value.
TODO fix parser so can do half(x) = x/2curNumberOfParameters, numberOfParameters| Modifier and Type | Method and Description |
|---|---|
Node |
process(Node node,
Node[] children,
XJep xjep)
Performs the specified action on an expression tree.
|
checkNumberOfParameters, checkStack, getNumberOfParameters, run, setCurNumberOfParameterspublic Define(XJep xj)
public Node process(Node node, Node[] children, XJep xjep) throws ParseException
CommandVisitorIprocess in interface CommandVisitorInode - top node of the treechildren - the children of the node after they have been preprocessed.xjep - a reference to the current XJep interface.ParseException - exceptionCopyright © 2018. All rights reserved.