test30.y

来自「使用flex和bison」· Y 代码 · 共 2,573 行 · 第 1/5 页

Y
2,573
字号
			fprintf(yyout,"%5d:%10s\t%s\t%d\t%d\n",outlineno++,looktokentable(CHECKINTSECTION4),$3,$5,$7);
			
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%d\t%d\n",outlineno,CHECKINTSECTION4,$3,$5,$7);
		
		}
	} |
	CHECKINTSECTION 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: checkintsection 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: checkintsection function parameter3 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}

		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: checkintsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\t%s\t%s\n",outlineno++,looktokentable(CHECKINTSECTION5),$3,$5,$7);
		
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\t%s\t%s\n",outlineno,CHECKINTSECTION5,$3,$5,$7);
		}
	} |
	CHECKINTSECTION 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: checkintsection function parameter2 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
	

		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: checkintsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\t%s\t%d\n",outlineno++,looktokentable(CHECKINTSECTION6),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\t%s\t%d\n",outlineno,CHECKINTSECTION6,$3,$5,$7);
		}
	} |
	CHECKINTSECTION 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: checkintsection function parameter2 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}

		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: checkintsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\t%d\t%s\n",outlineno++,looktokentable(CHECKINTSECTION7),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\t%d\t%s\n",outlineno,CHECKINTSECTION7,$3,$5,$7);
		
		}
	} |
	CHECKINTSECTION LEFTC NUMBER ',' NUMBER ',' NUMBER RIGHTC
	{
		if(assigntype!=0)
		{
			printf("%s(%d): syntax error: checkintsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\t%d\t%d\n",outlineno++,looktokentable(CHECKINTSECTION8),$3,$5,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\t%d\t%d\n",outlineno,CHECKINTSECTION8,$3,$5,$7);
		}
	} |
	CHECKSTRINGSECTION 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==1)
		{
			printf("%s(%d): syntax error: checkstringsection function parameter1 need a string-type parameter \n",filename,lineno);
			errcount ++;
		}

		i =	lookstringtable($5);
		if(i==0)
		{
			printf("%s(%d): syntax error: var %s no define\n ",filename,lineno,$5);
			errcount ++;
		}
		else if(i==1)
		{
			printf("%s(%d): syntax error: checkstringsection function parameter2 need a string-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==1)
		{
			printf("%s(%d): syntax error: checkstringsection function parameter3 need a string-type parameter\n ",filename,lineno);
			errcount ++;
		}

		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: checkstringsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\t%s\t%s\n",outlineno++,looktokentable(CHECKSTRINGSECTION1),$3,$5,$7);
			
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%s\t%s\n",outlineno,CHECKSTRINGSECTION1,$3,$5,$7);
		
		}
	} |
	CHECKSTRINGSECTION LEFTC ID ',' ID ',' STR 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: checkstringsection function parameter1 need a string-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==1)
		{
			printf("%s(%d): syntax error: checkstringsection function parameter2 need a string-type parameter \n",filename,lineno);
			errcount ++;
		}
	

		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: checkstringsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\t%s\n",outlineno++,looktokentable(CHECKSTRINGSECTION2),$3,$5);
			fprintf(yyout,"%5d:%s\n",outlineno++,$7);	
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%s\n",outlineno,CHECKSTRINGSECTION2,$3,$5);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$7);
		
		}
	} |
	CHECKSTRINGSECTION LEFTC ID ',' STR ',' 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: checkstringsection function parameter1 need a string-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==1)
		{
			printf("%s(%d): syntax error: checkstringsection function parameter3 need a string-type parameter \n",filename,lineno);
			errcount ++;
		}

		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: checkstringsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\t%s\n",outlineno++,looktokentable(CHECKSTRINGSECTION3),$3,$7);
			fprintf(yyout,"%5d:%s\n",outlineno++,$5);	
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%s\n",outlineno,CHECKSTRINGSECTION3,$3,$7);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$5);
		
		}
	} |
	CHECKSTRINGSECTION LEFTC ID ',' STR ',' STR 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: checkstringsection function parameter1 need a string-type parameter \n",filename,lineno);
			errcount ++;
		}

	
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: checkstringsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(CHECKSTRINGSECTION4),$3);
			fprintf(yyout,"%5d:%s\n",outlineno++,$5);
			fprintf(yyout,"%5d:%s\n",outlineno++,$7);		
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,CHECKSTRINGSECTION4,$3);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$5);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$7);
		
		}
	} |
	CHECKSTRINGSECTION LEFTC STR ',' 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==1)
		{
			printf("%s(%d): syntax error: checkstringsection function parameter2 need a string-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: checkstringsection function parameter3 need a string-type parameter \n",filename,lineno);
			errcount ++;
		}

		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: checkstringsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\t%s\n",outlineno++,looktokentable(CHECKSTRINGSECTION5),$5,$7);
			fprintf(yyout,"%5d:%s\n",outlineno++,$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\t%s\n",outlineno,CHECKSTRINGSECTION5,$5,$7);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$3);
		}
	} |
	CHECKSTRINGSECTION LEFTC STR ',' ID ',' STR 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==1)
		{
			printf("%s(%d): syntax error: checkstringsection function parameter2 need a string-type parameter \n",filename,lineno);
			errcount ++;
		}
	

		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: checkstringsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(CHECKSTRINGSECTION6),$5);
			fprintf(yyout,"%5d:%s\n",outlineno++,$3);
			fprintf(yyout,"%5d:%s\n",outlineno++,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,CHECKSTRINGSECTION6,$5);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$3);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$7);
		}
	} |
	CHECKSTRINGSECTION LEFTC STR ',' STR ',' 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==1)
		{
			printf("%s(%d): syntax error: checkstringsection function parameter2 need a string-type parameter \n",filename,lineno);
			errcount ++;
		}

		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: checkstringsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(CHECKSTRINGSECTION7),$7);
			fprintf(yyout,"%5d:%s\n",outlineno++,$3);
			fprintf(yyout,"%5d:%s\n",outlineno++,$5);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,CHECKSTRINGSECTION7,$7);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$3);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$5);
		}
	} |
	CHECKSTRINGSECTION LEFTC STR ',' STR ',' STR RIGHTC
	{
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: checkstringsection type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\n",outlineno++,looktokentable(CHECKSTRINGSECTION8));
			fprintf(yyout,"%5d:%s\n",outlineno++,$3);
			fprintf(yyout,"%5d:%s\n",outlineno++,$5);
			fprintf(yyout,"%5d:%s\n",outlineno++,$7);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\n",outlineno,CHECKSTRINGSECTION8);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$3);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$5);
			outlineno++;
			fprintf(yyout,"%5d:\t%s\n",outlineno,$7);
		}
	} |
	GETRAND 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==2)
		{
			printf("%s(%d): syntax error: getrand function parameter1 need a int-type parameter \n",filename,lineno);
			errcount ++;
		}
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: getrand type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%s\n",outlineno++,looktokentable(GETRAND1),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%s\n",outlineno,GETRAND1,$3);
		}
	} |
	GETRAND LEFTC NUMBER RIGHTC
	{
		if(assigntype!=1)
		{
			printf("%s(%d): syntax error: getrand type conflict \n",filename,lineno);
			errcount ++;
		}
		if(ofiletype==1)
		{
			fprintf(yyout,"%5d:%10s\t%d\n",outlineno++,looktokentable(GETRAND2),$3);
		}
		else
		{
			outlineno++;
			fprintf(yyout,"%5d:\t%5d\t%d\n",outlineno,GETRAND2,$3);
		}
	} |
	GETRANDKEY LEFTC ID RIGHTC
	{

⌨️ 快捷键说明

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