private function createToken($type, $position, array $data)
    {
        if ($type === Tokenizer::TOKEN_GROUP_BEGIN) {
            return $this->createGroupBeginToken($position, $data);
        }

        if ($type === Tokenizer::TOKEN_TERM) {
            return $this->createTermToken($position, $data);
        }

        return new Token($type, $data['lexeme'], $position);
    }