Added output in to error file in CParser
This commit is contained in:
		
							parent
							
								
									070e2cba9e
								
							
						
					
					
						commit
						c8c36676b4
					
				
					 3 changed files with 23 additions and 5 deletions
				
			
		| 
						 | 
					@ -111,9 +111,15 @@ int CParser::yyparse(PrimImplikantCollection* &pic, vector<string>* &variables)
 | 
				
			||||||
			if (tok == INTEGER1)
 | 
								if (tok == INTEGER1)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (!KNFset)
 | 
									if (!KNFset)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
					KNF = (yylval.i == 0);
 | 
										KNF = (yylval.i == 0);
 | 
				
			||||||
 | 
										KNFset = true;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				else if ((yylval.i == 0) ^ KNF)
 | 
									else if ((yylval.i == 0) ^ KNF)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
 | 
										fprintf(IP_Error, "*** FATAL ERROR *** You can only define either KNF or DNF!\n");
 | 
				
			||||||
 | 
										fprintf(IP_Error, "In line %3d: %s>%i", pic->back()->name, yylval.i);
 | 
				
			||||||
 | 
										fprintf(IP_Error, "In line %3d: Defined was: %s, but now shall be changed to %s", (int)IP_LineNumber, KNF ? "KNF" : "DNF", KNF ? "DNF" : "KNF");
 | 
				
			||||||
					printf("*** FATAL ERROR *** You can only define either KNF or DNF!\n");
 | 
										printf("*** FATAL ERROR *** You can only define either KNF or DNF!\n");
 | 
				
			||||||
					return 1;
 | 
										return 1;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -332,7 +338,10 @@ int CParser::yylex()
 | 
				
			||||||
									}else
 | 
														}else
 | 
				
			||||||
										PushString((char)c);
 | 
															PushString((char)c);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
			default: printf("***Fatal Error*** Wrong case label in yylex\n");
 | 
								default:
 | 
				
			||||||
 | 
									fprintf(IP_Error, "*** FATAL ERROR *** Wrong case label in yylex\n");
 | 
				
			||||||
 | 
									fprintf(IP_Error, "In line %3d: state %i", IP_LineNumber, s);
 | 
				
			||||||
 | 
									printf("***Fatal Error*** Wrong case label in yylex\n");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -28,14 +28,14 @@ int _tmain(int argc, _TCHAR* argv[])
 | 
				
			||||||
		system("pause");
 | 
							system("pause");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fopen_s(&error, "..\\res\\error.txt", "w");
 | 
						fopen_s(&error, "..\\res\\errorParser.txt", "w");
 | 
				
			||||||
	if (error == 0)
 | 
						if (error == 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		cout << "Fehler Fehlerdatei";
 | 
							cout << "Fehler Fehlerdatei";
 | 
				
			||||||
		system("pause");
 | 
							system("pause");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	fopen_s(&list, "..\\res\\list.txt", "w");
 | 
						fopen_s(&list, "..\\res\\listParser.txt", "w");
 | 
				
			||||||
	if (list == 0)
 | 
						if (list == 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		cout << "Fehler Listdatei";
 | 
							cout << "Fehler Listdatei";
 | 
				
			||||||
| 
						 | 
					@ -51,7 +51,10 @@ int _tmain(int argc, _TCHAR* argv[])
 | 
				
			||||||
	parser.pr_tokentable();
 | 
						parser.pr_tokentable();
 | 
				
			||||||
	parser.InitParse(input, error, list);
 | 
						parser.InitParse(input, error, list);
 | 
				
			||||||
	if (parser.yyparse(globalPIC, variables) != 0)
 | 
						if (parser.yyparse(globalPIC, variables) != 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							system("pause");
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	system("pause");
 | 
						system("pause");
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/*pic.add(7);
 | 
						/*pic.add(7);
 | 
				
			||||||
| 
						 | 
					@ -79,7 +82,7 @@ int _tmain(int argc, _TCHAR* argv[])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vector<Cell*> cells;
 | 
						vector<Cell*> cells;
 | 
				
			||||||
	cells.resize(numElements);
 | 
						cells.resize(numElements);
 | 
				
			||||||
	for (int i = 0; i < numElements; i++)
 | 
						for (unsigned int i = 0; i < numElements; i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		cells[i] = new Cell(i, globalPIC);
 | 
							cells[i] = new Cell(i, globalPIC);
 | 
				
			||||||
		printf("Pos %2d: %d\n", i, cells[i]->value);
 | 
							printf("Pos %2d: %d\n", i, cells[i]->value);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,9 +15,15 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool valueAt(int position);
 | 
						bool valueAt(int position);
 | 
				
			||||||
	PrimImplikantCollection primImplikantenAt(int position);
 | 
						PrimImplikantCollection primImplikantenAt(int position);
 | 
				
			||||||
	unsigned int size();
 | 
					 | 
				
			||||||
	void deleteAll();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						unsigned int size();
 | 
				
			||||||
 | 
						PrimImplikant* back();
 | 
				
			||||||
 | 
						PrimImplikant* front();
 | 
				
			||||||
 | 
						PrimImplikant* at();
 | 
				
			||||||
 | 
						PrimImplikant* operator[](int const &index);
 | 
				
			||||||
 | 
						const PrimImplikant* operator[](int const &index) const;	
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						~PrimImplikantCollection();	// destructor
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	vector<PrimImplikant*> PIVector;
 | 
						vector<PrimImplikant*> PIVector;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue