Exemplo n.º 1
0
        public DefMachineState GetNext(Token token)
        {
            DefMachineState    nextState  = this.CurrentState;
            DefStateTransition transition = new DefStateTransition(CurrentState, token.Type);

            if (!transitions.TryGetValue(transition, out nextState))
            {
                throw new Exception("DEF: Invalid transition: " + CurrentState + " -> " + nextState + "\n" + token.Text + " " + token.Type);
            }

            if (token.Type != TokenType.END)
            {
                this.command.ConsumeToken(token);
            }

            Console.WriteLine("DEF: " + this.CurrentState + " -> " + nextState + ": " + token.Text);

            return(nextState);
        }
Exemplo n.º 2
0
            public override bool Equals(object obj)
            {
                DefStateTransition other = obj as DefStateTransition;

                return(other != null && this.CurrentState == other.CurrentState && this.Token == other.Token);
            }