Alsing.Text.TokenTreeNode.GetMatchingNode C# (CSharp) Method

GetMatchingNode() private static method

private static GetMatchingNode ( char childChar, TokenTreeNode node ) : TokenTreeNode
childChar char
node TokenTreeNode
return TokenTreeNode
        private static TokenTreeNode GetMatchingNode(char childChar, TokenTreeNode node)
        {
            //find a bucket with the same childChar as we need
            while (node.NextSibling != null && node.Char != childChar)
            {
                node = node.NextSibling;
            }
            
            if (node.Char != childChar)
            {
                var child = new TokenTreeNode();
                node.NextSibling = child;
                return child;
            }
            return node;
        }