11 #include "TObjArray.h"
12 #include "TObjString.h"
41 , m_expr(
other.m_expr)
54 TFormula::operator=(
other) ;
55 m_expr =
other.m_expr;
68 TRegexp specialChars(
"[+-/*%&=!><()|]+");
72 lastIdx = parStr.Index(specialChars, lastIdx+1);
74 bool needsReplacement =
false;
77 char isEscape = parStr[lastIdx-1];
78 if (isEscape ==
'\\') {
81 parStr = parStr.Remove(lastIdx-1, 1);
82 expr = expr.Remove(lastIdx-1, 1);
83 needsReplacement =
false;
86 needsReplacement =
true;
90 needsReplacement =
true;
93 if (needsReplacement) {
95 parStr = parStr.Replace(lastIdx, 1,
" ");
98 }
while (lastIdx >= 0);
102 mylogger <<
kINFO <<
"Please be aware that Cling errors are expected and aren't inherently a problem" <<
GEndl;
104 TFormula analyzer(
"analyzer",
"1");
105 TObjArray* parArr = parStr.Tokenize(
" ");
106 for (
int count(0),
i(0);
i<parArr->GetEntries(); ++
i) {
107 TString myPar = ((TObjString*)parArr->At(
i))->GetString();
108 if ( 0==analyzer.Compile(myPar.Data()) ||
109 0==analyzer.Compile(Form(
"%s(1)",myPar.Data())) ) {
113 if (itrF==m_par.end()) {
114 expr = expr.ReplaceAll(myPar,Form(
"[%d]",
count));
115 m_par.push_back(myPar);
122 mylogger <<
kINFO <<
"Number of interpreted input parameters : " << m_par.size() <<
GEndl;
123 mylogger <<
kINFO <<
"Parsed regular expression : " << expr <<
GEndl;
132 return this->Compile(m_expr.Data());