From 25fa85cbb622e1f9dc9818b0d18fe0de2ef7e5a3 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Sun, 19 Apr 2026 17:26:31 +0200 Subject: build(zig): test integrations with C --- examples/main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/main.c (limited to 'examples') diff --git a/examples/main.c b/examples/main.c new file mode 100644 index 0000000..1409bd5 --- /dev/null +++ b/examples/main.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include "typdown.h" + +void foo(char *v) { + uint8_t code; + char *res = parse(v, &code); + if (code == 0) { + printf("%s\n", res); + free(res); + } else printf("cannot parse '%s', error: %s (%d)\n", v, getErrorString(code), code); +} + +int main() { + // valid + foo("hello world"); + foo("he*ll*o world"); + foo("# he*ll*o world"); + + // invalid + foo("hello *world"); + foo("# hello :::"); + return 0; +} -- cgit v1.2.3