From 5f753ddee7d935e0ba4750a6a8c26fe056c77612 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Wed, 16 Feb 2022 17:05:00 -0400 Subject: igen: Start work on writing a preprocessor. --- igen/preprocessor.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 igen/preprocessor.h (limited to 'igen/preprocessor.h') diff --git a/igen/preprocessor.h b/igen/preprocessor.h new file mode 100644 index 0000000..7a85e45 --- /dev/null +++ b/igen/preprocessor.h @@ -0,0 +1,47 @@ +#ifndef PREPROCESSOR_H +#define PREPROCESSOR_H + +typedef enum comment_type comment_type; +typedef struct cursor cursor; +typedef struct whitespace whitespace; +typedef struct comment comment; +typedef struct source source; + +enum comment_type { + COMM_NONE, + COMM_MULTI, + COMM_SINGLE, + NUM_COMMS +}; + +struct cursor { + int line; + int column; +}; + +struct whitespace { + int spaces; + int bspaces; + int tabs; + int vtabs; + int lines; +}; + +struct comment { + enum comment_type type; + char *text; + cursor start_pos; + cursor end_pos; + whitespace wsp; +}; + +struct source { + source **include_list; + char *filename; + char *text; + int tab_width; + cursor cur; +}; + +extern source *preprocess(const char *str, int dbg); +#endif -- cgit v1.2.3-13-gbd6f