From a210631a55c97b64125b28ecc4bbffdc8a3bfe5f Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Thu, 6 Jun 2024 00:04:14 +0200 Subject: Refactor any_sexp --- test/sexp.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'test/sexp.c') diff --git a/test/sexp.c b/test/sexp.c index f6f0b5e..c15b53e 100644 --- a/test/sexp.c +++ b/test/sexp.c @@ -7,27 +7,27 @@ int main() { - const char *s = "(a b c (sub list) ())\n" - "(another lispy thingy)\n" - "() id ciao 20 a1020|x|3a\n" - ";comm\n3433 ;s\n" - "'symbol 'another 'a\n" - "'(a b c) '('a) ''x \"escape \\\"inside the string\"\n" - "\"string very long sus\" (\"a\" \"b\")\n"; + const char *s = "(a b c (sub list) ())\n" + "(another lispy thingy)\n" + "() id ciao 20 a1020|x|3a\n" + ";comm\n3433 ;s\n" + "'symbol 'another 'a\n" + "'(a b c) '('a) ''x \"escape \\\"inside the string\"\n" + "\"string very long sus\" (\"a\" \"b\")\n"; - any_sexp_string_stream_t stream; - any_sexp_parser_t parser; - any_sexp_parser_init_string(&parser, &stream, s, strlen(s)); + any_sexp_reader_t reader; + any_sexp_reader_string_t string; + any_sexp_reader_string_init(&reader, &string, s, strlen(s)); - any_sexp_t sexp = any_sexp_parser_next(&parser); - while (!ANY_SEXP_IS_ERROR(sexp)) { - any_sexp_print(sexp); - putchar('\n'); - any_sexp_free(sexp); - sexp = any_sexp_parser_next(&parser); - } + any_sexp_t sexp = any_sexp_read(&reader); + while (!ANY_SEXP_IS_ERROR(sexp)) { + any_sexp_print(sexp); + putchar('\n'); + any_sexp_free(sexp); + sexp = any_sexp_read(&reader); + } - //printf("%zu\n", sizeof(any_sexp_t)); + //printf("%zu\n", sizeof(any_sexp_t)); - return 0; + return 0; } -- cgit v1.2.3