- Timestamp:
- 07/15/07 17:01:19 (17 years ago)
- Location:
- trunk/MagicSoft/Mars/mdata
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mdata/MDataPhrase.cc
r8274 r8635 138 138 Int_t MDataPhrase::CheckForVariable(const TString &phrase, Int_t idx) 139 139 { 140 TPRegexp reg(Form("\\w\\[%d\\]\\w", idx));141 142 140 TString mods; 143 141 TArrayI pos; 144 142 145 while (reg.Match(phrase, mods, 0, 130, &pos)) 146 { 143 while (1) 144 { 145 // \\W: matches any non-word character [^a-zA-Z_0-9] 146 TPRegexp reg(Form("\\W\\[0*%d\\]\\W", idx)); 147 if (reg.Match(phrase, mods, 0, 130, &pos)==0) 148 break; 149 147 150 // [idx] already existing. Add a corresponding MDataValue 148 151 fMembers.AddLast(new MDataValue(0, idx)); … … 158 161 // with %s being the expression) in the string phrase by [idx]. 159 162 // 160 // The length of [idx] 9is returned.163 // The length of [idx] is returned. 161 164 // 162 165 Int_t MDataPhrase::Substitute(TString &phrase, const TString &expr, Int_t idx) const … … 247 250 // numbers can contain a dot the result has to 248 251 // be checked carefully 252 // \\w: matches any word character [a-zA-Z_0-9] 249 253 TPRegexp reg = TPRegexp("\\w+[.]\\w+"); 250 254 TPRegexp ishex("^0x[[:xdigit:]]+$"); … … 313 317 // Step forward to the next argument 314 318 idx++; 319 } 320 321 // Now we have to check if there are additional indices [idx] 322 // This is mainly important if the rule has indices only! 323 while (1) 324 { 325 const Int_t newidx = CheckForVariable(phrase, idx); 326 if (newidx == idx) 327 break; 315 328 } 316 329 … … 578 591 return rule; 579 592 } 593 594 // -------------------------------------------------------------------------- 595 // 596 // This returns the rule as seen/interpreted by the TFormula. Mainly 597 // for debugging purposes 598 // 599 TString MDataPhrase::GetRuleRaw() const 600 { 601 if (!fFormula) 602 return "<empty>"; 603 604 return fFormula->GetExpFormula(); 605 } 606 580 607 /* 581 608 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mdata/MDataPhrase.h
r8315 r8635 48 48 Double_t GetValue() const; 49 49 TString GetRule() const; 50 TString GetRuleRaw() const; 50 51 Bool_t PreProcess(const MParList *plist); 51 52 // void Print(Option_t *opt = "") const;
Note:
See TracChangeset
for help on using the changeset viewer.