diff options
| author | Federico Angelilli <code@fedang.net> | 2024-06-05 01:48:56 +0200 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-06-05 01:48:56 +0200 |
| commit | 286d597683ee3fe6fbeed44ffcf362bccb701b03 (patch) | |
| tree | a6e9c4af596c2e852aadb1aeeff998ae6cf22c15 /test/sexp.c | |
| parent | 4d7522eecce31fa5fc9c7873478b7e299dbd9723 (diff) | |
Add initial any_sexp
Diffstat (limited to 'test/sexp.c')
| -rw-r--r-- | test/sexp.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/sexp.c b/test/sexp.c new file mode 100644 index 0000000..85f80f9 --- /dev/null +++ b/test/sexp.c @@ -0,0 +1,27 @@ +#include <stdio.h> +#include <string.h> + +#define ANY_SEXP_IMPLEMENT +#include "any_sexp.h" + +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\n"; + + any_sexp_parser_t parser; + any_sexp_parser_init(&parser, s, strlen(s)); + + any_sexp_t *sexp; + while ((sexp = any_sexp_parser_next(&parser)) != ANY_SEXP_ERROR) { + any_sexp_print(sexp); + putchar('\n'); + any_sexp_free(sexp); + } + + return 0; +} |
