Esempio n. 1
0
int main(int argc, const char * argv[])
{
    Token *token;
    Token *token_list; //This needs to be implemented as a linked list in scanner.h.
    char source_name[MAX_FILE_NAME_LENGTH];
    char date[DATE_STRING_LENGTH];
    FILE *source_file = init_lister(argv[1], source_name, date);
    init_scanner(source_file, source_name, date);
    
    do
    {
        token = get_token();
        add_token_to_list(token_list, token);
        print_token(token);
    }
    while (???);//What is the sentinal value that ends this loop?
    
    quit_scanner(source_file, token_list);
    return 0;
}
Esempio n. 2
0
int main(int argc, const char * argv[]) {
	Token *token;
	Token *token_list; 
	char source_name[MAX_FILE_NAME_LENGTH];
	char date[DATE_STRING_LENGTH];

	FILE *source_file = init_lister(argv[1], source_name, date);
	init_scanner(source_file, source_name, date);
	init_scanner2(source_name, date);
	token_list = malloc(sizeof(Token));
	token_list->nextptr = NULL;
	do {
		token = get_token();
		add_token_to_list(token_list, token);
		print_token(token);
	} while (token->token_string[0] != '.'); 

	quit_scanner(source_file, token_list);
	return 0;
}