public String strName; //字符串值 private AstNode(ASTNODE_TYPE op, AstNode leftLeaf, AstNode rightLeaf, int intValue, String strName, bool bValue = false) { this.op = op; this.leftLeaf = leftLeaf; this.rightLeaf = rightLeaf; this.intValue = intValue; this.strName = strName; this.bValue = bValue; }
// Make a unary AST node: only one child public static AstNode mkastunary(ASTNODE_TYPE op, AstNode left, int intvalue) { return(mkNode(op, left, null, intvalue, "")); }
public static AstNode mkastleaf(ASTNODE_TYPE op, bool bValue) { return(mkNode(op, null, null, 0, "", bValue)); }
public static AstNode mkastleaf(ASTNODE_TYPE op, String strName) { return(mkNode(op, null, null, 0, strName)); }
// Make an AST leaf node public static AstNode mkastleaf(ASTNODE_TYPE op, int intvalue) { return(mkNode(op, null, null, intvalue, "")); }
public static AstNode mkNodeRight(ASTNODE_TYPE in_op, AstNode in_right, int intValue) { return(new AstNode(in_op, null, in_right, intValue, "")); }
public static AstNode mkNodeLeft(ASTNODE_TYPE in_op, AstNode in_left, int intValue) { return(new AstNode(in_op, in_left, null, intValue, "")); }
public static AstNode mkNodewithNoLeaf(ASTNODE_TYPE in_op) { return(new AstNode(in_op, null, null, 0, "")); }
public static AstNode mkNode(ASTNODE_TYPE in_op, AstNode leftLeaf, AstNode rightLeaf, int intValue, String strName, bool bValue = false) { return(new AstNode(in_op, leftLeaf, rightLeaf, intValue, strName, bValue)); }