From bfdc8d2d843c08bd01517256a63518d03da236f6 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 27 Jul 2021 21:10:34 +0200 Subject: Started treeify --- inc/context.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 inc/context.h (limited to 'inc/context.h') diff --git a/inc/context.h b/inc/context.h new file mode 100644 index 0000000..3f7b686 --- /dev/null +++ b/inc/context.h @@ -0,0 +1,32 @@ +#ifndef CONTEXT_H +#define CONTEXT_H + +#include + +typedef struct { + size_t start, end; +} ctx_string; + +struct ctx { + size_t line; + size_t column; + const char *path; + + char *raw; + char *data; + size_t size; + + size_t token_count; + struct token *tokens; + + struct { + struct tree *head; + struct node *current; + } tree; +}; + +struct ctx *context_create(const char *path); +void context_destroy(struct ctx *ctx); +void context_rewind(struct ctx *ctx); + +#endif -- cgit v1.2.3