Example #1
0
 public void visitBinary(JCBinary tree) {
   try {
     int ownprec = TreeInfo.opPrec(tree.getTag());
     String opname = operatorName(tree.getTag());
     open(prec, ownprec);
     printExpr(tree.lhs, ownprec);
     print(" " + opname + " ");
     printExpr(tree.rhs, ownprec + 1);
     close(prec, ownprec);
   } catch (IOException e) {
     throw new UncheckedIOException(e);
   }
 }
Example #2
0
 public void visitUnary(JCUnary tree) {
   try {
     int ownprec = TreeInfo.opPrec(tree.getTag());
     String opname = operatorName(tree.getTag());
     open(prec, ownprec);
     if (tree.getTag() <= JCTree.PREDEC) {
       print(opname);
       printExpr(tree.arg, ownprec);
     } else {
       printExpr(tree.arg, ownprec);
       print(opname);
     }
     close(prec, ownprec);
   } catch (IOException e) {
     throw new UncheckedIOException(e);
   }
 }