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