else if (isdigit(ch)) {
if (repeat_count < 0) repeat_count = ch - '0';
else repeat_count = repeat_count * 10 + ch - '0';

コメント風に解説おながいします。