summaryrefslogtreecommitdiff
path: root/igen/preprocessor.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-02-16 17:05:00 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2022-02-18 10:05:01 -0400
commit5f753ddee7d935e0ba4750a6a8c26fe056c77612 (patch)
tree07b152f726bff71f871f3a5a736098a1e0b0bd04 /igen/preprocessor.h
parent722c7f08e409d1f6f3a26bda666c15d7082f52e3 (diff)
igen: Start work on writing a preprocessor.
Diffstat (limited to 'igen/preprocessor.h')
-rw-r--r--igen/preprocessor.h47
1 files changed, 47 insertions, 0 deletions
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