updated lex to return the right values to the tokens (mostly table entries)

This commit is contained in:
Partho
2025-04-03 20:05:53 -04:00
parent 3bae28dfef
commit 0eb0b8097c
3 changed files with 53 additions and 23 deletions

View File

@ -769,6 +769,26 @@ TableNode *CreateEntry(SymbolTable *table, TableNode *typeOf, char *id,
}
}
TableNode *getTypeEntry(TableNode *tn) {
if (tn == NULL) {
printdebug("passed a NULL table entry to getType");
return undefined;
}
if (tn == undefined) {
printdebug("passed an undefined table entry to getType");
return undefined;
}
if (tn->theType == NULL) {
printdebug("type of entry is currently NULL type");
return undefined;
}
if (tn->theType == undefined) {
printdebug("type of entry is currently undefined type");
return undefined;
}
return tn->theType;
}
char *getType(TableNode *tn) {
if (tn == NULL) {
printdebug("passed a NULL table entry to getType");