pass file into flex instead of content buffer

This commit is contained in:
2025-05-30 12:56:25 +01:00
parent 68341db0b0
commit ddf18ceb2c
4 changed files with 2007367 additions and 38 deletions

View File

@@ -8,8 +8,7 @@ void lexer(LexerState state) {
yyset_extra(&state, scanner);
void* buffer = yy_scan_string(state.content, scanner);
yy_switch_to_buffer(buffer, scanner);
yyset_in(state.file, scanner);
int token;
while ((token = yylex(scanner)) != 0) {
@@ -26,7 +25,5 @@ void lexer(LexerState state) {
state.current_column += yyget_leng(scanner);
}
}
yy_delete_buffer(buffer, scanner);
yylex_destroy(scanner);
}

View File

@@ -1,9 +1,10 @@
#include "token.h"
#include "../list/list.h"
#include <stdio.h>
typedef struct {
const char *path;
const char *content;
FILE *file;
int current_column;
LinkedList* tokens;
// add more fields as needed