#ifndef LEXER_H #define LEXER_H #include #include "preprocessor.h" typedef enum stmt_type stmt_type; typedef enum cond_type cond_type; typedef struct source source; typedef struct alt_stmt alt_stmt; typedef struct cond_stmt cond_stmt; typedef struct stmt stmt; typedef void *(lex_func)(source *src, int dbg); enum stmt_type { STMT_NONE, STMT_FUNC, STMT_EXPR, STMT_COND, STMT_COMP, NUM_STMTS }; enum cond_type { COND_NONE, COND_IF, COND_FOR, COND_WHILE, COND_DO, NUM_CONDS }; struct alt_stmt { int type; size_t offset; lex_func *lex; }; struct cond_stmt { cond_type type; expr *expr; stmt *stmt; }; struct stmt { stmt_type type; union { func *func; expr *expr; cond_stmt *cond_stmt; stmt *down; }; whitespace wsp; stmt *next; }; extern int lex(source *src, int dbg); #endif