change to dynamic array for lexer and parser to speed up lexical analysis

This commit is contained in:
2025-05-30 16:46:27 +01:00
parent ddf18ceb2c
commit ec894d4357
10 changed files with 165 additions and 2007408 deletions

View File

@@ -18,7 +18,7 @@ void lexer(LexerState state) {
state.current_column,
yyget_text(scanner)
);
append(state.tokens, token_struct);
darray_push(state.tokens, token_struct);
if (token == TOKEN_NEW_LINE) {
state.current_column = 0;
} else {

View File

@@ -1,12 +1,12 @@
#include "token.h"
#include "../list/list.h"
#include "../dynamic_array/darray.h"
#include <stdio.h>
typedef struct {
const char *path;
FILE *file;
int current_column;
LinkedList* tokens;
DArray* tokens;
// add more fields as needed
} LexerState;