| 375 | } |
| 376 | |
| 377 | ParseError RedisCommandParser::Consume(butil::IOBuf& buf, |
| 378 | std::vector<butil::StringPiece>* args, |
| 379 | butil::Arena* arena) { |
| 380 | ParseError err = PARSE_OK; |
| 381 | do { |
| 382 | RedisCommandConsumeState state = ConsumeImpl(buf, arena, &err); |
| 383 | if (state == CONSUME_STATE_CONTINUE) { |
| 384 | continue; |
| 385 | } else if (state == CONSUME_STATE_DONE) { |
| 386 | break; |
| 387 | } else { |
| 388 | return err; |
| 389 | } |
| 390 | } while (true); |
| 391 | |
| 392 | args->swap(_args); |
| 393 | Reset(); |
| 394 | return PARSE_OK; |
| 395 | } |
| 396 | |
| 397 | RedisCommandConsumeState RedisCommandParser::ConsumeImpl(butil::IOBuf& buf, |
| 398 | butil::Arena* arena, |