1 // This may look like C code, but it is really -*- C++ -*-
2 /*
3 Copyright (C) 1988 Free Software Foundation
4     written by Doug Lea (dl@rocky.oswego.edu)
5 
6 This file is part of the GNU C++ Library.  This library is free
7 software; you can redistribute it and/or modify it under the terms of
8 the GNU Library General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version.  This library is distributed in the hope
11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE.  See the GNU Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 
19 
20 #ifndef _Regex_h
21 #ifdef __GNUG__
22 #pragma interface
23 #endif
24 #define _Regex_h 1
25 
26 #if defined(SHORT_NAMES) || defined(VMS)
27 #define re_compile_pattern	recmppat
28 #define re_pattern_buffer	repatbuf
29 #define re_registers		reregs
30 #endif
31 
32 struct re_pattern_buffer;       // defined elsewhere
33 struct re_registers;
34 
35 class Regex
36 {
37 private:
38 
39                      Regex(const Regex&) {}  // no X(X&)
40   void               operator = (const Regex&) {} // no assignment
41 
42 protected:
43   re_pattern_buffer* buf;
44   re_registers*      reg;
45 
46 public:
47                      Regex(const char* t,
48                            int fast = 0,
49                            int bufsize = 40,
50                            const char* transtable = 0);
51 
52                     ~Regex();
53 
54   int                match(const char* s, int len, int pos = 0) const;
55   int                search(const char* s, int len,
56                             int& matchlen, int startpos = 0) const;
57   int                match_info(int& start, int& length, int nth = 0) const;
58 
59   int                OK() const;  // representation invariant
60 };
61 
62 // some built in regular expressions
63 
64 extern const Regex RXwhite;          // = "[ \n\t\r\v\f]+"
65 extern const Regex RXint;            // = "-?[0-9]+"
66 extern const Regex RXdouble;         // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
67                                      //    \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
68                                      //    \\([eE][---+]?[0-9]+\\)?"
69 extern const Regex RXalpha;          // = "[A-Za-z]+"
70 extern const Regex RXlowercase;      // = "[a-z]+"
71 extern const Regex RXuppercase;      // = "[A-Z]+"
72 extern const Regex RXalphanum;       // = "[0-9A-Za-z]+"
73 extern const Regex RXidentifier;     // = "[A-Za-z_][A-Za-z0-9_]*"
74 
75 
76 #endif
77