source: trunk/src/emx/include/Attic/cpp/Regx.h@ 18

Last change on this file since 18 was 18, checked in by bird, 23 years ago

Initial revision

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