fixed getAdInfo function
This commit is contained in:
@ -66,10 +66,10 @@ typedef enum {
|
|||||||
// TYPE_ADDRESS,
|
// TYPE_ADDRESS,
|
||||||
// Type String is an array of char enclosed in double quotes per lexer
|
// Type String is an array of char enclosed in double quotes per lexer
|
||||||
TYPE_STRING = 1,
|
TYPE_STRING = 1,
|
||||||
// Array can be multidimensional. Information should be stored here
|
// Array can be multidimensional. Information should be stored here. This is the type of the array
|
||||||
TYPE_ARRAY = 2,
|
TYPE_ARRAY_TYPE = 2,
|
||||||
// Record is user defined types
|
// Record is user defined types
|
||||||
TYPE_RECORD = 3,
|
TYPE_RECORD_TYPE = 3,
|
||||||
// Declaring what type a particular function is without as
|
// Declaring what type a particular function is without as
|
||||||
TYPE_FUNCTION_DECLARATION = 4,
|
TYPE_FUNCTION_DECLARATION = 4,
|
||||||
// Declaring what type a particular function is with as
|
// Declaring what type a particular function is with as
|
||||||
@ -82,7 +82,9 @@ typedef enum {
|
|||||||
TYPE_PRIMITIVE = 6,
|
TYPE_PRIMITIVE = 6,
|
||||||
// likely NULL
|
// likely NULL
|
||||||
TYPE_ALL_ELSE = 7,
|
TYPE_ALL_ELSE = 7,
|
||||||
TYPE_UNDEFINED = 8
|
TYPE_UNDEFINED = 8,
|
||||||
|
TYPE_RECORD = 9,
|
||||||
|
TYPE_ARRAY = 10
|
||||||
|
|
||||||
} types;
|
} types;
|
||||||
|
|
||||||
@ -688,13 +690,13 @@ int getAdInfoType(TableNode *tn) {
|
|||||||
return TYPE_PRIMITIVE;
|
return TYPE_PRIMITIVE;
|
||||||
}
|
}
|
||||||
if (strcmp(getName(tn), getName(stri)) == 0) {
|
if (strcmp(getName(tn), getName(stri)) == 0) {
|
||||||
return TYPE_ARRAY;
|
return TYPE_ARRAY_TYPE;
|
||||||
}
|
}
|
||||||
if (strcmp(getName(tn), getName(boo)) == 0) {
|
if (strcmp(getName(tn), getName(boo)) == 0) {
|
||||||
return TYPE_PRIMITIVE;
|
return TYPE_PRIMITIVE;
|
||||||
}
|
}
|
||||||
if (strcmp(getName(tn), getName(recprime)) == 0) {
|
if (strcmp(getName(tn), getName(recprime)) == 0) {
|
||||||
return TYPE_RECORD;
|
return TYPE_RECORD_TYPE;
|
||||||
}
|
}
|
||||||
if (strcmp(getName(tn), getName(funtypeprime)) == 0) {
|
if (strcmp(getName(tn), getName(funtypeprime)) == 0) {
|
||||||
return TYPE_FUNCTION_TYPE;
|
return TYPE_FUNCTION_TYPE;
|
||||||
@ -705,6 +707,21 @@ int getAdInfoType(TableNode *tn) {
|
|||||||
if (strcmp(getName(tn), getName(undefined)) == 0) {
|
if (strcmp(getName(tn), getName(undefined)) == 0) {
|
||||||
return TYPE_UNDEFINED;
|
return TYPE_UNDEFINED;
|
||||||
} else {
|
} else {
|
||||||
|
if(strcmp(getType(tn), getName(funtypeprime))==0){
|
||||||
|
printdebug("passed in a function to getAdInfoType");
|
||||||
|
return TYPE_FUNCTION_DECLARATION;
|
||||||
|
}
|
||||||
|
if(strcmp(getType(tn), getName(arrayprim))==0){
|
||||||
|
printdebug("passed in an array to getAdInfoType");
|
||||||
|
return TYPE_ARRAY;
|
||||||
|
}
|
||||||
|
if(strcmp(getType(tn), getName(recprime))==0){
|
||||||
|
printdebug("passed in a record to getAdInfoType");
|
||||||
|
return TYPE_RECORD;
|
||||||
|
}
|
||||||
|
printdebug(
|
||||||
|
"passed in an entry that is not a primitive type, array, "
|
||||||
|
"or record. Invalid.");
|
||||||
return TYPE_FUNCTION_DECLARATION;
|
return TYPE_FUNCTION_DECLARATION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user