/* SCCS - @(#)TrinaryExprNode.java 1.2 - 02/28/99 - 12:39:25 */ /* * Copyright (c) 1997 USC Brain Project. email nsl@java.usc.edu. */ package npp.src.util; import pp.src.jbf.*; public class TrinaryExprNode extends ExprNode { public TrinaryExprNode(ExprNode l, ExprNode m, ExprNode r) { super(l); left = l; mid = m; right = r; } /** * Code generation. * @param npp Nsl Preprocessor * @return error value */ public int genCode(NslPreProcessor npp) { left.genCode(npp); mid.genCode(npp); right.genCode(npp); type = mid.type; code = "("+left.code + ")?(" + mid.code +"):(" + right.code +")"; if (left.processed || mid.processed || right.processed) processed = true; if (left.type.type!=TypeNode.BOOL) { System.err.println("TriExpr: line "+(left.lineno+1)+ " char "+(left.charno+1)+ "\tOperand before '?' must be boolean type"); } return NO_OP; } // return error code final public static int NO_OP = 0; public ExprNode left; public ExprNode mid; public ExprNode right; }