summaryrefslogtreecommitdiff
path: root/igen/preprocessor.h
diff options
context:
space:
mode:
Diffstat (limited to 'igen/preprocessor.h')
-rw-r--r--igen/preprocessor.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/igen/preprocessor.h b/igen/preprocessor.h
index 7a85e45..200f5b2 100644
--- a/igen/preprocessor.h
+++ b/igen/preprocessor.h
@@ -1,11 +1,25 @@
#ifndef PREPROCESSOR_H
#define PREPROCESSOR_H
+#include "lexer.h"
+
+
typedef enum comment_type comment_type;
+typedef enum directive_type directive_type;
+typedef struct stmt stmt;
+typedef struct linked_list linked_list;
+typedef struct keyword keyword;
typedef struct cursor cursor;
typedef struct whitespace whitespace;
typedef struct comment comment;
typedef struct source source;
+typedef void *(keyword_cb)(void *ctx, int dbg);
+
+enum directive_type {
+ DIR_NONE,
+ DIR_INCLUDE,
+ NUM_DIRS
+};
enum comment_type {
COMM_NONE,
@@ -14,6 +28,17 @@ enum comment_type {
NUM_COMMS
};
+struct linked_list {
+ void *data;
+ linked_list *next;
+};
+
+struct keyword {
+ char *name;
+ int id;
+ keyword_cb *found_keyword;
+};
+
struct cursor {
int line;
int column;
@@ -36,12 +61,19 @@ struct comment {
};
struct source {
+ source *parent;
source **include_list;
+ comment **comments;
char *filename;
char *text;
+ int included : 1;
int tab_width;
cursor cur;
+ stmt *root;
+ stmt *last;
};
-extern source *preprocess(const char *str, int dbg);
+/*extern keyword *find_keyword(const char *key, keyword **keywords, int dbg);*/
+extern int find_keyword(const char *key, keyword **keywords, void *ctx, void **callback_ret, int dbg);
+extern source *preprocess(source *parent, const char *filename, int dbg);
#endif