1 16 17 package org.apache.commons.jexl.parser; 18 19 import org.apache.commons.jexl.JexlContext; 20 21 27 public class ASTAssignment extends SimpleNode { 28 33 public ASTAssignment(int id) { 34 super(id); 35 } 36 37 43 public ASTAssignment(Parser p, int id) { 44 super(p, id); 45 } 46 47 48 public Object jjtAccept(ParserVisitor visitor, Object data) { 49 return visitor.visit(this, data); 50 } 51 52 53 public Object value(JexlContext context) throws Exception { 54 SimpleNode left = (SimpleNode) jjtGetChild(0); 56 Object right = ((SimpleNode) jjtGetChild(1)).value(context); 58 if (left instanceof ASTReference) { 59 ASTReference reference = (ASTReference) left; 60 left = (SimpleNode) reference.jjtGetChild(0); 61 if (left instanceof ASTIdentifier) { 62 String identifier = ((ASTIdentifier) left) 63 .getIdentifierString(); 64 context.getVars().put(identifier, right); 65 } 66 } 67 return right; 68 } 69 } 70 | Popular Tags |