Beispiel #1
0
  public void visit(AST node) {
    // <type_dcl> ::= "typedef" <type_declarator>
    //              | <struct_type>
    //              | <union_type>
    //              | <enum_type>
    //              | "native" <simple_declarator>
    //              | <constr_forward_decl>

    Visitor visitor = null;

    if (TypedefVisitor.accept(node)) {
      // "typedef" <type_declarator>
      visitor = new TypedefVisitor(getScope(), definition, schema, wsdlVisitor);
    } else if (StructVisitor.accept(node)) {
      // <struct_type>
      visitor = new StructVisitor(getScope(), definition, schema, wsdlVisitor);
    } else if (UnionVisitor.accept(node)) {
      // <union_type>
      visitor = new UnionVisitor(getScope(), definition, schema, wsdlVisitor);
    } else if (EnumVisitor.accept(node)) {
      // <enum_type>
      visitor = new EnumVisitor(getScope(), definition, schema, wsdlVisitor);
    } else if (node.getType() == IDLTokenTypes.LITERAL_native) {
      // "native" <simple_declarator>
      //
      // native type not supported
      throw new RuntimeException("[TypeDclVisitor: native type not supported!]");
    }

    // TODO forward declaration <constr_forward_declaration>

    visitor.visit(node);
  }
Beispiel #2
0
 public static boolean accept(AST node) {
   boolean result =
       TypedefVisitor.accept(node)
           || StructVisitor.accept(node)
           || UnionVisitor.accept(node)
           || EnumVisitor.accept(node);
   return result;
 }