Exemplo n.º 1
0
        /// <summary>
        /// Returns a collection of child elements.
        /// </summary>
        public static IEnumerable <Chameleon.Parsing.ASTNode> Elements(this Chameleon.Parsing.ASTNode item)
        {
            ILinqTree <Chameleon.Parsing.ASTNode> adapter = new Chameleon.Parsing.ASTNodeTreeAdapter(item);

            foreach (var child in adapter.Children())
            {
                yield return(child);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a collection of ancestor elements.
        /// </summary>
        public static IEnumerable <Chameleon.Parsing.ASTNode> Ancestors(this Chameleon.Parsing.ASTNode item)
        {
            ILinqTree <Chameleon.Parsing.ASTNode> adapter = new Chameleon.Parsing.ASTNodeTreeAdapter(item);

            var parent = adapter.Parent;

            while (parent != null)
            {
                yield return(parent);

                adapter = new Chameleon.Parsing.ASTNodeTreeAdapter(parent);
                parent  = adapter.Parent;
            }
        }