internal xfor(For f) { initializer = parser(f.initializer); condition = parser(f.condition); incrementer = parser(f.incrementer); body = parser(f.body); }
internal xbinaryop(BinaryOp bo) { operand1 = parser(bo.operand1); operand2 = parser(bo.operand2); oper = bo.operatorTok; }
internal xunaryop(UnaryOp uo) { operand = parser(uo.operand); }
internal xassing(Assign a) { lside = parser(a.lhside); rside = parser(a.rhside); }
internal xexpr(Expression e) { operand = parser(e.operand); }
internal xif(If i) { condition = parser(i.condition); operand1 = parser(i.operand1); operand2 = parser(i.operand2); }
internal xvardeclare(VariableDeclaration vd) { identifier = (xlookup)parser(vd.identifier); initializer = parser(vd.initializer); }
internal xwhile(While w) { condition = parser(w.condition); body = parser(w.body); }
internal xcall(Call c) { func = parser(c.func); args = parser(c.args) as xastlist; }
public xast parser(AST ast) { xast ret = null; if (ast == null) { } else if (ast is VariableDeclaration) { ret = new xvardeclare((VariableDeclaration)ast); } else if (ast is Assign) { ret = new xassing((Assign)ast); } else if (ast is If) { ret = new xif((If)ast); } else if (ast is While) { ret = new xwhile((While)ast); } else if (ast is Expression) { ret = new xexpr((Expression)ast); } else if (ast is Block) { ret = new xblock((Block)ast); } else if (ast is ConstantWrapper) { ret = new xconstantwrapper((ConstantWrapper)ast); } else if (ast is For) { ret = new xfor((For)ast); } else if (ast is Call) { ret = new xcall((Call)ast); } else if (ast is Equality) { ret = new xequality((Equality)ast); } else if (ast is Relational) { ret = new xrelational((Relational)ast); } else if (ast is PostOrPrefixOperator) { ret = new xpostorprefixoperator((PostOrPrefixOperator)ast); } else if (ast is Lookup) { ret = new xlookup((Lookup)ast); } else if (ast is Call) { ret = new xcall((Call)ast); } else if (ast is ASTList) { ret = new xastlist((ASTList)ast); } return(ret); }