Commit c761c9b1 authored by Michael Schwarz's avatar Michael Schwarz

added information about conflicts to overview

parent aac36302
......@@ -21,6 +21,9 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import de.in.tum.www2.cup.Conflict;
import de.in.tum.www2.cup.ConflictResolutionManager;
import de.in.tum.www2.cup.ShiftReduceConflict;
import de.in.tum.www2.cup.Statistics;
import de.in.tum.www2.cup.analysis.StatisticsVisitor;
import de.in.tum.www2.cup.ast.ParserResult;
......@@ -47,7 +50,8 @@ public class CupOverviewView extends FailableView
private ParserResult ast;
private Statistics stats;
private ControllerStatistics controllerStats;
private ConflictResolutionManager crm;
static class SimpleTable {
private final Color NORMAL_COLOR = new Color(Display.getCurrent(), Colors.darkGray);
......@@ -118,6 +122,10 @@ public class CupOverviewView extends FailableView
private static final int STATUS_PRODUCTION_NOTREDUCED = 8;
private static final int STATUS_ERRORS = 9;
private static final int CONFLICTS_TOTAL = 0;
private static final int CONFLICTS_SR = 1;
private static final int CONFLICTS_RR = 2;
private static final int DEBUGGER_TARGET_FILE = 0;
private static final int DEBUGGER_BREAKPOINTS = 1;
......@@ -138,6 +146,7 @@ public class CupOverviewView extends FailableView
private Pair<Composite,SimpleTable> commonSection;
private Pair<Composite,SimpleTable> pluginSection;
private Pair<Composite,SimpleTable> debuggerSection;
private Pair<Composite,SimpleTable> conflictsSection;
boolean visible = false;
......@@ -172,7 +181,10 @@ public class CupOverviewView extends FailableView
st.setRowLabel(STATUS_PRODUCTION_NOTREDUCED, "Not reduced Productions:");
st.setRowLabel(STATUS_ERRORS, "Errors:");
createTableSection("Conflicts", "", false, 3);
conflictsSection = createTableSection("Unresolved conflicts", "", false, 3);
conflictsSection.getSecond().setRowLabel(CONFLICTS_TOTAL, "Total:");
conflictsSection.getSecond().setRowLabel(CONFLICTS_SR, "Shift/Reduce:");
conflictsSection.getSecond().setRowLabel(CONFLICTS_RR, "Reduce/Reduce:");
debuggerSection = createTableSection("Debugger", "", false, 2);
......@@ -353,6 +365,25 @@ public class CupOverviewView extends FailableView
pluginSection.getFirst().layout();
}
if(this.crm != null){
SimpleTable tbl = conflictsSection.getSecond();
int sr = 0,rr = 0;
for(Conflict c : crm.getAllConflicts()){
if(c instanceof ShiftReduceConflict){
sr++;
} else {
rr++;
}
}
tbl.setRowValue(CONFLICTS_TOTAL,sr+rr);
tbl.setRowValue(CONFLICTS_SR, sr);
tbl.setRowValue(CONFLICTS_RR, rr);
conflictsSection.getFirst().layout();
}
if (commonSectionNeedsLayout)
commonSection.getFirst().layout();
}
......@@ -364,7 +395,11 @@ public class CupOverviewView extends FailableView
this.stats = model.getStatistics();
this.controllerStats = model.getControllerStatistics();
this.ast = model.getAstModel();
if(model.getLaLrResult() != null){
this.crm = new ConflictResolutionManager(model.getLaLrResult().getContext());
}
if (visible)
updateStatistics();
}
......
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