Advertisement
Madmouse

lol, man that is old code

Dec 20th, 2015
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. std::vector<std::string> parsev(std::string input)
  2. {
  3.     std::vector<std::string> inputv, returnv;
  4.    
  5.     if(input.find(";") == std::string::npos ||
  6.         input.find("#") == std::string::npos ||
  7.             input.find("@") == std::string::npos)
  8.     {
  9.         boost::split(inputv, input, boost::is_any_of("\t\r\n ,<>()"));
  10.    
  11.         for(auto i : inputv)
  12.         {
  13.             if(i!="")
  14.                 returnv.push_back(i);
  15.         }
  16.         if(returnv.size() == 3 &&
  17.             (returnv[2].find("%") != std::string::npos||
  18.                 returnv[1].find("$") != std::string::npos))
  19.         {
  20.             std::string swap = returnv.at(1);
  21.             returnv.erase(returnv.begin()+1);
  22.             returnv.push_back(swap);
  23.            
  24.             boost::algorithm::trim_left_if(returnv.at(1),boost::algorithm::is_any_of("%$"));
  25.             boost::algorithm::trim_left_if(returnv.at(2),boost::algorithm::is_any_of("%$"));
  26.         }
  27.         else if(returnv.size() == 2 && registers.count(returnv.at(1).substr(1)) != 0)
  28.             boost::algorithm::trim_left_if(returnv.at(1),boost::algorithm::is_any_of("%$"));
  29.     }
  30.     else
  31.         returnv.push_back(input);
  32.     return returnv;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement