update stuff

This commit is contained in:
2026-02-05 19:14:31 +11:00
parent 4333c42305
commit 755e7f9606
8 changed files with 175 additions and 52 deletions

View File

@@ -0,0 +1,25 @@
#include "lexer.h"
#include "../include/error.h"
ResultType(SolsLexer, charptr) createLexer(char* input) {
char* inputcopy = malloc(strlen(input) + 1);
if (inputcopy == NULL) {
return Error(SolsLexer, charptr, "Couldn't copy string into lexer (in createLexer() function)");
}
strcpy(inputcopy, input);
SolsLexer lexer = {
.input = inputcopy,
.current = 0,
};
return Success(SolsLexer, charptr, lexer);
}
ResultType(voidptr, charptr) lex(SolsLexer* lexer) {
if (lexer->input == NULL) {
return Error(voidptr, charptr, "Lexer is not initialised");
}
lexer->current = 0;
return Success(voidptr, charptr, NULL);
}