Example #1
0
/* Production 41, chapter 3.4, corba 2.3.1 */
  public void positive_int_const() {
 /*@bgen(jjtree) positive_int_const */
  ASTpositive_int_const jjtn000 = new ASTpositive_int_const(this, IDLParserTreeConstants.JJTPOSITIVE_INT_CONST);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      const_exp();
    } catch (Exception jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
  {if (true) throw ;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }
    /**
     * @see parser.IDLParserVisitor#visit(ASTpositive_int_const, Object)
     */
    public Object visit(ASTpositive_int_const node, Object data) {
        // used for array, bounded seq, ...;
        // evaluate the const-exp:
        Literal result = (Literal)node.jjtGetChild(0).jjtAccept(this, data);
        if (!(result is IntegerLiteral)) {
            throw new InvalidIdlException("invalid positive int const found: " + result.GetValue());
        }
        long intConst = result.GetIntValue();
        if (intConst < 0) {
            throw new InvalidIdlException("negative int found where positive int constant was required: " + 
                result.GetValue());
        }

        return intConst;
    }