MCPcopy Create free account
hub / github.com/acl-dev/acl / tok822_comment

Function tok822_comment

lib_acl_cpp/src/mime/internal/tok822_parse.cpp:592–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590/* tok822_comment - tokenize comment */
591
592static 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

Callers 1

tok822_scan_limitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…