/// <summary>TODO: not sure this is what we want for trees. </summary>
        public virtual string ToString(object start, object stop)
        {
            if (start == null)
            {
                return(null);
            }
            // if we have the token stream, use that to dump text in order
            if (tokens != null)
            {
                // don't trust stop node as it's often an UP node etc...
                // walk backwards until you find a non-UP, non-DOWN node
                // and ask for it's token index.
                int beginTokenIndex = adaptor.GetTokenStartIndex(start);
                int endTokenIndex   = adaptor.GetTokenStopIndex(stop);
                if ((stop != null) && (adaptor.GetNodeType(stop) == Token.UP))
                {
                    endTokenIndex = adaptor.GetTokenStopIndex(start);
                }
                else
                {
                    endTokenIndex = Count - 1;
                }
                return(tokens.ToString(beginTokenIndex, endTokenIndex));
            }
            StringBuilder buf = new StringBuilder();

            ToStringWork(start, stop, buf);
            return(buf.ToString());
        }
        public virtual string ToString(object start, object stop)
        {
            Console.Out.WriteLine("ToString");
            if ((start == null) || (stop == null))
            {
                return(null);
            }
            if (p == -1)
            {
                FillBuffer();
            }
            //Console.Out.WriteLine("stop: " + stop);
            if (start is CommonTree)
            {
                Console.Out.Write("ToString: " + ((CommonTree)start).Token + ", ");
            }
            else
            {
                Console.Out.WriteLine(start);
            }
            if (stop is CommonTree)
            {
                Console.Out.WriteLine(((CommonTree)stop).Token);
            }
            else
            {
                Console.Out.WriteLine(stop);
            }
            // if we have the token stream, use that to dump text in order
            if (tokens != null)
            {
                int beginTokenIndex = adaptor.GetTokenStartIndex(start);
                int endTokenIndex   = adaptor.GetTokenStopIndex(stop);
                // if it's a tree, use start/stop index from start node
                // else use token range from start/stop nodes
                if (adaptor.GetNodeType(stop) == Token.UP)
                {
                    endTokenIndex = adaptor.GetTokenStopIndex(start);
                }
                else if (adaptor.GetNodeType(stop) == Token.EOF)
                {
                    endTokenIndex = Count - 2;                   // don't use EOF
                }
                return(tokens.ToString(beginTokenIndex, endTokenIndex));
            }
            // walk nodes looking for start
            object t = null;
            int    i = 0;

            for (; i < nodes.Count; i++)
            {
                t = nodes[i];
                if (t == start)
                {
                    break;
                }
            }
            // now walk until we see stop, filling string buffer with text
            StringBuilder buf = new StringBuilder();

            t = nodes[i];
            string text;

            while (t != stop)
            {
                text = adaptor.GetNodeText(t);
                if (text == null)
                {
                    text = " " + adaptor.GetNodeType(t);
                }
                buf.Append(text);
                i++;
                t = nodes[i];
            }
            // include stop node too
            text = adaptor.GetNodeText(stop);
            if (text == null)
            {
                text = " " + adaptor.GetNodeType(stop);
            }
            buf.Append(text);
            return(buf.ToString());
        }