public void GenerateStructure(string sourceCode, PkbAPI pkb) { this.CfgList = new List <ProcedureCfg>(); this.pkb = pkb; this.BuildCfgList(sourceCode); }
private void parseButton_Click(object sender, RoutedEventArgs e) { logsRichTextBox.Document.Blocks.Clear(); try { ParserByTombs.SetNewInstance(); // parsed - FOR AST AND CFG parsed = ParserByTombs.Instance.Parse(StringFromRichTextBox(procedureRichTextBox)); // formatted - ONLY FOR "MAIN WINDOW" var formatted = ParserByTombs.Instance.GetParsedFormattedSourceCode(); linesRichTextBox.Document.Blocks.Clear(); linesRichTextBox.Document.Blocks.Add(new Paragraph(new Run(formatted.lineNumbers))); procedureRichTextBox.Document.Blocks.Clear(); procedureRichTextBox.Document.Blocks.Add(new Paragraph(new Run(formatted.parsedSourceCode))); //procedureRichTextBox.ScrollToVerticalOffset(0); linesRichTextBox.ScrollToVerticalOffset(procedureRichTextBox.VerticalOffset); addLog("Source Code Parser: Ok"); } catch (Exception ex) { addLog("Source Code Parser: " + ex.GetType().Name + ": " + ex); good = false; return; } try { pkb = ParserByTombs.Instance.pkb; QueryEvaluator.GetInstance().pkb = pkb; QueryProjector.GetInstance().Pkb = pkb; addLog("PKB Create: Ok"); } catch (Exception ex) { addLog("PKB Create: " + ex.GetType().Name + ": " + ex); good = false; return; } good = true; }