/** * Contains the interface for reading tokens from a file. */ #ifndef TOKEN_H #define TOKEN_H typedef enum { // Keywords TOKEN_MODULE, TOKEN_IMPORT, TOKEN_SEMICOLON, // Symbols TOKEN_PARENT_OPEN, TOKEN_PARENT_CLOSE, TOKEN_BRACKET_OPEN, TOKEN_BRACKET_CLOSE, TOKEN_COMMA, // Primitives TOKEN_VOID, // Variable TOKEN_IDENTIFIER, } Token; typedef struct TokenStream TokenStream; /** * Opens a file and returns a TokenStream for it. * @param path The path to the file. * @returns A handle to the TokenStream. */ TokenStream* tokenstream_open(const char* path); /** * Closes a TokenStream. * @param ts The TokenStream to close. */ void tokenstream_close(TokenStream* ts); /** * Gets the next token from the TokenStream. * @param ts The TokenStream to read from. * @returns The next token read. */ Token tokenstream_next(TokenStream* ts); #endif