output a match as a string in C/C++
| 540 | |
| 541 | // output a match as a string in C/C++ |
| 542 | inline void cpp(reflex::AbstractMatcher *matcher, int w = 0) |
| 543 | { |
| 544 | if (flag_only_matching) |
| 545 | { |
| 546 | cpp(matcher->begin(), matcher->size()); |
| 547 | } |
| 548 | else |
| 549 | { |
| 550 | const char *e = matcher->eol(); // warning: must call eol() before bol() |
| 551 | const char *b = matcher->bol(); |
| 552 | if (w > 0) |
| 553 | e = utf8pos(b, e - b, w); |
| 554 | else if (w < 0) |
| 555 | b = utf8back(b, e, -w); |
| 556 | cpp(b, e - b); |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | // output a match as a quoted string in CSV |
| 561 | inline void csv(reflex::AbstractMatcher *matcher, int w = 0) |