public Transition(ParserState fromState, NonTerminal overNonTerminal) { FromState = fromState; OverNonTerminal = overNonTerminal; ToState = FromState.BuilderData.GetNextState(overNonTerminal); _hashCode = unchecked (FromState.GetHashCode() - overNonTerminal.GetHashCode()); FromState.BuilderData.Transitions.Add(overNonTerminal, this); Items = FromState.BuilderData.ShiftItems.SelectByCurrent(overNonTerminal); foreach (var item in Items) { item.Transition = this; } }
public ShiftTransition(ParserState fromState, BnfTerm overTerm, LRItemSet shiftItems) { FromState = fromState; OverTerm = overTerm; ShiftItems = shiftItems; _hashCode = unchecked (fromState.GetHashCode() - overTerm.GetHashCode()); //Add self to state's set of transitions fromState.BuilderData.ShiftTransitions.Add(this); //Assign self to Transition field of all shift items foreach (var shiftItem in ShiftItems) { shiftItem.Transition = this; } }//constructor
public LRItem(ParserState state, LR0Item core) { State = state; Core = core; _hashCode = unchecked (state.GetHashCode() + core.GetHashCode()); }