Ejemplo n.º 1
0
        // ----------------------- ReportParsedWords -------------------------------
        public static ParsedWordsReport ReportParsedWords(StmtWord TopWord)
        {
            ParsedWordsReport r1 = new ParsedWordsReport();

            StmtWordCursor c1 = new StmtWordCursor(TopWord);

            r1.AddTextLine(BuildLegend());

            // show the first 5 lines of the stmt text.
            {
                string s1 =
                    TopWord.StmtText.SubstringLenient(TopWord.BeginCursor.WordBx, 500);
                string[] lines =
                    s1.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
                int cx = 0;
                int bx = 0;
                foreach (string s2 in lines)
                {
                    if (s2.IsNullOrEmpty() == false)
                    {
                        r1.AddTextLine(bx.ToString( ) + ") " + s2);

                        cx += 1;
                        if (cx > 5)
                        {
                            break;
                        }
                    }
                    bx += (s2.Length + Environment.NewLine.Length);
                }

                r1.AddSepLine();
            }

            StmtWord w1     = null;
            StmtWord pvWord = null;

            while (true)
            {
                pvWord = w1;

                c1 = c1.NextDeep();
                if (c1 == null)
                {
                    break;
                }
                w1 = c1.Node;

                if ((pvWord != null) && (pvWord.Depth != w1.Depth))
                {
                    r1.AddSepLine();
                }

                r1.AddTextLine(CursorToPresentationString(c1));
            }

            return(r1);
        }