// Evaluate and print an expression tree. public static void Print(VsaEngine engine, JNode expr) { if(expr is JArgList) { Print(engine, ((JArgList)expr).expr1); Print(engine, ((JArgList)expr).expr2); } else { Object value = expr.Eval(engine); String pvalue; if(value is ArrayObject) { pvalue = ArrayPrototype.join(value, String.Empty); } else { pvalue = Convert.ToString(value); } if(pvalue != null) { ScriptStream.WriteLine(pvalue); } } }
// Evaluate an argument list. private static int EvalArgs(Object[] args, int posn, JNode node, VsaEngine engine) { if(node == null) { return posn; } else if(!(node is JArgList)) { args[posn] = node.Eval(engine); return posn + 1; } else { posn = EvalArgs(args, posn, ((JArgList)node).expr1, engine); args[posn] = (((JArgList)node).expr2).Eval(engine); return posn + 1; } }