Commit 9107d8de authored by Mihai Herda's avatar Mihai Herda
Browse files

Worked on exception system.

Now it shows which program caused a syntax exception.

Now it also shows the variable identifier that is unknown.

Special handling of empty programs.

If failed to enter debug mode because of syntax exception, it will no
longer try to continue the debugging process, thus throwing
IllegalStateExceptions for every program.
parent 556a64b3
......@@ -9,7 +9,7 @@ import dibugger.debuglogic.debugger.DebugControl;
import dibugger.debuglogic.debugger.DebugLogicFacade;
import dibugger.debuglogic.debugger.ProgramInput;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
import dibugger.debuglogic.exceptions.VariableNotFoundException;
import dibugger.debuglogic.exceptions.IdentifierNotFoundException;
import static org.junit.Assert.*;
......
......@@ -6,7 +6,7 @@ import dibugger.debuglogic.exceptions.AlreadyDeclaredException;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
import dibugger.debuglogic.exceptions.MissingReturnCallException;
import dibugger.debuglogic.exceptions.RoutineNotFoundException;
import dibugger.debuglogic.exceptions.VariableNotFoundException;
import dibugger.debuglogic.exceptions.IdentifierNotFoundException;
import dibugger.debuglogic.exceptions.WrongTypeAssignmentException;
import dibugger.debuglogic.interpreter.GenerationController;
......@@ -42,7 +42,7 @@ public class SemanticallyWrongProgramsTest {
controller.generateTrace(code, null, "A");
}
@Test(expected=VariableNotFoundException.class)
@Test(expected=IdentifierNotFoundException.class)
public void testGenerateTrace_variableNotFound() throws DIbuggerLogicException {
GenerationController controller = new GenerationController(1000, 1000);
String code = "int main() {\n"
......
......@@ -7,7 +7,7 @@ import java.util.List;
import org.junit.Test;
import dibugger.debuglogic.exceptions.DIbuggerLogicException;
import dibugger.debuglogic.exceptions.VariableNotFoundException;
import dibugger.debuglogic.exceptions.IdentifierNotFoundException;
import dibugger.debuglogic.exceptions.WrongTypeAssignmentException;
import dibugger.debuglogic.interpreter.AdditionTerm;
import dibugger.debuglogic.interpreter.Assignment;
......@@ -62,7 +62,7 @@ public class AssignmentTest {
}
@Test(expected=VariableNotFoundException.class)
@Test(expected=IdentifierNotFoundException.class)
public void test_Assignment_VariableNotFound() throws DIbuggerLogicException {
GenerationController gc = new GenerationController(1000, 1000);
Scope s = new Scope();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment