Commit a2c39ac1 authored by Johannes Roith's avatar Johannes Roith

Add symbol.

parent fc0f1ec1
......@@ -4,12 +4,13 @@ import java.util.List;
import de.in.tum.www2.cup.internal.lalr_item;
import de.in.tum.www2.cup.internal.lalr_state;
import de.in.tum.www2.cup.internal.terminal;
public class ShiftReduceConflict extends Conflict
{
private lalr_item conflict1;
private List<lalr_item> conflict2;
private terminal terminal; // TODO: change to Terminal. Requires link in terminal class
public lalr_item getConflictItem1() {
return conflict1;
......@@ -19,10 +20,11 @@ public class ShiftReduceConflict extends Conflict
return conflict2;
}
public ShiftReduceConflict(lalr_state state, lalr_item conflict1, List<lalr_item> conflict2) {
public ShiftReduceConflict(lalr_state state, lalr_item conflict1, List<lalr_item> conflict2, terminal terminal) {
super(state);
this.conflict1 = conflict1;
this.conflict2 = conflict2;
this.terminal = terminal;
}
// state (index)
......
......@@ -896,7 +896,7 @@ public class lalr_state {
message += " under symbol "+ shared.find(conflict_sym).name() + "\n"+
" Resolved in favor of shifting.\n";
Conflict conflict = new ShiftReduceConflict(this, red_itm, conflictingItems);
Conflict conflict = new ShiftReduceConflict(this, red_itm, conflictingItems, shared.find(conflict_sym));
ConflictManager cm = context.getConflictManager();
cm.addConflict(conflict);
......
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