Created the list structure for the tokens to be stored and some helper functions.

This commit is contained in:
2022-02-09 21:47:54 +00:00
parent d6a3935588
commit 2d84019e58
2 changed files with 86 additions and 4 deletions
+16 -1
View File
@@ -1,6 +1,8 @@
#ifndef SCANNER_H
#define SCANNER_H
#define DEFAULT_TOKENLIST_SIZE 32
typedef enum {
//Single-character tokens
LParen, RParen,
@@ -27,6 +29,19 @@ typedef enum {
EndOF
} TokenType;
void ScanTokens(const char*);
typedef struct {
TokenType type;
char* lexeme;
int line;
} Token;
typedef struct {
Token** tokens;
int capacity;
int size;
} TokenList;
TokenList* ScanTokens(const char*);
void DestroyTokenList(TokenList*);
#endif