97 std::string str_mod =
str;
98 const char* c_str_mod =
str.c_str();
99 std::vector<int> variable_ends;
100 int cur_variable_end = 0;
108 else if(isalpha(*c_str_mod))
122 std::string variable_to_check = variable;
125 variable_ends.push_back(cur_variable_end);
133 std::string::size_type shift = 0;
135 for(
unsigned int i=0; i<variable_ends.size(); i++)
199 std::string expr = expr_mod;
200 std::string::size_type start_index = 0;
201 std::string::size_type end_index = 0;
204 start_index = expr.find(
'[', start_index);
205 if(start_index == std::string::npos)
break;
206 std::string::size_type boundary_index = expr.find(
']', start_index);
207 expr.replace(start_index,1,1,
'_');
208 end_index = expr.find(
',', start_index);
209 if(end_index != std::string::npos && end_index < boundary_index)
212 std::string var1 = expr.substr(start_index, end_index-start_index);
214 std::stringstream ss1;
218 expr.replace(start_index, end_index-start_index, str1, 0, str1.size());
222 end_index = boundary_index;
223 if(end_index != std::string::npos)
226 std::string var1 = expr.substr(start_index, end_index-start_index);
228 std::stringstream ss1;
232 expr.replace(start_index, end_index-start_index, str1, 0, str1.size());
240 start_index = expr.find(
',', start_index);
241 if(start_index == std::string::npos)
break;
242 expr.replace(start_index,1,1,
'_');
243 end_index = expr.find(
']', start_index);
245 std::string var2 = expr.substr(start_index, end_index-start_index);
247 std::stringstream ss2;
251 expr.replace(start_index, end_index-start_index, str2, 0, str2.size());
257 start_index = expr.find(
']', start_index);
258 if(start_index == std::string::npos)
break;
259 expr.replace(start_index,1,1,
'_');
262 if(
m_calc.status() != HepTool::Evaluator::OK )
264 std::cerr << expr << std::endl;
265 for (
int i=0; i<
m_calc.error_position(); i++)
269 std::cerr <<
"^\a" << std::endl;
271 std::cerr << std::endl;