source: NonGTP/Boost/boost/regex/v4/regbase.hpp @ 857

Revision 857, 5.4 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*
2 *
3 * Copyright (c) 1998-2002
4 * John Maddock
5 *
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 *
10 */
11
12 /*
13  *   LOCATION:    see http://www.boost.org for most recent version.
14  *   FILE         regbase.cpp
15  *   VERSION      see <boost/version.hpp>
16  *   DESCRIPTION: Declares class regbase.
17  */
18
19#ifndef BOOST_REGEX_V4_REGBASE_HPP
20#define BOOST_REGEX_V4_REGBASE_HPP
21
22#ifdef BOOST_HAS_ABI_HEADERS
23#  include BOOST_ABI_PREFIX
24#endif
25
26namespace boost{
27//
28// class regbase
29// handles error codes and flags
30//
31class BOOST_REGEX_DECL regbase
32{
33public:
34   enum flag_type_
35   {
36      //
37      // Divide the flags up into logical groups:
38      // bits 0-7 indicate main synatx type.
39      // bits 8-15 indicate syntax subtype.
40      // bits 16-31 indicate options that are common to all
41      // regex syntaxes.
42      // In all cases the default is 0.
43      //
44      // Main synatx group:
45      //
46      perl_syntax_group = 0,                      // default
47      basic_syntax_group = 1,                     // POSIX basic
48      literal = 2,                                // all characters are literals
49      main_option_type = literal | basic_syntax_group | perl_syntax_group, // everything!
50      //
51      // options specific to perl group:
52      //
53      no_bk_refs = 1 << 8,                        // \d not allowed
54      no_perl_ex = 1 << 9,                        // disable perl extensions
55      no_mod_m = 1 << 10,                         // disable Perl m modifier
56      mod_x = 1 << 11,                            // Perl x modifier
57      mod_s = 1 << 12,                            // force s modifier on (overrides match_not_dot_newline)
58      no_mod_s = 1 << 13,                         // force s modifier off (overrides match_not_dot_newline)
59
60      //
61      // options specific to basic group:
62      //
63      no_char_classes = 1 << 8,                   // [[:CLASS:]] not allowed
64      no_intervals = 1 << 9,                      // {x,y} not allowed
65      bk_plus_qm = 1 << 10,                       // uses \+ and \?
66      bk_vbar = 1 << 11,                          // use \| for alternatives
67      emacs_ex = 1 << 12,                         // enables emacs extensions
68
69      //
70      // options common to all groups:
71      //
72      no_escape_in_lists = 1 << 16,                     // '\' not special inside [...]
73      newline_alt = 1 << 17,                            // \n is the same as |
74      no_except = 1 << 18,                              // no exception on error
75      failbit = 1 << 19,                                // error flag
76      icase = 1 << 20,                                  // characters are matched regardless of case
77      nocollate = 0,                                    // don't use locale specific collation (deprecated)
78      collate = 1 << 21,                                // use locale specific collation
79      nosubs = 1 << 22,                                 // don't mark sub-expressions
80      optimize = 0,                                     // not really supported
81     
82
83
84      basic = basic_syntax_group | collate | no_escape_in_lists,
85      extended = no_bk_refs | collate | no_perl_ex | no_escape_in_lists,
86      normal = 0,
87      emacs = basic_syntax_group | collate | emacs_ex | bk_vbar,
88      awk = no_bk_refs | collate | no_perl_ex,
89      grep = basic | newline_alt,
90      egrep = extended | newline_alt,
91      sed = basic,
92      perl = normal,
93      ECMAScript = normal,
94      JavaScript = normal,
95      JScript = normal
96   };
97   typedef unsigned int flag_type;
98
99   enum restart_info
100   {
101      restart_any = 0,
102      restart_word = 1,
103      restart_line = 2,
104      restart_buf = 3,
105      restart_continue = 4,
106      restart_lit = 5,
107      restart_fixed_lit = 6,
108      restart_count = 7
109   };
110};
111
112//
113// provide std lib proposal compatible constants:
114//
115namespace regex_constants{
116
117   enum flag_type_
118   {
119
120      no_except = ::boost::regbase::no_except,
121      failbit = ::boost::regbase::failbit,
122      literal = ::boost::regbase::literal,
123      icase = ::boost::regbase::icase,
124      nocollate = ::boost::regbase::nocollate,
125      collate = ::boost::regbase::collate,
126      nosubs = ::boost::regbase::nosubs,
127      optimize = ::boost::regbase::optimize,
128      bk_plus_qm = ::boost::regbase::bk_plus_qm,
129      bk_vbar = ::boost::regbase::bk_vbar,
130      no_intervals = ::boost::regbase::no_intervals,
131      no_char_classes = ::boost::regbase::no_char_classes,
132      no_escape_in_lists = ::boost::regbase::no_escape_in_lists,
133      no_mod_m = ::boost::regbase::no_mod_m,
134      mod_x = ::boost::regbase::mod_x,
135      mod_s = ::boost::regbase::mod_s,
136      no_mod_s = ::boost::regbase::no_mod_s,
137
138      basic = ::boost::regbase::basic,
139      extended = ::boost::regbase::extended,
140      normal = ::boost::regbase::normal,
141      emacs = ::boost::regbase::emacs,
142      awk = ::boost::regbase::awk,
143      grep = ::boost::regbase::grep,
144      egrep = ::boost::regbase::egrep,
145      sed = basic,
146      perl = normal,
147      ECMAScript = normal,
148      JavaScript = normal,
149      JScript = normal
150   };
151   typedef ::boost::regbase::flag_type syntax_option_type;
152
153} // namespace regex_constants
154
155} // namespace boost
156
157#ifdef BOOST_HAS_ABI_HEADERS
158#  include BOOST_ABI_SUFFIX
159#endif
160
161#endif
162
Note: See TracBrowser for help on using the repository browser.