diff --git a/compiler.h b/compiler.h index a6320d8..7b29baf 100644 --- a/compiler.h +++ b/compiler.h @@ -1,6 +1,48 @@ #ifndef ROSEBUDCOMPILER_H #define ROSEBUDCOMPILER_H #include +#include + +struct pos +{ + int line; + int col; + const char *filename; +}; + +enum +{ + TOKEN_TYPE_IDENTIFIER, + TOKEN_TYPE_KEYWORD, + TOKEN_TYPE_OPERATOR, + TOKEN_TYPE_SYMBOL, + TOKEN_TYPE_NUMBER, + TOKEN_TYPE_STRING, + TOKEN_TYPE_COMMENT, + TOKEN_TYPE_NEWLINE, +}; + +struct tokent +{ + int type; + int flags; + + union + { + char cval; + const char *sval; + unsigned int inum; + unsigned long lnum; + unsigned long long llnum; + void *any; + }; + + // True if there is a whitespace between the current token and next token + bool whitespace; + + // (5+10+20) + const char *between_brackets; +}; enum {