当前位置: 首页>>代码示例>>C++>>正文


C++ POETCode::visit方法代码示例

本文整理汇总了C++中POETCode::visit方法的典型用法代码示例。如果您正苦于以下问题:C++ POETCode::visit方法的具体用法?C++ POETCode::visit怎么用?C++ POETCode::visit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在POETCode的用法示例。


在下文中一共展示了POETCode::visit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: visitList

 virtual void visitList(POETList* l) 
   {
      POETCode* cur = l->get_first();
      cur->visit(this) ; 
      if (l->get_rest() != 0) {
          if (listsep != 0)
             listsep->visit(this);
          l->get_rest()->visit(this); 
      }
   }
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:10,代码来源:codegen.cpp

示例2: visitCodeVar

 virtual void visitCodeVar(CodeVar* v) 
  {
    try {
      POETCode* _listsep = listsep;
      CodeVar* _listelem = listelem;
      POETCode* result = v->invoke_output(v->get_args());
      if (result != 0 && result != v) { 
          listsep = 0; listelem=0; 
          result->visit(this); 
          listsep = _listsep; listelem=_listelem;
          return; 
      }
      CvarSymbolTable::Entry e = v->get_entry();
      LvarSymbolTable *local = 0;
      POETCode* f = 0;
      POETCode *parse = e.get_parse();
      if (parse != 0 && parse->get_enum()==SRC_OP) { 
          POETOperator* op = static_cast<POETOperator*>(parse);
          if (op->get_op() == POET_OP_LIST || op->get_op()==POET_OP_LIST1)  {
              listsep = op->get_arg(1);
              listelem=dynamic_cast<CodeVar*>(op->get_arg(0));
              f = v->get_args();
           }
      }
      if (f == 0) { 
        listsep = 0; listelem=0;
        f = e.get_code();
        if (f == 0) { 
              if (parse==0) { CODE_SYNTAX_UNDEFINED(v->toString()); }
              else f = v->get_args(); 
        }
        else {
           local = e.get_symTable();
           if (local != 0) 
              local->push_table(false);
           POETCode* pars = e.get_param();
           if (pars != 0 && !match_parameters(pars, v->get_args(),MATCH_PAR_MOD_CODE))   
              CVAR_MISMATCH(v,pars, v->get_args());
           v->set_attr();
        }
      }
      if (f == 0) { CODE_SYNTAX_UNDEFINED(v->toString()); }
      int save = align;
      align = start_pos;
      f->visit(this); 
      align = save;
      if (local != 0)
          local->pop_table();
      listsep = _listsep; listelem=_listelem;
    }
    catch (Error err) { 
            std::cerr << " From unparsing code template " << SHORT(v->toString(),500) << "\n"; 
            throw err;
         }
    }
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:55,代码来源:codegen.cpp

示例3: visitLocalVar

 virtual void visitLocalVar(LocalVar* v)
 {
    LvarSymbolTable::Entry e =v->get_entry();
    POETCode* code = e.get_code();
    if (code != v && code != 0)  code->visit(this); 
    else {
       POETCode* restr =  e.get_restr();
       if (restr != 0) restr->visit(this);
       else SYM_UNDEFINED(v->toString());
       e.set_code(res);
    }
 }
开发者ID:LindaLovelace,项目名称:rose,代码行数:12,代码来源:parse.cpp

示例4: visitTuple

 virtual void visitTuple(POETTuple* l)
  {
    out << "("; print_linebreak();
    int size=l->size();
    for (int i = 0; i < size; ++i) {
       POETCode* cur = l->get_entry(i);
       if (cur == 0) out << "NULL,";
       else if (cur->get_enum() == SRC_LIST) 
           { col+=2; out << "(";  cur->visit(this); 
             out << ")"; col-=2; }
       else cur->visit(this); 
       if (i < size-1) { out << ","; print_linebreak(); }
     }
     out << ")"; 
  }
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:15,代码来源:codegen.cpp

示例5: visitList

  virtual void visitList(POETList* l) 
    {
       POETCode* cur = l->get_first();
/*
       if (cur->get_enum() != SRC_LIST &&
           listelem != 0 && !match_AST(cur, listelem,MATCH_AST_EQ)) {
          cur = ASTFactory::inst()->new_codeRef(listelem->get_entry(), cur);
       }
*/
       cur->visit(this) ; 
       if (l->get_rest() != 0) {
           if (listsep != 0)
              listsep->visit(this);
           l->get_rest()->visit(this); 
       }
    }
开发者ID:LindaLovelace,项目名称:rose,代码行数:16,代码来源:codegen.cpp

示例6: visitLocalVar

 virtual void visitLocalVar(LocalVar* v)
  {
     POETCode* res = v->get_entry().get_code(); 
     if (res != 0 && res != v) {
         v->get_entry().set_code(0);
         out << v->get_entry().get_name()->toString(OUTPUT_NO_DEBUG) << "={";
         res->visit(this);
         out << "}";
         v->get_entry().set_code(res);
     }
  }
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:11,代码来源:codegen.cpp

示例7: visitOperator

 virtual void visitOperator(POETOperator *op)
 {
  if (op->get_op() == POET_OP_TYPEMATCH || op->get_op() == POET_OP_TYPEMATCH_Q) 
  {
     POETBop* bop = dynamic_cast<POETBop*>(op);
     assert(bop != 0);
     POETCode* arg = bop->get_arg1();
     arg->visit(this); 
     if (arg != res) bop->set_arg1(res);
     res = op;
   }
 }
开发者ID:mshahriarinia,项目名称:POET-C-Compiler,代码行数:12,代码来源:evalAST.cpp

示例8: apply

 void apply (POETCode* output)
 {
  while (output != 0) {
     POETList* outputList = dynamic_cast<POETList*>(output);
     if (outputList != 0) {
        apply(outputList->get_first());
        output = outputList->get_rest();
     }
     else {
        if (output->get_enum() == SRC_STRING) {
           out << output->toString(OUTPUT_NO_DEBUG);
        }
        else {
           POETCode* res = eval_AST(output);
           res->visit(this);
        }
        output = 0;
    }
  }
 }
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:20,代码来源:codegen.cpp


注:本文中的POETCode::visit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。