예제 #1
0
/* Production 16, chapter 3.4, CORBA 2.3.1 */
  public void value_abs_decl() {
 /*@bgen(jjtree) value_abs_decl */
  ASTvalue_abs_decl jjtn000 = new ASTvalue_abs_decl(this, IDLParserTreeConstants.JJTVALUE_ABS_DECL);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);String ident = "";
    try {
      jj_consume_token(17);
      jj_consume_token(22);
      ident = identifier();
      switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
      case 19:
        value_base_inheritance_spec();
        break;
      default:
        jj_la1[17] = jj_gen;
        ;
        break;
      }
      switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
      case 25:
        value_support_inheritance_spec();
        break;
      default:
        jj_la1[18] = jj_gen;
        ;
        break;
      }
      jj_consume_token(14);
    jjtn000.setIdent(ident);
        Scope currentScope = m_symbolTable.getCurrentScope();
        currentScope.addSymbol(ident);
        m_symbolTable.openScope(ident, true); // open a scope for type declaration inside this abstract value type

      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
        case 21:
        case 32:
        case 48:
        case 49:
        case 50:
        case 51:
        case 52:
        case 53:
        case 54:
        case 55:
        case 56:
        case 57:
        case 58:
        case 59:
        case 60:
        case 61:
        case 62:
        case 66:
        case 70:
        case 71:
        case 74:
        case 75:
        case 76:
        case 77:
        case 78:
        case 84:
        case IDLParserConstants.PRAGMA:
        case IDLParserConstants.ID:
          ;
          break;
        default:
          jj_la1[19] = jj_gen;
          goto label_6;
          break;
        }
        export();
      }
      label_6: ;
      
      jj_consume_token(15);
      jj_consume_token(12);
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
        m_symbolTable.closeScope();
    } 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(ASTvalue_abs_decl, Object)
     */
    public Object visit(ASTvalue_abs_decl node, Object data) {
        CheckParameterForBuildInfo(data, node);
        // data contains the scope, this value type is declared in
        Scope enclosingScope = ((BuildInfo) data).GetBuildScope();
        // an IDL abstract value type
        
        Symbol forSymbol = enclosingScope.getSymbol(node.getIdent());
        // check if type is known from a previous run over a parse tree --> if so: skip
        if (m_typeManager.CheckSkip(forSymbol)) { 
            return null; 
        }

        Type[] interfaces = ParseValueInheritSpec(node, (BuildInfo) data);
        if ((interfaces.Length > 0) && (interfaces[0].IsClass)) { 
            throw new InvalidIdlException("invalid " + node.GetIdentification() + 
                                          ", can only inherit from abstract value types, but not from: " + 
                                          interfaces[0].FullName);
        }
        int bodyNodeIndex = 0;
        for (int i = 0; i < node.jjtGetNumChildren(); i++) {
            if (!((node.jjtGetChild(i) is ASTvalue_base_inheritance_spec) || (node.jjtGetChild(i) is ASTvalue_support_inheritance_spec))) {
                bodyNodeIndex = i;
                break;
            }
        }

        TypeBuilder valueToBuild = CreateOrGetValueDcl(forSymbol, null, interfaces,
                                                       true, false); 

        // generate elements
        BuildInfo buildInfo = new BuildInfo(enclosingScope.getChildScope(forSymbol.getSymbolName()), 
                                            valueToBuild, forSymbol);
        for (int i = bodyNodeIndex; i < node.jjtGetNumChildren(); i++) { // for all export children
            Node child = node.jjtGetChild(i);
            child.jjtAccept(this, buildInfo);    
        }

        // finally create the type
        m_typeManager.EndTypeDefinition(forSymbol);
        return null;
    }