1 8 package org.lsmp.djep.xjep; 9 10 import org.nfunk.jep.*; 11 import org.nfunk.jep.function.*; 12 13 21 public class XAssign extends Assign implements CommandVisitorI { 22 23 public XAssign() {} 24 { 25 numberOfParameters = 2; 26 } 27 28 31 public Node process(Node node,Node children[],XJep xjep) throws ParseException 32 { 33 if(node.jjtGetNumChildren()!=2) 34 throw new ParseException("Assignment opperator must have 2 operators."); 35 36 38 Node lhsNode = children[0]; 40 if(lhsNode instanceof ASTVarNode) 41 { 42 ASTVarNode vn = (ASTVarNode) lhsNode; 43 XVariable var = (XVariable) vn.getVar(); 44 var.setEquation(xjep.deepCopy(children[1])); 45 TreeUtils.copyChildrenIfNeeded(node,children); 46 return node; 47 } 48 throw new ParseException("Assignment should have a variable for the lhs."); 49 } 50 } 51 | Popular Tags |