isDigit() приватный Метод

private isDigit ( ) : bool
Результат bool
Пример #1
0
 private static TokenType?unsignedNumber(Scanner s)
 {
     if (!s.isDigit())
     {
         return(null);
     }
     while (s.isDigit())
     {
         s.readChar();
     }
     if (s.isExponent())
     {
         return(readExponent(s));
     }
     if (s.peek() != '.')
     {
         return(TokenType.Integer);
     }
     return(remainingFloat(s));
 }
Пример #2
0
 private static TokenType?remainingFloat(Scanner s)
 {
     s.readChar(); // Skip the '.'
     while (s.isDigit() || s.isExponent())
     {
         if (s.isExponent())
         {
             return(readExponent(s));
         }
         s.readChar();
     }
     return(TokenType.Double);
 }
Пример #3
0
        private static TokenType?readExponent(Scanner s)
        {
            s.readChar(); // Skip exponent market
            var read = false;

            if (s.isOneOf("+-"))
            {
                s.readChar();
                read = true;
            }
            while (s.isDigit())
            {
                read = true;
                s.readChar();
            }
            if (read)
            {
                return(TokenType.Double);
            }
            // It's not a floating point number in exponent format.
            // Read it as a symbol instead.
            matchSymbol(s);
            return(TokenType.Symbol);
        }
Пример #4
0
 private static TokenType? unsignedNumber(Scanner s)
 {
     if (!s.isDigit())
         return null;
     while (s.isDigit())
         s.readChar();
     if (s.isExponent())
         return readExponent(s);
     if (s.peek() != '.')
         return TokenType.Integer;
     return remainingFloat(s);
 }
Пример #5
0
 private static TokenType? remainingFloat(Scanner s)
 {
     s.readChar(); // Skip the '.'
     while (s.isDigit() || s.isExponent())
     {
         if (s.isExponent())
             return readExponent(s);
         s.readChar();
     }
     return TokenType.Double;
 }
Пример #6
0
 private static TokenType? readExponent(Scanner s)
 {
     s.readChar(); // Skip exponent market
     var read = false;
     if (s.isOneOf("+-"))
     {
         s.readChar();
         read = true;
     }
     while (s.isDigit())
     {
         read = true;
         s.readChar();
     }
     if(read)
         return TokenType.Double;
     // It's not a floating point number in exponent format.
     // Read it as a symbol instead.
     matchSymbol(s);
     return TokenType.Symbol;
 }