private void interpretateAsLWIQA(object sender, EventArgs e) { if (textBox.Text == "") { return; } Translator inter = new Translator(textBox.Text); InterpreterPlugin.OutputTable outputTable = new InterpreterPlugin.OutputTable(ref form, inter.LexemTable, "Lexem table", new Pair <string, string>("Lexem", "Discription")); outputTable.Show(); if (inter.LexemTable[0].val2.Contains("Error")) { return; } if (inter.SyntaxErrorTable.Count != 0) { outputTable = new InterpreterPlugin.OutputTable(ref form, inter.SyntaxErrorTable, "Syntax errors", new Pair <string, string>("Token", "Message")); outputTable.Show(); return; } InterpreterPlugin.TreeForm treeForm = new InterpreterPlugin.TreeForm(inter.BeginNode, form); treeForm.Show(); if (inter.SemanticErrorTable.Count != 0) { outputTable = new InterpreterPlugin.OutputTable(ref form, inter.SemanticErrorTable, "Semantic errors", new Pair <string, string>("Construction", "Message")); outputTable.Show(); return; } textBox.Text = inter.OutputCode; }
private void getSyntaxErrors(object sender, EventArgs e) { if (_textChanged) { getLexTable(sender, e); } SyntaxTree st = new SyntaxTree(_table, _tokenInLine); st.parse(); InterpreterPlugin.TreeForm treeForm = new InterpreterPlugin.TreeForm(st.beginNode, form); treeForm.Show(); _beginNode = st.beginNode; if (st.errorsTable.Count != 0) { InterpreterPlugin.OutputTable syntErr = new InterpreterPlugin.OutputTable(ref form, st.errorsTable, "Syntax errors", new Pair <string, string>("Token", "Message")); syntErr.Show(); } }