示例#1
0
  public void outAIntegerConstant(AIntegerConstant node) {
    String s = (String) mProductions.removeLast();

    StringBuffer buf = new StringBuffer();
    if (node.getMinus() != null) buf.append('-');
    buf.append(s);

    s = buf.toString();
    if (s.endsWith("L")) {
      mProductions.addLast(LongConstant.v(Long.parseLong(s.substring(0, s.length() - 1))));
    } else mProductions.addLast(IntConstant.v(Integer.parseInt(s)));
  }
  public String toString() {
    StringBuffer buffer = new StringBuffer();

    buffer.append(Jimple.v().STATICINVOKE + " " + methodRef.getSignature() + "(");

    for (int i = 0; i < argBoxes.size(); i++) {
      if (i != 0) buffer.append(", ");

      buffer.append(getArg(i).toString());
    }

    buffer.append(")");

    return buffer.toString();
  }
示例#3
0
  /* ('#' (('-'? 'Infinity') | 'NaN') ('f' | 'F')? ) ; */
  public void outAFloatConstant(AFloatConstant node) {
    String s = (String) mProductions.removeLast();

    boolean isDouble = true;
    float value = 0;
    double dvalue = 0;

    if (s.endsWith("f") || s.endsWith("F")) isDouble = false;

    if (s.charAt(0) == '#') {
      if (s.charAt(1) == '-') {
        if (isDouble) dvalue = Double.NEGATIVE_INFINITY;
        else value = Float.NEGATIVE_INFINITY;
      } else if (s.charAt(1) == 'I') {
        if (isDouble) dvalue = Double.POSITIVE_INFINITY;
        else value = Float.POSITIVE_INFINITY;
      } else {
        if (isDouble) dvalue = Double.NaN;
        else value = Float.NaN;
      }
    } else {
      StringBuffer buf = new StringBuffer();
      if (node.getMinus() != null) buf.append('-');
      buf.append(s);
      s = buf.toString();

      if (isDouble) dvalue = Double.parseDouble(s);
      else value = Float.parseFloat(s);
    }

    Object res;
    if (isDouble) res = DoubleConstant.v(dvalue);
    else res = FloatConstant.v(value);

    mProductions.addLast(res);
  }