summaryrefslogtreecommitdiff
path: root/igen/preprocessor.h
diff options
context:
space:
mode:
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