示例#1
0
  /*
    case_label =
    {constant} case minus? integer_constant |
    {default}  default;
  */
  public void outAConstantCaseLabel(AConstantCaseLabel node) {
    String s = (String) mProductions.removeLast();
    int sign = 1;
    if (node.getMinus() != null) sign = -1;

    if (s.endsWith("L")) {
      mProductions.addLast(LongConstant.v(sign * Long.parseLong(s.substring(0, s.length() - 1))));
    } else mProductions.addLast(IntConstant.v(sign * Integer.parseInt(s)));
  }
示例#2
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)));
  }