protected function readToken()
    {
        $inputStream = $this->inputStream;

        $this->stepOverWhitespace();

        $char = $inputStream->readCurrent();

        if ($char === null) {
            return null;
        }

        if ($this->isLetter($char)) {
            $value = $this->readWord();
            $type = Token::TYPE_WORD;
        } elseif ($this->isDigit($char) or $this->isPeriod($char)) {
            $value = $this->readNumber();
            $type = Token::TYPE_NUMBER;
        } else {
            $value = $this->readChar();
            $type = Token::TYPE_CHARACTER;
        }

        $token = new Token($value, $type, $this->inputStream->getPosition());

        return $token;
    }