//Output all Lexer warning and errors to list view control private void OutputLexerWarningsAndErrors() { //Inits NFLanguageCompiler.Message msg = null; ListViewItem item = null; //Clear warnings and errors listViewLexerWarningsAndErrors.Items.Clear(); //Output lexer warnings for (int i = 0; i < compiler.WarningCount; i++) { //Get Message object msg = compiler.GetWarning(i); //Verify lexer warning if (msg.System == SystemType.ST_LEXER) { //Create list view item item = new ListViewItem("Warning"); item.SubItems.Add(msg.Line.ToString()); item.SubItems.Add(msg.Column.ToString()); item.SubItems.Add(msg.Text); //Add item listViewLexerWarningsAndErrors.Items.Add(item); } } //Output all errors for (int i = 0; i < compiler.ErrorCount; i++) { //Get Message object msg = compiler.GetError(i); //Verify lexer warning if (msg.System == SystemType.ST_LEXER) { //Createl list view item item = new ListViewItem("Error"); item.SubItems.Add(msg.Line.ToString()); item.SubItems.Add(msg.Column.ToString()); item.SubItems.Add(msg.Text); //Add item to list listViewLexerWarningsAndErrors.Items.Add(item); } } }
//Output all warnings and errors to general list view control private void OutputGeneralWarningsAndErrors() { //Inits NFLanguageCompiler.Message msg = null; ListViewItem item = null; SystemType proc = SystemType.ST_NONE; //Clear warnings and errors listViewGeneralWarningsAndErrors.Items.Clear(); //Output all warnings for (int i = 0; i < compiler.WarningCount; i++) { //Get Message object msg = compiler.GetWarning(i); //Get system type proc = msg.System; //Output lexer warnings if (proc == SystemType.ST_LEXER) { //Create listview item item = new ListViewItem(proc.ToString()); item.SubItems.Add("Warning"); item.SubItems.Add(msg.Line.ToString()); item.SubItems.Add(msg.Column.ToString()); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(msg.Text); } else if (proc == SystemType.ST_PARSER) { //Create listview item item = new ListViewItem(proc.ToString()); item.SubItems.Add("Warning"); item.SubItems.Add(msg.Line.ToString()); item.SubItems.Add(msg.Column.ToString()); item.SubItems.Add(msg.Grammar.ToString()); if (msg.Token != null) { item.SubItems.Add(msg.Token.Type.ToString()); } else { item.SubItems.Add(""); } item.SubItems.Add(msg.TokenIndex.ToString()); item.SubItems.Add(msg.Text); } //Add item to list listViewGeneralWarningsAndErrors.Items.Add(item); } //Output all errors for (int i = 0; i < compiler.ErrorCount; i++) { //Get Message object msg = compiler.GetError(i); //Get system type proc = msg.System; //Output lexer warnings if (proc == SystemType.ST_LEXER) { //Create listview item item = new ListViewItem(proc.ToString()); item.SubItems.Add("Error"); item.SubItems.Add(msg.Line.ToString()); item.SubItems.Add(msg.Column.ToString()); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(msg.Text); } else if (proc == SystemType.ST_PARSER) { //Create listview item item = new ListViewItem(proc.ToString()); item.SubItems.Add("Error"); item.SubItems.Add(msg.Line.ToString()); item.SubItems.Add(msg.Column.ToString()); item.SubItems.Add(msg.Grammar.ToString()); if (msg.Token != null) { item.SubItems.Add(msg.Token.Type.ToString()); } else { item.SubItems.Add(""); } item.SubItems.Add(msg.TokenIndex.ToString()); item.SubItems.Add(msg.Text); } //Add to list listViewGeneralWarningsAndErrors.Items.Add(item); } }
//Output all Parser warning and errors to list view control private void OutputParserWarningsAndErrors() { //Inits NFLanguageCompiler.Message msg = null; ListViewItem item = null; //Clear warnings and errors listViewParserWarningsAndErrors.Items.Clear(); //Output parser warnings for (int i = 0; i < compiler.WarningCount; i++) { //Get Message object msg = compiler.GetWarning(i); //Verify parser warning if (msg.System == SystemType.ST_PARSER) { //Create list view item item = new ListViewItem("Warning"); item.SubItems.Add(msg.Grammar.ToString()); if (msg.Token != null) { item.SubItems.Add(msg.Token.Type.ToString()); } else { item.SubItems.Add(""); } item.SubItems.Add(msg.TokenIndex.ToString()); item.SubItems.Add(msg.Text); //Add item listViewParserWarningsAndErrors.Items.Add(item); } } //Output all errors for (int i = 0; i < compiler.ErrorCount; i++) { //Get Message object msg = compiler.GetError(i); //Verify parser warning if (msg.System == SystemType.ST_PARSER) { //Createl list view item item = new ListViewItem("Error"); item.SubItems.Add(msg.Grammar.ToString()); if (msg.Token != null) { item.SubItems.Add(msg.Token.Type.ToString()); } else { item.SubItems.Add(""); } item.SubItems.Add(msg.TokenIndex.ToString()); item.SubItems.Add(msg.Text); //Add item to list listViewParserWarningsAndErrors.Items.Add(item); } } }