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

📄 cifaview.cpp

📁 词法分析
💻 CPP
📖 第 1 页 / 共 2 页
字号:
		                       temp.Format("%d",Arr[i].N.D);
		                      m_list.SetItemText(c,3,temp);
		                      temp.Format("%d",Arr[i].N.E);
		                     m_list.SetItemText(c,4,temp);
                            temp.Format("%s",Arr[i].fuhao);
		                     m_list.SetItemText(c,5,temp);
                               sym="";//请空
				               break;				  
							} 
				  
					  } //for
					  if(flag==-1)
					  {c++;
						  temp.Format("%d",0);
		              m_list.InsertItem(c,temp);                
		              temp.Format("%d",0);
		              m_list.SetItemText(c,2,temp);
		              temp.Format("%d",1);
		              m_list.SetItemText(c,4,temp);
                     temp.Format("%s",sym);
		             m_list.SetItemText(c,5,temp);
				     sym="";
				     //break;
					  }
					
	
			}

             if(ch>='A'&&ch<='Z')
			{ 
				while (ch!=" ")
				{   ch=str.GetAt(pos);
				    if(ch>='A'&&ch<='Z'||ch>='0'&&ch<='9')
					{sym=sym+ch;
					 pos++;
                     }
					else
						break;
				}
			          for(int i=0;i<=26;i++)
						{ 
				           if(sym==Arr[i].fuhao)
						   {flag=1;
						   c++;
			                  temp.Format("%d",Arr[i].N.A);
		                      m_list.InsertItem(c,temp);
                              temp.Format("%d",Arr[i].N.B);
		                      m_list.SetItemText(c,1,temp);
		                      temp.Format("%d",Arr[i].N.C);
		                      m_list.SetItemText(c,2,temp);
		                       temp.Format("%d",Arr[i].N.D);
		                      m_list.SetItemText(c,3,temp);
		                      temp.Format("%d",Arr[i].N.E);
		                     m_list.SetItemText(c,4,temp);
                            temp.Format("%s",Arr[i].fuhao);
		                     m_list.SetItemText(c,5,temp);
                               sym="";//请空
				               break;				  
							} 
				  
					  } //for
					  if(flag==-1)
					  {c++;
						  temp.Format("%d",0);
		              m_list.InsertItem(c,temp);                
		              temp.Format("%d",0);
		              m_list.SetItemText(c,2,temp);
		              temp.Format("%d",1);
		              m_list.SetItemText(c,4,temp);
                     temp.Format("%s",sym);
		             m_list.SetItemText(c,5,temp);
				     sym="";
				    // break;
					  }
					
	
			}
  

		      	if(ch>='0'&&ch<='9')
				{
				   while (ch!=" "&&pos<length)
				   {   
					  ch=str.GetAt(pos);
				     if(ch>='0'&&ch<='9')
					 {sym=sym+ch;
					   pos++;
					 }
					 else if(ch>='a'&&ch<='z'||ch>='A'&&ch<='Z')
					 {     c++;
	 					   temp.Format("%s%s%d%s%s","语法错误 ","第",c+1,"行:",sym+ch);
	 					   MessageBox(temp,NULL,MB_ICONERROR);
						   temp.Format("%s","错误");
		                   m_list.InsertItem(c,temp); 
                           temp.Format("%s",sym+ch);
		                   m_list.SetItemText(c,5,temp);
						  break;  
					 }
					
					  else
					  {   c++;
						  temp.Format("%d",0);
		                  m_list.InsertItem(c,temp);                
		                  temp.Format("%d",0);
		                  m_list.SetItemText(c,2,temp);
		                  temp.Format("%d",2);
		                  m_list.SetItemText(c,4,temp);
                          temp.Format("%s",sym);
		                  m_list.SetItemText(c,5,temp);
					      sym="";
						  break;
					  }	 
				   }
			           
					      
					   
					}

				  if(ch==" ")
				  {
					 sym="";
				  }
				  if(ch=='\n')
				  {
					   sym="";
				  }
				  else if(ch!=" ")
				  {   sym=sym+ch;
				      CString zan=sym;
				      if(pos<length-1)
					  {
						  sym=sym+str.GetAt(pos+1);
						  
					  }
                         
                      if(sym!="/*")
					  {  
						  

						  for(int i=0;i<=26;i++)
						  { 
				           if(sym==Arr[i].fuhao)
						   {
							   h=1;
							   c++;
			                  temp.Format("%d",Arr[i].N.A);
		                      m_list.InsertItem(c,temp);
                              temp.Format("%d",Arr[i].N.B);
		                      m_list.SetItemText(c,1,temp);
		                      temp.Format("%d",Arr[i].N.C);
		                      m_list.SetItemText(c,2,temp);
		                       temp.Format("%d",Arr[i].N.D);
		                      m_list.SetItemText(c,3,temp);
		                      temp.Format("%d",Arr[i].N.E);
		                      m_list.SetItemText(c,4,temp);
                              temp.Format("%s",Arr[i].fuhao);
		                      m_list.SetItemText(c,5,temp);
                              sym="";//请空
							  pos++;
				               break;	
						   }
							 
						  }  


						  if(h==-1)
						  {	 sym=zan;
						     for(int i=0;i<=26;i++)
							 { 
				             if(sym==Arr[i].fuhao)
							 {
							   h=1;c++;
			                  temp.Format("%d",Arr[i].N.A);
		                      m_list.InsertItem(c,temp);
                              temp.Format("%d",Arr[i].N.B);
		                      m_list.SetItemText(c,1,temp);
		                      temp.Format("%d",Arr[i].N.C);
		                      m_list.SetItemText(c,2,temp);
		                       temp.Format("%d",Arr[i].N.D);
		                      m_list.SetItemText(c,3,temp);
		                      temp.Format("%d",Arr[i].N.E);
		                      m_list.SetItemText(c,4,temp);
                              temp.Format("%s",Arr[i].fuhao);
		                      m_list.SetItemText(c,5,temp);
                              sym="";//请空
				                 break;	
							 } 
							 
							 }  
							// if(h==-1)
							//	 MessageBox("非法字符",sym,MB_ICONHAND);
						  }


					  }






					  else
					  {
                       while(pos<length-1)
						 {   pos++;
							 ch=str.GetAt(pos);
							 if(ch=='/')
								 break;
						 }
                              c++;
						     temp.Format("%s","此");
		                      m_list.InsertItem(c,temp);
                              temp.Format("%s","行");
		                      m_list.SetItemText(c,1,temp);
		                      temp.Format("%s","为");
		                      m_list.SetItemText(c,2,temp);
		                       temp.Format("%s","注");
		                      m_list.SetItemText(c,3,temp);
		                      temp.Format("%s","释");
		                      m_list.SetItemText(c,4,temp);
                              temp.Format("%s","/* */");
		                      m_list.SetItemText(c,5,temp);
                              ch="";
					  } 


				  }//else
		 
				  
	   pos++; 
	}//while
	
}//void

void CCIFAView::OnButton3() 
{
CCIFAView::OnButton3();
	
}

void CCIFAView::OnRadio6() 
{
	select=0;
	
}

void CCIFAView::OnRadio7() 
{
 select=1;
	
}

void CCIFAView::OnRadio8() 
{
	select=2;
	
}

void CCIFAView::OnButton4() //remove
{
 m_list.DeleteAllItems();
this->SetDlgItemText(IDC_EDIT1,"");	
}

⌨️ 快捷键说明

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