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


C++ SNode::nextNode方法代码示例

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


在下文中一共展示了SNode::nextNode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: if

void DerivationWriter :: copySwitching(SNode node)
{
   SNode current = node.firstChild();
   while (current != lxNone) {
      Symbol symbol = (Symbol)current.type;
      switch (symbol) {
         case nsSwitchOption:
         case nsBiggerSwitchOption:
         case nsLessSwitchOption:
            _writer.newBookmark();
            unpackChildren(current);
            if (symbol == nsBiggerSwitchOption) {
               _writer.insert(lxOption, GREATER_MESSAGE_ID);
            }
            else if (symbol == nsLessSwitchOption) {
               _writer.insert(lxOption, LESS_MESSAGE_ID);
            }
            else _writer.insert(lxOption, EQUAL_MESSAGE_ID);
            _writer.closeNode();
            _writer.removeBookmark();
            break;
         case nsLastSwitchOption:
            _writer.newBookmark();
            unpackChildren(current);
            _writer.insert(lxElse);
            _writer.closeNode();
            _writer.removeBookmark();
            break;
         default:
            break;
      }
      current = current.nextNode();
   }
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例3: unpackChildren

void DerivationWriter :: unpackChildren(SNode node, int mode)
{
   SNode current = node.firstChild();
   while (current != lxNone) {
      unpackNode(current, mode);

      current = current.nextNode();
   }
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例4: copyHints

void DerivationWriter :: copyHints(SNode current)
{
   while (((LexicalType)current.type) == nsHint) {
      _writer.newNode(lxAttribute);
      unpackChildren(current);
      _writer.closeNode();

      current = current.nextNode();
   }
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例5: findTerminalInfo

SyntaxTree::Node SyntaxTree :: findTerminalInfo(SyntaxTree::Node node)
{
   if (node.existChild(lxRow))
      return node;

   SNode current = node.firstChild();
   while (current != lxNone) {
      SNode terminalNode = findTerminalInfo(current);
      if (terminalNode != lxNone)
         return terminalNode;

      current = current.nextNode();
   }

   return current;
}
开发者ID:ELENA-LANG,项目名称:elena-lang,代码行数:16,代码来源:syntaxtree.cpp

示例6: copyNode

void SyntaxTree :: copyNode(SyntaxTree::Writer& writer, SyntaxTree::Node node)
{
   SNode current = node.firstChild();
   while (current != lxNone) {
      if (current.strArgument >= 0) {
         writer.newNode(current.type, current.identifier());
      }
      else writer.newNode(current.type, current.argument);

      copyNode(writer, current);

      writer.closeNode();

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

示例7: 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

示例8: copyObject

void DerivationWriter :: copyObject(SNode node, int mode)
{
   int exprCounter = 0;
   SNode current = node.firstChild();
   while (current != lxNone) {
      if (current == nsExpression)
         exprCounter++;

      unpackNode(current, mode);

      current = current.nextNode();
   }

   if (mode == 1 && exprCounter > 1) {
      _writer.insert(lxExpression);
      _writer.closeNode();
   }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例9: tempWriter

void DerivationWriter :: writeSymbol(Symbol symbol)
{
   if (symbol != nsNone) {
      if (_level > 0) {
         SyntaxWriter tempWriter(_buffer);

         tempWriter.newNode((LexicalType)symbol);
      }
      else _writer.newNode((LexicalType)symbol);

      _level++;
   }
   else {
      _level--;
      if (_level > 0) {
         SyntaxWriter tempWriter(_buffer);

         tempWriter.closeNode();

         if (_level == 1) {
            SNode root = _buffer.readRoot();

            // hints should be injected into the buffer
            if ((LexicalType)root.type == nsHint) {
               if (_hints == lxNone)
                  _hints = root;

               // skipping hints
               while ((LexicalType)root.type == nsHint)
                  root = root.nextNode();
            }
            if (root.type != lxNone) {
               unpackNode(root, 0);
               _buffer.clear();
            }
         }
            
      }
      else _writer.closeNode();
   }
}
开发者ID:,项目名称:,代码行数:41,代码来源:

示例10: copyMessage

void DerivationWriter :: copyMessage(SNode node, bool operationMode)
{
   SNode current = node.firstChild();
   while (current != lxNone) {
      Symbol symbol = (Symbol)current.type;
      switch (symbol) {
         case nsSubjectArg:
            _writer.newNode(lxMessage);
            unpackChildren(current);
            _writer.closeNode();
            break;
         case nsMessageParameter:
         case nsObject:
         case nsExpression:
            _writer.newBookmark();
            unpackChildren(current, 1);
            _writer.removeBookmark();
            break;
         case nsElseOperation:
            _writer.newNode(lxExpression);
            unpackChildren(current);
            _writer.closeNode();
            break;
         case nsSubCode:
            unpackNode(current, 1);
            break;
         case nsL0Operation:
         case nsL3Operation:
         case nsL4Operation:
         case nsL5Operation:
         case nsL6Operation:
         case nsL7Operation:
         case nsNewOperator:
         case nsMessageOperation:
            copyMessage(current, (symbol != nsMessageOperation));
            _writer.insert(lxExpression);
            _writer.closeNode();
            break;
         case tsIdentifier:
         case tsPrivate:
         case tsReference:
            if (!operationMode) {
               _writer.newNode(lxMessage);
               unpackNode(current, 0);
               _writer.closeNode();
               break;
            }
         default:
            if (operationMode && current.existChild(lxTerminal)) {
               if ((Symbol)node.type == nsNewOperator) {
                  //HOTFIX : mark new operator
                  _writer.appendNode(lxOperator, -1);
                  if (symbol == tsInteger || symbol == tsIdentifier) {
                     unpackNode(current, 0);
                  }
               }
               else {
                  _writer.newNode(lxOperator);
                  copyChildren(current);
                  _writer.closeNode();
               }

               _writer.newBookmark();               
            }
            break;
      }
      current = current.nextNode();
   }

   if (operationMode) {
      _writer.removeBookmark();
   }
}
开发者ID:,项目名称:,代码行数:73,代码来源:


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