| 691 | } |
| 692 | |
| 693 | int main(int unused_argc, char **unused_argv) |
| 694 | { |
| 695 | VSTRING *vp = vstring_alloc(100); |
| 696 | TOK822 *list; |
| 697 | VSTRING *buf = vstring_alloc(100); |
| 698 | |
| 699 | #define TEST_TOKEN_LIMIT 20 |
| 700 | |
| 701 | while (readlline(buf, VSTREAM_IN, (int *) 0)) { |
| 702 | while (VSTRING_LEN(buf) > 0 && vstring_end(buf)[-1] == '\n') { |
| 703 | vstring_end(buf)[-1] = 0; |
| 704 | vstring_truncate(buf, VSTRING_LEN(buf) - 1); |
| 705 | } |
| 706 | if (!isatty(vstream_fileno(VSTREAM_IN))) |
| 707 | vstream_printf(">>>%s<<<\n\n", vstring_str(buf)); |
| 708 | list = tok822_parse_limit(vstring_str(buf), TEST_TOKEN_LIMIT); |
| 709 | vstream_printf("Parse tree:\n"); |
| 710 | tok822_print(list, 0); |
| 711 | vstream_printf("\n"); |
| 712 | |
| 713 | vstream_printf("Internalized:\n%s\n\n", |
| 714 | vstring_str(tok822_internalize(vp, list, TOK822_STR_DEFL))); |
| 715 | vstream_fflush(VSTREAM_OUT); |
| 716 | vstream_printf("Externalized, no newlines inserted:\n%s\n\n", |
| 717 | vstring_str(tok822_externalize(vp, list, |
| 718 | TOK822_STR_DEFL | TOK822_STR_TRNC))); |
| 719 | vstream_fflush(VSTREAM_OUT); |
| 720 | vstream_printf("Externalized, newlines inserted:\n%s\n\n", |
| 721 | vstring_str(tok822_externalize(vp, list, |
| 722 | TOK822_STR_DEFL | TOK822_STR_LINE | TOK822_STR_TRNC))); |
| 723 | vstream_fflush(VSTREAM_OUT); |
| 724 | tok822_free_tree(list); |
| 725 | } |
| 726 | vstring_free(vp); |
| 727 | vstring_free(buf); |
| 728 | return (0); |
| 729 | } |
| 730 | |
| 731 | #endif |
| 732 | #endif // !defined(ACL_MIME_DISABLE) |
nothing calls this directly
no test coverage detected
searching dependent graphs…