la funzione è questa:
codice:
Bool is_keyword(char s[]) {
int i;
char* r;
r = (char* ) s;
Bool is_key = FALSE;
for(i = 0; i < numkey; i++)
if (strcmp(keywords[i],s)==0)
is_key = TRUE;
return is_key;
}
la dichiarazione della prima variabile e questa:
codice:
/ variabile globale per le parole riservate del linguaggio
char *keywords[]={"auto","break","case", "const", "continue","default", "do","double","else","enum","extern","float", "for", "goto", "if", "int","long","register","return","short","signed", "sizeof", "static", "struct","switch","typedef","unsigned", "void", "volatile","while",NULL};
la variabile s[] è il parametro formale del value della seguente struttura:
codice:
//definizione del tipo di dato Token
typedef struct { TokenType type; // TokenType.
char value[MAX_STRING_LENGTH]; // valore del token. } Token;
grazie!!