For debugging, returns a string representation of the state.
| 503 | |
| 504 | // For debugging, returns a string representation of the state. |
| 505 | std::string DFA::DumpState(State* state) { |
| 506 | if (state == NULL) |
| 507 | return "_"; |
| 508 | if (state == DeadState) |
| 509 | return "X"; |
| 510 | if (state == FullMatchState) |
| 511 | return "*"; |
| 512 | std::string s; |
| 513 | const char* sep = ""; |
| 514 | s += StringPrintf("(%p)", state); |
| 515 | for (int i = 0; i < state->ninst_; i++) { |
| 516 | if (state->inst_[i] == Mark) { |
| 517 | s += "|"; |
| 518 | sep = ""; |
| 519 | } else if (state->inst_[i] == MatchSep) { |
| 520 | s += "||"; |
| 521 | sep = ""; |
| 522 | } else { |
| 523 | s += StringPrintf("%s%d", sep, state->inst_[i]); |
| 524 | sep = ","; |
| 525 | } |
| 526 | } |
| 527 | s += StringPrintf(" flag=%#x", state->flag_); |
| 528 | return s; |
| 529 | } |
| 530 | |
| 531 | ////////////////////////////////////////////////////////////////////// |
| 532 | // |
nothing calls this directly
no test coverage detected