| 590 | /* tok822_comment - tokenize comment */ |
| 591 | |
| 592 | static const char *tok822_comment(TOK822 *tp, const char *str) |
| 593 | { |
| 594 | int level = 1; |
| 595 | int ch; |
| 596 | |
| 597 | /* |
| 598 | * XXX We cheat by storing comments in their external form. Otherwise it |
| 599 | * would be a royal pain to preserve \ before (. That would require a |
| 600 | * recursive parser; the easy to implement stack-based recursion would be |
| 601 | * too expensive. |
| 602 | */ |
| 603 | ACL_VSTRING_ADDCH(tp->vstr, '('); |
| 604 | |
| 605 | while ((ch = *(const unsigned char *) str) != 0) { |
| 606 | ACL_VSTRING_ADDCH(tp->vstr, ch); |
| 607 | str++; |
| 608 | if (ch == '(') { /* comments can nest! */ |
| 609 | level++; |
| 610 | } else if (ch == ')') { |
| 611 | if (--level == 0) |
| 612 | break; |
| 613 | } else if (ch == '\\') { |
| 614 | if ((ch = *(unsigned char *) str) == 0) |
| 615 | break; |
| 616 | ACL_VSTRING_ADDCH(tp->vstr, ch); |
| 617 | str++; |
| 618 | } |
| 619 | } |
| 620 | ACL_VSTRING_TERMINATE(tp->vstr); |
| 621 | return (str); |
| 622 | } |
| 623 | |
| 624 | /* tok822_group - cluster a group of tokens */ |
| 625 |
no outgoing calls
no test coverage detected
searching dependent graphs…