Add a little extra output during tree dump to make it easier to figure out what's going on with parser errors.

This commit is contained in:
Curle 2020-11-21 22:17:02 +00:00
parent 28c349726e
commit 72fa2127c8
Signed by: TheCurle
GPG Key ID: 5942F13718443F79

View File

@ -75,7 +75,7 @@ void DumpTree(struct ASTNode* node, int level) {
case OP_GREATE: fprintf(stdout, "OP_GREATE\n"); return; case OP_GREATE: fprintf(stdout, "OP_GREATE\n"); return;
case TERM_INTLITERAL: fprintf(stdout, "TERM_INTLITERAL %d\n", node->Value.IntValue); return; case TERM_INTLITERAL: fprintf(stdout, "TERM_INTLITERAL %d\n", node->Value.IntValue); return;
case REF_IDENT: case REF_IDENT:
if(node->Right) if(node->RVal)
fprintf(stdout, "REF_IDENT rval %s\n", Symbols[node->Value.ID].Name); fprintf(stdout, "REF_IDENT rval %s\n", Symbols[node->Value.ID].Name);
else else
fprintf(stdout, "REF_IDENT %s\n", Symbols[node->Value.ID].Name); fprintf(stdout, "REF_IDENT %s\n", Symbols[node->Value.ID].Name);
@ -85,7 +85,8 @@ void DumpTree(struct ASTNode* node, int level) {
case OP_RET: fprintf(stdout, "OP_RET\n"); return; case OP_RET: fprintf(stdout, "OP_RET\n"); return;
case OP_CALL: fprintf(stdout, "OP_CALL %s\n", Symbols[node->Value.ID].Name); return; case OP_CALL: fprintf(stdout, "OP_CALL %s\n", Symbols[node->Value.ID].Name); return;
case OP_ADDRESS: fprintf(stdout, "OP_ADDRESS %s\n", Symbols[node->Value.ID].Name); return; case OP_ADDRESS: fprintf(stdout, "OP_ADDRESS %s\n", Symbols[node->Value.ID].Name); return;
case OP_DEREF: fprintf(stdout, "OP_DEREF\n"); return; case OP_DEREF:
fprintf(stdout, "OP_DEREF %s\n", node->RVal ? "rval" : ""); return;
case OP_SCALE: fprintf(stdout, "OP_SCALE %s\n", TypeNames[node->Value.Size]); return; case OP_SCALE: fprintf(stdout, "OP_SCALE %s\n", TypeNames[node->Value.Size]); return;
default: default: