Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/sic/asm/ErrorCatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ public void printByRow(int row) {
System.err.println(err);
}

public void print() {
public String print() {
String allErrs="";
for ( ; lastPrinted < errs.size(); lastPrinted++) {
AsmError err = errs.get(lastPrinted);
System.err.println(err);
allErrs+=(err+"\n");
}
return allErrs;
}

public boolean shouldEnd() {
Expand Down
9 changes: 8 additions & 1 deletion src/sic/sim/MainView.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,14 @@ public void loadAsm(File file) {
ErrorCatcher errorCatcher = assembler.errorCatcher;
Program program = assembler.assemble(Utils.readFile(file));
if (errorCatcher.count() > 0) {
errorCatcher.print();
String allErrs = errorCatcher.print();
JTextArea errArea = new JTextArea(allErrs);
JScrollPane scrollPane = new JScrollPane(errArea);
errArea.setLineWrap(true);
errArea.setWrapStyleWord(true);
scrollPane.setPreferredSize(new Dimension( 250, 250 ));
JOptionPane.showMessageDialog(mainFrame, scrollPane, "Error", JOptionPane.INFORMATION_MESSAGE);
updateView();
if (errorCatcher.shouldEnd()) {
return;
}
Expand Down