public void Add(ParseTreeNodeList nodes, ListAddMode mode)
 {
     if (mode == ListAddMode.Start)
     {
         base.InsertRange(0, nodes);
     }
     else
     {
         base.AddRange(nodes);
     }
 }
 public void Add(ParseTreeNode node, ListAddMode mode)
 {
     if (mode == ListAddMode.Start)
     {
         base.Insert(0, node);
     }
     else
     {
         base.Add(node);
     }
 }
        //
        private void PopChildNode(ParseTreeNode addToParent, ListAddMode mode)
        {
            var poppedNode = Stack.Pop();

            poppedNode.State = null; //clear the State field, we need only when node is in the stack
            if (poppedNode.Term.IsSet(TermOptions.IsPunctuation))
            {
                return;
            }
            if (poppedNode.Term.IsSet(TermOptions.IsTransient))
            {
                addToParent.ChildNodes.Add(poppedNode.ChildNodes, mode);
            }
            else
            {
                //TODO: make it possible to create AST nodes for terminals (Number, StringLiteral).
                if (_grammar.FlagIsSet(LanguageFlags.CreateAst))
                {
                    SafeCreateAstNode(poppedNode);
                }
                addToParent.ChildNodes.Add(poppedNode, mode);
            }
        }
Beispiel #4
0
 //
 private void PopChildNode(ParseTreeNode addToParent, ListAddMode mode)
 {
     var poppedNode = Stack.Pop();
       poppedNode.State = null; //clear the State field, we need only when node is in the stack
       if (poppedNode.Term.IsSet(TermOptions.IsPunctuation)) return;
       if (poppedNode.Term.IsSet(TermOptions.IsTransient)) {
     addToParent.ChildNodes.Add(poppedNode.ChildNodes, mode);
       } else {
     if (_grammar.FlagIsSet(LanguageFlags.CreateAst))
       SafeCreateAstNode(poppedNode);
     addToParent.ChildNodes.Add(poppedNode, mode);
       }
 }
Beispiel #5
0
 // 
 private void PopChildNode(ParseTreeNode addToParent, ListAddMode mode) {
   var poppedNode = Stack.Pop();
   poppedNode.State = null; //clear the State field, we need only when node is in the stack
   if (poppedNode.Term.IsSet(TermOptions.IsPunctuation)) return;
   if (poppedNode.Term.IsSet(TermOptions.IsTransient)) {
     addToParent.ChildNodes.Add(poppedNode.ChildNodes, mode);
   } else {
     //TODO: make it possible to create AST nodes for terminals (Number, StringLiteral).
     if (_grammar.FlagIsSet(LanguageFlags.CreateAst))
       SafeCreateAstNode(poppedNode);
     addToParent.ChildNodes.Add(poppedNode, mode);
   }
 }