Exemple #1
0
 protected override void ExtractToDocument(SymNode aNode, SymTokenDocument aDocument)
 {
     if (aNode is SymTokenBalancerNodeEmittedElement)
     {
         SymTokenBalancerNodeEmittedElement node = (SymTokenBalancerNodeEmittedElement)aNode;
         node.AddToDocumentIfEmittable(aDocument);
     }
 }
Exemple #2
0
        public SymTokenDocument ExtractTokensAsDocument(bool aIgnoreWhiteSpace, bool aRecurse)
        {
            SymTokenDocument doc = new SymTokenDocument();
            //
            SymNodeEnumeratorChildren enumerator = new SymNodeEnumeratorChildren(this);

            ExtractTokens(enumerator, aIgnoreWhiteSpace, aRecurse, doc);
            //
            return(doc);
        }
Exemple #3
0
 protected virtual void ExtractToDocument(SymNode aNode, SymTokenDocument aDocument)
 {
 }
Exemple #4
0
 public void ExtractTokens(IEnumerable aEnumerable, bool aIgnoreWhiteSpace, bool aRecurse, SymTokenDocument aDocument)
 {
     foreach (SymNode node in aEnumerable)
     {
         if (node.HasChildren)
         {
             if (aRecurse)
             {
                 SymNode newLevelNode = new SymNodeAddAsChild();
                 aDocument.CurrentNode.Add(newLevelNode);
                 aDocument.CurrentNode = newLevelNode;
                 ExtractTokens(node, aIgnoreWhiteSpace, aRecurse, aDocument);
                 aDocument.MakeParentCurrent();
             }
             else
             {
                 // Ignore - its just a placeholder for child nodes and we're not recursing
             }
         }
         else if (node is SymNodeToken)
         {
             SymNodeToken tokenNode = (SymNodeToken)node;
             if (!(aIgnoreWhiteSpace && tokenNode.Token.Class == SymToken.TClass.EClassWhiteSpace) || aIgnoreWhiteSpace == false)
             {
                 SymNodeToken copy = new SymNodeToken(tokenNode.Token);
                 aDocument.CurrentNode.Add(copy);
             }
         }
         else if (NodeIsExtractable(node))
         {
             ExtractToDocument(node, aDocument);
         }
     }
 }