示例#1
0
 private TokenType getTokenType()
 {
     if (characterStream.isNextCharWhiteSpace())
     {
         return(TokenType.WHITESPACE);
     }
     else if (shouldReadIdentifier())
     {
         return(TokenType.IDENTIFIER);
     }
     else if (characterStream.isNextCharOperator())
     {
         return(TokenType.OPERATOR);
     }
     else if (characterStream.isNextCharLeftParentheses())
     {
         return(TokenType.LEFT_PARENTHESES);
     }
     else if (characterStream.isNextCharRightParentheses())
     {
         return(TokenType.RIGHT_PARENTHESES);
     }
     else
     {
         throw new UnknownSymbolException("Unknown Symbol: " + characterStream.peek());
     }
 }