Ignore:
Timestamp:
07/15/07 17:01:19 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mdata/MDataPhrase.cc

    r8274 r8635  
    138138Int_t MDataPhrase::CheckForVariable(const TString &phrase, Int_t idx)
    139139{
    140     TPRegexp reg(Form("\\w\\[%d\\]\\w", idx));
    141 
    142140    TString mods;
    143141    TArrayI pos;
    144142
    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
    147150        // [idx] already existing. Add a corresponding MDataValue
    148151        fMembers.AddLast(new MDataValue(0, idx));
     
    158161// with %s being the expression) in the string phrase by [idx].
    159162//
    160 // The length of [idx]9 is returned.
     163// The length of [idx] is returned.
    161164//
    162165Int_t MDataPhrase::Substitute(TString &phrase, const TString &expr, Int_t idx) const
     
    247250    // numbers can contain a dot the result has to
    248251    // be checked carefully
     252    // \\w: matches any word character [a-zA-Z_0-9]
    249253    TPRegexp reg = TPRegexp("\\w+[.]\\w+");
    250254    TPRegexp ishex("^0x[[:xdigit:]]+$");
     
    313317        // Step forward to the next argument
    314318        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;
    315328    }
    316329
     
    578591    return rule;
    579592}
     593
     594// --------------------------------------------------------------------------
     595//
     596// This returns the rule as seen/interpreted by the TFormula. Mainly
     597// for debugging purposes
     598//
     599TString MDataPhrase::GetRuleRaw() const
     600{
     601    if (!fFormula)
     602        return "<empty>";
     603
     604    return fFormula->GetExpFormula();
     605}
     606
    580607/*
    581608// --------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.