Example #1
0
 void AddReport(ParsedWordsReport InReport)
 {
     foreach (string s1 in InReport)
     {
         this.AddTextLine(s1);
     }
 }
Example #2
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);
        }
Example #3
0
        // ----------------------- ReportParsedWords -------------------------------
        public static ParsedWordsReport ReportParsedWords(List <Stmt> InStmts)
        {
            ParsedWordsReport r0 = new ParsedWordsReport();

            foreach (Stmt stmt in InStmts)
            {
                ParsedWordsReport r1 = ReportParsedWords(stmt);
                r0.AddReport(r1);
            }
            return(r0);
        }
Example #4
0
        // ----------------------- ReportParsedWords -------------------------------
        public static ParsedWordsReport ReportParsedWords(
            StmtWord InParentWord, int InLevel)
        {
            ParsedWordsReport r1         = new ParsedWordsReport();
            StmtWord          parentWord = InParentWord;

            if (InLevel == 0)
            {
                r1.AddTextLine(BuildLegend());

                // show the stmt text ( up until any NewLine pattern in the string )
                string s1 =
                    parentWord.StmtText.SubstringLenient(parentWord.BeginCursor.WordBx, 100);
                int fx = s1.IndexOf(Environment.NewLine);
                if (fx != -1)
                {
                    s1 = s1.Substring(0, fx);
                }
                r1.AddTextLine(s1);

                r1.AddTextLine(StmtWordToPresentationString(parentWord, InLevel));

                ParsedWordsReport r2 = null;
                r2 = ReportParsedWords(parentWord, InLevel + 1);
                r1.AddReport(r2);
            }

            else
            {
                r1.AddSepLine();

                foreach (StmtWord subWord in parentWord.SubWords)
                {
                    r1.AddTextLine(StmtWordToPresentationString(subWord, InLevel));

                    if (subWord.HasSubWords == true)
                    {
                        var r3 = ReportParsedWords(subWord, InLevel + 1);
                        r1.AddReport(r3);
                    }
                }
                r1.AddSepLine();
            }
            return(r1);
        }