public DimMachineState GetNext(Token token) { DimMachineState nextState = this.CurrentState; DimStateTransition transition = new DimStateTransition(CurrentState, token.Type); if (!transitions.TryGetValue(transition, out nextState)) { throw new Exception("DIM: Invalid transition: " + CurrentState + " -> " + nextState + "\n" + token.Text + " " + token.Type); } if (this.CurrentState == DimMachineState.DIM && token.Type == TokenType.ARRAY) { this.command.ConsumeToken(token); } Console.WriteLine("DIM: " + this.CurrentState + " -> " + nextState + ": " + token.Text); return(nextState); }
public override bool Equals(object obj) { DimStateTransition other = obj as DimStateTransition; return(other != null && this.CurrentState == other.CurrentState && this.Token == other.Token); }