starting to work on grammar fixes
This commit is contained in:
@ -174,14 +174,15 @@ definition:
|
||||
} L_PAREN {
|
||||
TableNode * parameter = getParameter(getTypeEntry(table_lookup(getAncestor(cur), $1)));
|
||||
//TableNode *parameter = getParameter(table_lookup(getAncestor(cur), getType(table_lookup(getAncestor(cur), $1))));
|
||||
printdebug("parameter type: %s", getType(parameter));
|
||||
printdebug("type of parameter: %s", getName(parameter));
|
||||
if (parameter == undefined) {
|
||||
printdebug("[TYPE CHECK] function defined with as, but parameter is undefined at line %d, column %d", @1.first_line, @1.first_column);
|
||||
}else if(getAdInfoType(parameter) != TYPE_RECORD){
|
||||
int type_of_param_type = getAdInfoType(parameter);
|
||||
}else if(getAdInfoType(parameter) != TYPE_RECORD_TYPE){
|
||||
int type_of_param_type = getAdInfoType(parameter);//this is an enum value defined in symbol_table.h
|
||||
if( type_of_param_type == TYPE_UNDEFINED
|
||||
|| type_of_param_type == TYPE_FUNCTION_DECLARATION
|
||||
|| type_of_param_type == TYPE_ARRAY
|
||||
|| type_of_param_type == TYPE_PRIMITIVE
|
||||
|| type_of_param_type == TYPE_ALL_ELSE
|
||||
|| type_of_param_type == TYPE_SYSTEM_DEFINED
|
||||
|| type_of_param_type == TYPE_STRING){ // note that strings are actually arrays so this is unused
|
||||
@ -355,7 +356,7 @@ declaration:
|
||||
printdebug("ID/TYPE: %s, ID: %s", getName((TableNode*)$1), $3) ;
|
||||
int d = getAdInfoType((TableNode*)$1);
|
||||
if(d == TYPE_UNDEFINED) {
|
||||
printdebug("undefined type at line %d and column %d", @2.first_line, @2.first_column);
|
||||
printdebug("[TYPE CHECK] undefined type at line %d and column %d", @2.first_line, @2.first_column);
|
||||
CreateEntry(cur,d,(TableNode*)$1,$3,getAdInfo((TableNode*)$1));
|
||||
}
|
||||
else if(d == TYPE_FUNCTION_TYPE) {
|
||||
@ -373,11 +374,12 @@ declaration:
|
||||
d = TYPE_RECORD;
|
||||
CreateEntry(cur,d,(TableNode*)$1,$3,getAdInfo((TableNode*)$1));
|
||||
}
|
||||
else if(d == TYPE_PRIMITIVE){
|
||||
else if(d == TYPE_PRIMITIVE_TYPE){
|
||||
printdebug("primitive variable at line %d and column %d", @2.first_line, @2.first_column);
|
||||
d = TYPE_PRIMITIVE;
|
||||
CreateEntry(cur,d,(TableNode*)$1,$3,getAdInfo((TableNode*)$1));
|
||||
}else {
|
||||
printdebug("other invalid type passed at %d and column %d", @2.first_line, @2.first_column);
|
||||
printdebug("[TYPE CHECK] other invalid type passed at %d and column %d", @2.first_line, @2.first_column);
|
||||
CreateEntry(cur,d,(TableNode*)$1,$3,getAdInfo((TableNode*)$1));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user