All pastes #819460 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2007-12-16 23:34 UTC
rendered paste body
//уже функция которая естьvoid validate_tag(const text_buffer & text)  {    bool comment = false;    std::stack<char> tags;    text_buffer::const_iterator cur = text.begin(), end = text.end();        for (;cur != end;++cur)       {	if (*cur == '!')	  comment=!comment;		if (!comment) 	  {	    if( tgOpen.find(*cur) != std::string::npos)	      {		std::cout << *cur << std::endl;		tags.push(*cur);		continue;	      }	    int n;	    if( (n = tgClose.find(*cur)) != std::string::npos)	      {	      std::cout << *cur << std::endl;	      if (!tags.empty()) 		{		  if (tgOpen[n] != tags.top())		    std::cout<<"tags error: no open tag!"<<std::endl;		  tags.pop();		} 	      else 		{		  std::cout<<"tags error: wrong close tag!"<<std::endl;		}	      }	  }      }    if (!tags.empty())       {	std::cout<<"tags error: no close tag!"<<std::endl;      }    std::cout<<"comment: "<<comment<<std::endl;  }//Еще нужноvoid validate_ABC(const text_buffer & text)  {  	text_buffer::const_iterator cur = text.begin(), end = text.end();    for (;cur != end;++cur)    {    	//проверка на принадлежность к алфавиту    }   }//И функции работы с числамиbool testNumeral(char *str, int n){	const char num[17] = "0123456789absdef";	char num_n[17];		strncpy(num_n, num, n);	num_n[n]='\0';		//std::cout<<num_n<<endl;		if (strspn(str, num_n) == strlen(str))		return true;	else		return false;}bool testNumber(char *str){	char c[] = {'@', '#', '$'};	int  n[] = { 2 ,  10,  16};		int i, count=3;		for (i=0; i<count; i++)		if (c[i]==str[0])			break;	str++;			if (i<count)		return testNumeral(str, n[i]);	else		return false;}//желательно бы канешн привести к виду void validate_num(const text_buffer & text) ...