change to dynamic array for lexer and parser to speed up lexical analysis
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user