This file is indexed.

/usr/include/root/TPRegexp.h is in libroot-core-dev 5.34.00-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// @(#)root/base:$Id: TPRegexp.h 26600 2008-12-02 18:56:10Z brun $
// Author: Eddy Offermann   24/06/05

/*************************************************************************
 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TPRegexp
#define ROOT_TPRegexp

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TPRegexp                                                             //
//                                                                      //
// C++ Wrapper for the "Perl Compatible Regular Expressions" library    //
//  The PCRE lib can be found at:                                       //
//              http://www.pcre.org/                                    //
//                                                                      //
// Extensive documentation about Regular expressions in Perl can be     //
// found at :                                                           //
//              http://perldoc.perl.org/perlre.html                     //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TArrayI
#include "TArrayI.h"
#endif

struct PCREPriv_t;


class TPRegexp {

protected:
   enum {
      kPCRE_GLOBAL     = 0x80000000,
      kPCRE_OPTIMIZE   = 0x40000000,
      kPCRE_DEBUG_MSGS = 0x20000000,
      kPCRE_INTMASK    = 0x0FFF
   };

   TString     fPattern;
   PCREPriv_t *fPriv;
   UInt_t      fPCREOpts;

   void     Compile();
   void     Optimize();
   UInt_t   ParseMods(const TString &mods) const;
   Int_t    ReplaceSubs(const TString &s, TString &final,
                        const TString &replacePattern,
                        Int_t *ovec, Int_t nmatch) const;

   Int_t    MatchInternal(const TString& s, Int_t start,
                          Int_t nMaxMatch, TArrayI *pos=0);

   Int_t    SubstituteInternal(TString &s, const TString &replace,
                               Int_t start, Int_t nMaxMatch0,
                               Bool_t doDollarSubst);

public:
   TPRegexp();
   TPRegexp(const TString &pat);
   TPRegexp(const TPRegexp &p);
   virtual ~TPRegexp();

   Int_t      Match(const TString &s, const TString &mods="",
                    Int_t start=0, Int_t nMaxMatch=10, TArrayI *pos=0);
   TObjArray *MatchS(const TString &s, const TString &mods="",
                     Int_t start=0, Int_t nMaxMatch=10);
   Bool_t     MatchB(const TString &s, const TString &mods="",
                     Int_t start=0, Int_t nMaxMatch=10) {
                           return (Match(s,mods,start,nMaxMatch) > 0); }
   Int_t      Substitute(TString &s, const TString &replace,
                         const TString &mods="", Int_t start=0,
                         Int_t nMatchMax=10);

   TString GetPattern()   const { return fPattern; }
   TString GetModifiers() const;

   TPRegexp &operator=(const TPRegexp &p);

   ClassDef(TPRegexp,0)  // Perl Compatible Regular Expression Class
};


class TPMERegexp : protected TPRegexp {

private:
   TPMERegexp& operator=(const TPMERegexp&);  // Not implemented

protected:
   Int_t    fNMaxMatches;         // maximum number of matches
   Int_t    fNMatches;            // number of matches returned from last pcre_exec call
   TArrayI  fMarkers;             // last set of indexes of matches

   TString  fLastStringMatched;   // copy of the last TString matched
   void    *fAddressOfLastString; // used for checking for change of TString in global match

   Int_t    fLastGlobalPosition;  // end of last match when kPCRE_GLOBAL is set

public:
   TPMERegexp();
   TPMERegexp(const TString& s, const TString& opts = "", Int_t nMatchMax = 10);
   TPMERegexp(const TString& s, UInt_t opts, Int_t nMatchMax = 10);
   TPMERegexp(const TPMERegexp& r);

   virtual ~TPMERegexp() {}

   void    Reset(const TString& s, const TString& opts = "", Int_t nMatchMax = -1);
   void    Reset(const TString& s, UInt_t opts, Int_t nMatchMax = -1);

   Int_t   GetNMaxMatches()   const { return fNMaxMatches; }
   void    SetNMaxMatches(Int_t nm) { fNMaxMatches = nm; }

   Int_t   GetGlobalPosition() const { return fLastGlobalPosition; }
   void    AssignGlobalState(const TPMERegexp& re);
   void    ResetGlobalState();

   Int_t   Match(const TString& s, UInt_t start = 0);
   Int_t   Split(const TString& s, Int_t maxfields = 0);
   Int_t   Substitute(TString& s, const TString& r, Bool_t doDollarSubst=kTRUE);

   Int_t   NMatches() const { return fNMatches; }
   TString operator[](Int_t);

   virtual void Print(Option_t* option="");

   ClassDef(TPMERegexp, 0); // Wrapper for Perl-like regular expression matching.
};


class TStringToken : public TString {

protected:
   const TString fFullStr;
   TPRegexp      fSplitRe;
   Bool_t        fReturnVoid;
   Int_t         fPos;

public:
   TStringToken(const TString& fullStr, const TString& splitRe, Bool_t retVoid=kFALSE);
   virtual ~TStringToken() {}

   Bool_t NextToken();
   Bool_t AtEnd() const { return fPos >= fFullStr.Length(); }

   ClassDef(TStringToken,0) // String tokenizer using PCRE for finding next tokens.
};

#endif