Пример #1
0
 public SymTokenContainer(SymTokenContainer aCopy)
 {
     foreach (SymToken t in aCopy)
     {
         Append(t);
     }
 }
Пример #2
0
        protected bool IsTokenExactMatch(SymToken aToken, SymTokenContainer aContainerToSearch)
        {
            bool ret = false;

            //
            foreach (SymToken t in aContainerToSearch)
            {
                if (t.Equals(aToken))
                {
                    if (aToken.Tag != null && t.Tag != null)
                    {
                        if ((aToken.Tag is SymTokenBalancerMatchCriteria) && (t.Tag is SymTokenBalancerMatchCriteria))
                        {
                            SymTokenBalancerMatchCriteria extendedInfo1 = (SymTokenBalancerMatchCriteria)aToken.Tag;
                            SymTokenBalancerMatchCriteria extendedInfo2 = (SymTokenBalancerMatchCriteria)t.Tag;
                            //
                            if (extendedInfo1.Equals(extendedInfo2))
                            {
                                ret = true;
                                break;
                            }
                        }
                    }
                }
            }
            //
            return(ret);
        }
Пример #3
0
 public void AddToContainerIfEmittable(SymTokenContainer aContainer)
 {
     if (Emit)
     {
         aContainer.Append(Token);
     }
 }
Пример #4
0
 protected override void ExtractToContainer(SymNode aNode, SymTokenContainer aContainer)
 {
     if (aNode is SymTokenBalancerNodeEmittedElement)
     {
         SymTokenBalancerNodeEmittedElement node = (SymTokenBalancerNodeEmittedElement)aNode;
         node.AddToContainerIfEmittable(aContainer);
     }
 }
Пример #5
0
        public SymTokenContainer ExtractTokensAsContainer(bool aIgnoreWhiteSpace, bool aRecurse)
        {
            SymTokenContainer container = new SymTokenContainer();
            //
            SymNodeEnumeratorChildren enumerator = new SymNodeEnumeratorChildren(this);

            ExtractTokens(enumerator, aIgnoreWhiteSpace, aRecurse, container);
            //
            return(container);
        }
Пример #6
0
        public string EnumerateNodesAsString(IEnumerable aEnumerable, bool aIgnoreWhiteSpace, bool aRecurse)
        {
            // Flatten the tokens into a container
            SymTokenContainer container = new SymTokenContainer();

            ExtractTokens(aEnumerable, aIgnoreWhiteSpace, aRecurse, container);

            // Convert the container to a string
            string ret = container.CoalescedTokenValue;

            return(ret);
        }
Пример #7
0
 public void ExtractTokens(IEnumerable aEnumerable, bool aIgnoreWhiteSpace, bool aRecurse, SymTokenContainer aContainer)
 {
     foreach (SymNode node in aEnumerable)
     {
         if (node.HasChildren)
         {
             if (aRecurse)
             {
                 ExtractTokens(node, aIgnoreWhiteSpace, aRecurse, aContainer);
             }
             else
             {
                 // Ignore - its just a placeholder for child nodes
             }
         }
         else if (node is SymNodeToken)
         {
             SymNodeToken tokenNode = (SymNodeToken)node;
             if (!(aIgnoreWhiteSpace && tokenNode.Token.Class == SymToken.TClass.EClassWhiteSpace) || aIgnoreWhiteSpace == false)
             {
                 aContainer.Append(tokenNode.Token);
             }
         }
         else if (NodeIsExtractable(node))
         {
             ExtractToContainer(node, aContainer);
         }
     }
 }
Пример #8
0
 protected virtual void ExtractToContainer(SymNode aNode, SymTokenContainer aContainer)
 {
 }
Пример #9
0
 public SymTokenContainerEnumerator(SymTokenContainer aContainer)
 {
     iContainer = aContainer;
 }