예제 #1
0
        // ----------------------- ShowParsedWords -------------------------------
        void ShowParsedWords(StmtWord InTopWord)
        {
            ParsedWordsReport rep = ParsedWordsReport.ReportParsedWords(InTopWord);

            foreach (string s1 in rep)
            {
                lbResults.Items.Add(s1);
            }
        }
예제 #2
0
        void menu_Parse_Click(object InObj, EventArgs InArgs)
        {
            string stmtText = null;

            StmtTraits traits = new StmtTraits();

            traits.BracedTreatment = ScannerBracedTreatment.Parts;
            traits.OpenNamedBracedPatterns.Clear( );
            traits.OpenContentBracedPatterns.Replace(new string[] { "(", "[", "<", "{" });
            traits.FormSentencesFromWhitespaceDelimWords = true;
            traits.EndStmtPatterns.Replace(";");
            traits.CommentToEndPatterns.AddDistinct("--");
            traits.NewLineIsWhitespace = true;

            stmtText =
                "create table acctnotep( CustName char(30), CustNbr decimal(7,0) )  ;";
            stmtText =
                "create (table), acctnotep( CustName timestamp, " +
                "CustNbr char(25) ) ;";

            string line1 =
                "-- name       : acctnotep";
            string line1b = "abc, efg, oct, nov";
            string line2  =
                "create table  acctnotep(";
            string line3 =
                "sn            char(6) not null,  -- speed number ";
            string line4 =
                "primary key( sn, mbrnu, textSeqn )";
            string line5 =
                ") steve ;";

            string[] stmtTextArray = new string[] { stmtText, line1, line1b, line2, line3, line4, line5 };

            // build a complex that contains the lines to parse concatenated together.
            // The complex also a cross reference for converting buffer locations to
            // line positions.
            ParseBufferComplex buf = new ParseBufferComplex(stmtTextArray);

            StmtWord topWord = StmtParser.ParseTextLines(buf, traits);

            ShowParsedWords(topWord);
        }