/// <summary>
        /// Runs the current search for the first match of the current rule among the children of a node
        /// </summary>
        /// <param name="node">Node whose children should be searched</param>
        /// <param name="excludeNodes">Nodes to exclude from the search</param>
        /// <returns>First child that matches the current rule</returns>
        public TreeBankNode Run(TreeBankNode node, Set <TreeBankNode> excludeNodes)
        {
            // get list of children to search, reversing the order if we're searching from right to left
            List <TreeBankNode> children = new List <TreeBankNode>();

            for (int i = 0; i < node.ChildCount; ++i)
            {
                children.Add(node.GetChild(i));
            }

            if (_direction == SearchDirection.RightToLeft)
            {
                children.Reverse();
            }

            // search for each category in the search list
            foreach (string cat in _searchList)
            {
                TreeBankEngine.SyntacticCategory searchCat = TreeBankEngine.GetSyntacticCategory(cat);
                foreach (TreeBankNode child in children)
                {
                    if (child.Category == searchCat)
                    {
                        if (excludeNodes == null || !excludeNodes.Contains(child))
                        {
                            return(child);
                        }
                    }
                }
            }

            return(null);
        }