Prepended file names with "toy_"

This commit is contained in:
2023-01-23 21:45:52 +00:00
parent 59b0d15915
commit 047ccc5f16
29 changed files with 0 additions and 0 deletions

26
source/toy_lexer.h Normal file
View File

@@ -0,0 +1,26 @@
#pragma once
#include "toy_common.h"
#include "token_types.h"
//lexers are bound to a string of code, and return a single token every time scan is called
typedef struct {
char* source;
int start; //start of the token
int current; //current position of the lexer
int line; //track this for error handling
} Lexer;
//tokens are intermediaries between lexers and parsers
typedef struct {
TokenType type;
char* lexeme;
int length;
int line;
} Token;
TOY_API void initLexer(Lexer* lexer, char* source);
Token scanLexer(Lexer* lexer);
//for debugging
void printToken(Token* token);