// Draw
 public bool Draw(int[,] matrix)
 {
     if (!string.IsNullOrEmpty(lhs) && !string.IsNullOrEmpty(rhs) && func != null)
     {
         StateString.Draw(matrix, lhs, rhs, func);
     }
     else
     {
         StateNumber.Draw(matrix);
     }
     return(true);
 }
Esempio n. 2
0
        private Token GetNumber()
        {
            Char        c;
            StateNumber state  = StateNumber.START;
            Int64       number = 0;
            Int32       digit;
            int         length = 0;

            while (true)
            {
                switch (state)
                {
                case StateNumber.START:
                    c       = Next();
                    digit   = Convert.ToInt32(c) - 0x30;
                    number *= 10;
                    number += digit;
                    state   = StateNumber.D;
                    break;

                case StateNumber.D:
                    c = Next();
                    if (Char.IsDigit(c))
                    {
                        digit = Convert.ToInt32(c) - 0x30;

                        number *= 10;
                        number += digit;
                        state   = StateNumber.D;
                    }
                    else
                    {
                        Retract();
                        length--;
                        state = StateNumber.FINISH;
                    }
                    break;

                case StateNumber.FINISH:
                    return(Token.GetIntToken(number, lexemeBegin, length));
                }
                length++;
            }
        }
Esempio n. 3
0
 public override string ToString()
 {
     return(StateNumber.ToString());
 }