⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test30.y

📁 使用flex和bison
💻 Y
📖 第 1 页 / 共 5 页
字号:
		int i;
	
		i =	lookstringtable($3);
		if(i==0)
		{
			printf("%s(%d): syntax error: var %s no define\n",filename,lineno,$3);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: getrandkey function parameter1 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: getrandkey type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(GETRANDKEY1),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,GETRANDKEY1,$3);

		}
	} |
	GETRANDKEY LEFTC NUMBER RIGHTC
	{
	
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: getrandkey type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\n",outlineno++,looktokentable(GETRANDKEY2),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\n",outlineno,GETRANDKEY2,$3);
		}
	} |
	FINDFILE LEFTC ID RIGHTC
	{
		int i;
	
		i =	lookstringtable($3);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$3);
			errcount ++;
		}
		else if(i==1)
		{
			printf("%s(%d): syntax error: finefile function parameter1 need a string-type parameter \n",filename,lineno);
			errcount ++;
		}
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: findfile type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(FINDFILE1),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,FINDFILE1,$3);

		}
	} |
	FINDFILE LEFTC STR RIGHTC
	{
		
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: findfile type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\n",outlineno++,looktokentable(FINDFILE2));
			fprintf(yyout,"%5d:%s\n",outlineno++,$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\n",outlineno,FINDFILE2);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$3);

		}
	} |

	GETNOWTIME LEFTC ID RIGHTC
	{
		int i;
	
		i =	lookstringtable($3);
		if(i==0)
		{
			printf("%s(%d): syntax error: var %s no define\n",filename,lineno,$3);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: getnowtime function parameter1 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: getnowtime type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(GETNOWTIME1),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,GETNOWTIME1,$3);

		}
	} |
	GETNOWTIME LEFTC NUMBER RIGHTC
	{
	
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: getnowtime type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\n",outlineno++,looktokentable(GETNOWTIME2),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\n",outlineno,GETNOWTIME2,$3);
		}
	} |
	TIMESPAN LEFTC ID  RIGHTC 
		{
			int result=lookstringtable($3);
			if(result==0)
			{
				printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$3);
					errcount ++;	
			}
			else if(result==2)
			{
				printf("%s(%d): syntax error: timespan function parameter1  need a int-type parameter \n",filename,lineno);	
					errcount ++;	
			}
			if(ofiletype==1)
				fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(TIMESPAN1),$3);	
			else
			{
				outlineno++;
				fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,TIMESPAN1,$3);
			}	
		} |
		TIMESPAN LEFTC NUMBER  RIGHTC 
		{
			if(ofiletype==1)
				fprintf(yyout,"%5d:%10s\t%d\n",outlineno++,looktokentable(TIMESPAN2),$3);
			else
			{
				outlineno++;
				fprintf(yyout,"%5d:\t%5d\t%d\n",outlineno,TIMESPAN2,$3);
				}	
		}
		;	|
	GETDIALINTIME LEFTC ID RIGHTC
	{
		int i;
	
		i =	lookstringtable($3);
		if(i==0)
		{
			printf("%s(%d): syntax error: var %s no define\n",filename,lineno,$3);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: getdialintime function parameter1 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: getdialintime type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(GETDIALINTIME1),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,GETDIALINTIME1,$3);

		}
	} |
	GETDIALINTIME LEFTC NUMBER RIGHTC
	{
	
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: getdialintime type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\n",outlineno++,looktokentable(GETDIALINTIME2),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\n",outlineno,GETDIALINTIME2,$3);
		}
	} |
	JUMPFLOW LEFTC ID ',' ID ',' ID RIGHTC
	{
		int i;
		i =	lookstringtable($3);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$3);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter1 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}

		i =	lookstringtable($5);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$5);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter2 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
		i =	lookstringtable($7);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$7);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter3 need a int-type parameter\n ",filename,lineno);
			errcount ++;
		}
		
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: jumpflow type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\t%s\t%s\n",outlineno++,looktokentable(JUMPFLOW1),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%s\t%s\n",outlineno,JUMPFLOW1,$3,$5,$7);
		
		}
		
	}|
	JUMPFLOW LEFTC ID ',' ID ',' NUMBER RIGHTC
	{
		int i;
		i =	lookstringtable($3);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$3);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter1 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}

		i =	lookstringtable($5);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$5);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter2 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
	
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: jumpflow type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\t%s\t%d\n",outlineno++,looktokentable(JUMPFLOW2),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%s\t%d\n",outlineno,JUMPFLOW2,$3,$5,$7);
		
		}
		
	}|
	JUMPFLOW LEFTC ID ',' NUMBER ',' ID RIGHTC
	{
		int i;
		i =	lookstringtable($3);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$3);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter1 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
		i =	lookstringtable($7);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$7);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter3 need a int-type parameter\n ",filename,lineno);
			errcount ++;
		}

		
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: jumpflow type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\t%d\t%s\n",outlineno++,looktokentable(JUMPFLOW3),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%d\t%s\n",outlineno,JUMPFLOW3,$3,$5,$7);
		
		}
		
	}|
	JUMPFLOW LEFTC ID ',' NUMBER ',' NUMBER RIGHTC
	{
		int i;
		i =	lookstringtable($3);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$3);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter1 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
			
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: jumpflow type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\t%d\t%d\n",outlineno++,looktokentable(JUMPFLOW4),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%d\t%d\n",outlineno,JUMPFLOW4,$3,$5,$7);
		
		}
		
	}|
	JUMPFLOW LEFTC NUMBER ',' ID ',' ID RIGHTC
	{
		int i;
	
		i =	lookstringtable($5);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$5);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter2 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
		i =	lookstringtable($7);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$7);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter3 need a int-type parameter\n ",filename,lineno);
			errcount ++;
		}
				
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: jumpflow type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\t%s\t%s\n",outlineno++,looktokentable(JUMPFLOW5),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\t%s\t%s\n",outlineno,JUMPFLOW5,$3,$5,$7);
		
		}
		
	}|
	JUMPFLOW LEFTC NUMBER ',' ID ',' NUMBER RIGHTC
	{
		int i;
	
		i =	lookstringtable($5);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$5);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter2 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
					
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: jumpflow type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\t%s\t%d\n",outlineno++,looktokentable(JUMPFLOW6),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\t%s\t%d\n",outlineno,JUMPFLOW6,$3,$5,$7);
		
		}
	
		
	}|
	JUMPFLOW LEFTC NUMBER ',' NUMBER ',' ID RIGHTC
	{
		int i;
	
		i =	lookstringtable($7);
		if(i==0)
		{
			printf("%s(%d): syntax error: undeclared identifier '%s' \n",filename,lineno,$7);
			errcount ++;
		}
		else if(i==2)
		{
			printf("%s(%d): syntax error: jumpflow function parameter3 need a int-type parameter\n ",filename,lineno);
			errcount ++;
		}
						
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: jumpflow type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\t%d\t%s\n",outlineno++,looktokentable(JUMPFLOW7),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\t%d\t%s\n",outlineno

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -