示例#1
0
  private void write(StringBuilder b) {

    switch (kind) {
      case Name:
        b.append(name);
        break;
      case Constant:
        b.append(constant);
        break;
      case Function:
        b.append(function.toCode());
        b.append('(');
        boolean f = true;
        for (ExpressionNode n : parameters) {
          if (f) f = false;
          else b.append(", ");
          n.write(b);
        }
        b.append(')');

        break;
      case Group:
        b.append('(');
        group.write(b);
        b.append(')');
    }

    if (inner != null) {
      b.append('.');
      inner.write(b);
    }
    if (operation != null) {
      b.append(' ');
      b.append(operation.toCode());
      b.append(' ');
      opNext.write(b);
    }
  }
示例#2
0
 public String Canonical() {
   StringBuilder b = new StringBuilder();
   write(b);
   return b.toString();
 }