Debug information improvements

This commit is contained in:
Curle 2023-12-08 03:56:09 +00:00
parent dc4d4aba24
commit 6e1129cb6b
2 changed files with 5 additions and 4 deletions

View File

@ -284,7 +284,7 @@ struct ASTNode* ParsePrecedenceASTNode(int PreviousTokenPrecedence) {
RightTemp = NULL;
LeftTemp = NULL;
} else {
printf("\t\tAttempting to handle a %d in Binary Expression parsing\r\n", CurrentFile->CurrentSymbol.type);
printf("\t\tAttempting to handle a %s in Binary Expression parsing\r\n", TokenNames[CurrentFile->CurrentSymbol.type]);
LeftNode->RVal = 1;
RightNode->RVal = 1;
@ -392,6 +392,7 @@ struct ASTNode* ParseExpressionList(int terminate) {
while (CurrentFile->CurrentSymbol.type != terminate) {
// TODO: for(int x = 0;
Child = ParsePrecedenceASTNode(0);
printf("\nFunction parameter %d is type %s.\n", Count, TypeNames(Child->ExprType));
Count++;
Tree = ConstructASTNode(OP_COMP, PointerTo(RET_VOID), Tree, NULL, Child, NULL, Count);

View File

@ -17,7 +17,7 @@
*/
int TypeIsInt(int Type) {
printf("\tComparing type %d.\n", Type);
printf("\tComparing type %s.\n", TypeNames(Type));
return ( ((Type & 0xf) == 0) && (Type >= RET_CHAR && Type <= RET_LONG));
}
@ -96,7 +96,7 @@ char* TypeNames(int Type) {
break;
};
if (TypeIsPtr(Type)) memcpy((void*) ((size_t) TypeBuffer + 4), "Ptr", 3);
else memcpy((void*) ((size_t) TypeBuffer + 4), " ", 3);
else memcpy((void*) ((size_t) TypeBuffer + 4), "\0", 1);
return TypeBuffer;
}
@ -202,7 +202,7 @@ struct ASTNode* MutateType(struct ASTNode* Tree, int RightType, int Operation) {
LeftType = Tree->ExprType;
printf("\tCalculating compatibility between ltype %d and rtype %d\r\n", LeftType, RightType);
printf("\tCalculating compatibility between ltype %s and rtype %s\r\n", TypeNames(LeftType), TypeNames(RightType));
if (TypeIsInt(LeftType) && TypeIsInt(RightType)) {
// Short-circuit for valid types