Example #1
0
queue<string> readfile(fstream &fin,parser &SLRparser)
{
	char line[SIZE];
	queue<string> testCases;
    while(fin.getline(line,sizeof(line),'\n')){
		string transfer(line);
		if(!strncmp(line, "#", 1)){
		}
		else if(!strncmp(line, "non-term:", 9)){
			SLRparser.storeNonTerminals(transfer.substr(9));
		}
		else if(!strncmp(line, "term:", 5)){
			SLRparser.storeTerminals(transfer.substr(5));
		}
		else if(!strncmp(line, "prod:", 5)){
			SLRparser.storeProductions(transfer.substr(5));
		}
		else if(!strncmp(line, "start:", 6)){
			SLRparser.storeStartSymbol(transfer.substr(6));
		}
		else{
			testCases.push(transfer);
		}
    }
	return testCases;
}