2021-07-14 08:15:46 -07:00
|
|
|
|
|
|
|
#include "token.h"
|
|
|
|
|
|
|
|
#ifndef LEXER_H
|
|
|
|
#define LEXER_H
|
|
|
|
|
|
|
|
typedef struct Lexer {
|
|
|
|
char* rawFile;
|
|
|
|
int rawLen;
|
|
|
|
int position; // current index
|
|
|
|
int readPosition; // next index
|
|
|
|
char ch; // character under examination
|
|
|
|
|
|
|
|
// values for current index
|
|
|
|
int line;
|
|
|
|
int column;
|
|
|
|
|
|
|
|
} Lexer;
|
|
|
|
|
2023-10-15 15:30:59 -07:00
|
|
|
Lexer* NewLexer(const char* filename);
|
2021-07-14 08:15:46 -07:00
|
|
|
Token* NextToken(Lexer* l);
|
|
|
|
void ReadChar(Lexer* l);
|
|
|
|
void Parse(Lexer* l);
|
2023-11-15 18:43:03 -08:00
|
|
|
void FreeLexer(Lexer* l);
|
2021-07-14 08:15:46 -07:00
|
|
|
|
|
|
|
#endif
|