Missed a couple

This commit is contained in:
2022-09-04 15:29:57 +01:00
parent ae270008b0
commit 54aacff26e

View File

@@ -23,15 +23,13 @@ static void assertWrapper(const char* output) {
} }
static void errorWrapper(const char* output) { static void errorWrapper(const char* output) {
fprintf(stderr, ERROR "ERROR: "); fprintf(stderr, ERROR "%s" RESET, output); //no newline
fprintf(stderr, "%s", output);
fprintf(stderr, RESET); //no newline
} }
bool injectNativeFn(Interpreter* interpreter, char* name, NativeFn func) { bool injectNativeFn(Interpreter* interpreter, char* name, NativeFn func) {
//reject reserved words //reject reserved words
if (findTypeByKeyword(name) != TOKEN_EOF) { if (findTypeByKeyword(name) != TOKEN_EOF) {
printf("Can't override an existing keyword"); interpreter->errorOutput("Can't override an existing keyword\n");
return false; return false;
} }
@@ -39,7 +37,7 @@ bool injectNativeFn(Interpreter* interpreter, char* name, NativeFn func) {
//make sure the name isn't taken //make sure the name isn't taken
if (existsLiteralDictionary(&interpreter->scope->variables, identifier)) { if (existsLiteralDictionary(&interpreter->scope->variables, identifier)) {
printf("Can't override an existing variable"); interpreter->errorOutput("Can't override an existing variable\n");
return false; return false;
} }
@@ -62,9 +60,9 @@ bool parseIdentifierToValue(Interpreter* interpreter, Literal* literalPtr) {
if (IS_IDENTIFIER(*literalPtr)) { if (IS_IDENTIFIER(*literalPtr)) {
// Literal idn = *literalPtr; // Literal idn = *literalPtr;
if (!getScopeVariable(interpreter->scope, *literalPtr, literalPtr)) { if (!getScopeVariable(interpreter->scope, *literalPtr, literalPtr)) {
printf(ERROR "ERROR: Undeclared variable \"");; interpreter->errorOutput("Undeclared variable ");;
printLiteral(*literalPtr); printLiteralCustom(*literalPtr, interpreter->errorOutput);
printf("\"\n" RESET); interpreter->errorOutput("\n");
return false; return false;
} }
// freeLiteral(idn); // freeLiteral(idn);