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


C++ SyntaxTree::readRoot方法代码示例

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


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

示例1: closureName

ref_t ModuleScope :: resolveClosure(ref_t closureMessage, ref_t outputRef, ident_t ns)
{
   ref_t signRef = 0;
   module->resolveAction(getAction(closureMessage), signRef);

   int paramCount = getParamCount(closureMessage);

   IdentifierString closureName(module->resolveReference(closureTemplateReference));
   if (signRef == 0) {
      if (paramCount > 0) {
         closureName.appendInt(paramCount);
      }

      if (isWeakReference(closureName)) {
         return module->mapReference(closureName, true);
      }
      else return mapFullReference(closureName, true);
   }
   else {   
      ref_t signatures[ARG_COUNT];
      size_t signLen = module->resolveSignature(signRef, signatures);

      List<SNode> parameters;
      SyntaxTree dummyTree;
      SyntaxWriter dummyWriter(dummyTree);
      dummyWriter.newNode(lxRoot);
      
      for (size_t i = 0; i < signLen; i++) {
         dummyWriter.appendNode(lxTarget, signatures[i]);
      }
      if (outputRef) {
         dummyWriter.appendNode(lxTarget, outputRef);
      }
      // if the output signature is not provided - use the super class
      else dummyWriter.appendNode(lxTarget, superReference);

      dummyWriter.closeNode();

      SNode paramNode = dummyTree.readRoot().firstChild();
      while (paramNode != lxNone) {
         parameters.add(paramNode);

         paramNode = paramNode.nextNode();
      }

      closureName.append('#');
      closureName.appendInt(paramCount + 1);

      ref_t templateReference = 0;
      if (isWeakReference(closureName)) {
         templateReference = module->mapReference(closureName, true);
      }
      else templateReference = mapFullReference(closureName, true);

      if (templateReference) {
         return generateTemplate(templateReference, parameters, ns, false);
      }
      else return superReference;
   }
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:60,代码来源:compilerscope.cpp

示例2: transformer

void ModuleScope :: generateTemplateProperty(SyntaxWriter& output, ref_t reference, List<SNode>& parameters)
{
   SyntaxTree templateTree;

   TemplateGenerator transformer(templateTree);
   SyntaxWriter writer(templateTree);
   writer.newNode(lxRoot);
   transformer.generateTemplateProperty(writer, *this, reference, parameters);
   writer.closeNode();

   SyntaxTree::copyNode(output, templateTree.readRoot());
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:12,代码来源:compilerscope.cpp

示例3: moveNodes

void SyntaxTree :: moveNodes(Writer& writer, SyntaxTree& buffer)
{
   SNode current = buffer.readRoot();
   while (current != lxNone) {
      if (current != lxIdle) {
         if (current.strArgument >= 0) {
            writer.newNode(current.type, current.identifier());
         }
         else writer.newNode(current.type, current.argument);

         SyntaxTree::copyNode(writer, current);
         writer.closeNode();

         current = lxIdle;
      }
      current = current.nextNode();
   }
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:18,代码来源:syntaxtree.cpp


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