Commit 24da6c0e authored by Michael Schwarz's avatar Michael Schwarz

fixed bug when no precedence for reduce is given

parent 2d58e6e1
......@@ -404,7 +404,7 @@ class ConflictPanel extends Composite {
resolutionOptions.setEnabled(true);
// Used assoc to sort out. Can't be changed anymore (unless this is the start)
if(srdetails.reduce.equals(srdetails.shift)){
if(srdetails.shiftAndReducePrecedenceFromSameTerminal()){
resolutionOptions.setEnabled(forceEnableDropdown);
}
}
......@@ -413,7 +413,7 @@ class ConflictPanel extends Composite {
resolutionOptions.setEnabled(true);
// Used assoc to sort out. Can't be changed anymore
if(srdetails.reduce.equals(srdetails.shift)){
if(srdetails.shiftAndReducePrecedenceFromSameTerminal()){
resolutionOptions.setEnabled(forceEnableDropdown);
}
}
......@@ -423,7 +423,7 @@ class ConflictPanel extends Composite {
resolutionOptions.setEnabled(true);
// Used assoc to sort out. Can't be changed anymore (unless this is the start)
if(srdetails.reduce.equals(srdetails.shift)){
if(srdetails.shiftAndReducePrecedenceFromSameTerminal()){
resolutionOptions.setEnabled(forceEnableDropdown);
}
}
......
......@@ -194,7 +194,6 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
int size = conflicts.size();
scrolled.setLayoutDeferred(true);
matchPanelNumber(size);
// Do this first, otherwise the affects others is wrong because it operates on a subset of actual terminals
terminalsAffectConflicts = new HashMap<>();
......@@ -202,7 +201,8 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
Conflict conflict = conflicts.get(i);
addToTerminalSet(crm,conflict);
}
matchPanelNumber(size);
for (int i = 0; i < size; i++) {
Conflict conflict = conflicts.get(i);
ConflictPanel panel = conflictPanels.get(i);
......
......@@ -79,7 +79,7 @@ class PrecedenceToInsert {
* @return true iff conflict is resolved in favor of Shift
*/
public boolean isResolvedInFavorOfShift(ShiftReduceDetails srd){
if(!srd.shift.equals(srd.reduce))
if(!srd.shiftAndReducePrecedenceFromSameTerminal())
//TODO: Check if precedence set for terminal at all
return hasPrecedence(srd.shift,srd.reduce);
else
......@@ -92,7 +92,7 @@ class PrecedenceToInsert {
* @return true iff conflict is resolved in favor of Reduce
*/
public boolean isResolvedInFavorOfReduce(ShiftReduceDetails srd) {
if(!srd.shift.equals(srd.reduce))
if(!srd.shiftAndReducePrecedenceFromSameTerminal())
//TODO: Check if precedence set for terminal at all
return hasPrecedence(srd.reduce,srd.shift);
else
......@@ -106,7 +106,7 @@ class PrecedenceToInsert {
* @return true iff conflict is resolved as error
*/
public boolean isResolvedAsError(ShiftReduceDetails srd) {
if(!srd.reduce.equals(srd.shift))
if(!srd.shiftAndReducePrecedenceFromSameTerminal())
return false;
else
return precs.get(srd.shift) == Precedence.Type.NonAssoc;
......
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