Example #1
0
            public override State Next(char c)
            {
                State nextState = this;

                if ('0' <= c && c <= '9')
                {
                    nextState = new DecimalPointState();
                }
                else
                {
                    throw new Exception($"InvalidState {c} from InitialDecimalPointState");
                }
                return(nextState);
            }
Example #2
0
            public override State Next(char c)
            {
                State nextState = this;

                if ('0' <= c && c <= '9')
                {
                }
                else if (c == '.')
                {
                    nextState = new DecimalPointState();
                }
                else if (c == 'e')
                {
                    nextState = new ExponentState();
                }
                else
                {
                    throw new Exception($"InvalidState {c} from IntegerPotionState");
                }
                return(nextState);
            }