Commit c70b49cd authored by Michael Schwarz's avatar Michael Schwarz

ingore all RR conflicts past a certain treshold

parent 912b6a4c
......@@ -31,6 +31,7 @@ import de.in.tum.www2.cup.Conflict;
import de.in.tum.www2.cup.ConflictResolutionManager;
import de.in.tum.www2.cup.LALRResult;
import de.in.tum.www2.cup.Position;
import de.in.tum.www2.cup.ReduceReduceConflict;
import de.in.tum.www2.cup.ShiftReduceConflict;
import de.in.tum.www2.cup.ast.IProductionRightPart;
import de.in.tum.www2.cup.ast.ParserResult;
......@@ -190,17 +191,18 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
}
private void updateConflicts(ConflictResolutionManager crm) {
List<Conflict> conflicts = crm.getAllConflicts();
List<Conflict> conflicts = new ArrayList<>();
terminalsAffectConflicts = new HashMap<>();
for (int i = 0; i < crm.getAllConflicts().size(); i++) {
Conflict c = crm.getAllConflicts().get(i);
if(!isIgnored(c)){
conflicts.add(c);
addToTerminalSet(crm,c);
}
}
int size = conflicts.size();
scrolled.setLayoutDeferred(true);
// Do this first, otherwise the affects others is wrong because it operates on a subset of actual terminals
terminalsAffectConflicts = new HashMap<>();
for (int i = 0; i < size; i++) {
Conflict conflict = conflicts.get(i);
addToTerminalSet(crm,conflict);
}
matchPanelNumber(size);
for (int i = 0; i < size; i++) {
......@@ -519,4 +521,17 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
return affected != 1;
}
}
private boolean isIgnored(Conflict c){
if(c instanceof ReduceReduceConflict){
ReduceReduceConflict rrc = (ReduceReduceConflict) c;
int treshold = 200;
return (rrc.getConflictItem1().the_production().getAstNode().getEnd().getLine() > treshold)
&& (rrc.getConflictItem2().the_production().getAstNode().getEnd().getLine() > treshold);
}
else {
return false;
}
}
}
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