--- a/c2iec.l +++ b/c2iec.l @@ -13,6 +13,7 @@ void count(void); void comment(void); int check_type(void); +int isSym(char *szSym); %} %% @@ -166,18 +167,15 @@ int check_type(void) { -/* -* pseudo code --- this is what it should check -* -* if (yytext == type_name) -* return TYPE_NAME; -* -* return IDENTIFIER; -*/ + if ( !strcmp(yytext, "void") + || !strcmp(yytext, "char") + || !strcmp(yytext, "short") + || !strcmp(yytext, "int") + || !strcmp(yytext, "long")) + return TYPE_NAME; -/* -* it actually will only return IDENTIFIER -*/ + if (isSym(yytext)) + return TYPE_NAME; return IDENTIFIER; }