Created the list structure for the tokens to be stored and some helper functions.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user