mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Missed a couple
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user