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         match_flags.hpp
15   *   VERSION      see <boost/version.hpp>
16   *   DESCRIPTION: Declares match_flags type.
17   */
18 
19 #ifndef BOOST_REGEX_V5_MATCH_FLAGS
20 #define BOOST_REGEX_V5_MATCH_FLAGS
21 
22 #ifdef __cplusplus
23 #  include <cstdint>
24 #endif
25 
26 #ifdef __cplusplus
27 namespace boost{
28    namespace regex_constants{
29 #endif
30 
31 #ifdef BOOST_REGEX_MSVC
32 #pragma warning(push)
33 #if BOOST_REGEX_MSVC >= 1800
34 #pragma warning(disable : 26812)
35 #endif
36 #endif
37 
38 typedef enum _match_flags
39 {
40    match_default = 0,
41    match_not_bol = 1,                                /* first is not start of line */
42    match_not_eol = match_not_bol << 1,               /* last is not end of line */
43    match_not_bob = match_not_eol << 1,               /* first is not start of buffer */
44    match_not_eob = match_not_bob << 1,               /* last is not end of buffer */
45    match_not_bow = match_not_eob << 1,               /* first is not start of word */
46    match_not_eow = match_not_bow << 1,               /* last is not end of word */
47    match_not_dot_newline = match_not_eow << 1,       /* \n is not matched by '.' */
48    match_not_dot_null = match_not_dot_newline << 1,  /* '\0' is not matched by '.' */
49    match_prev_avail = match_not_dot_null << 1,       /* *--first is a valid expression */
50    match_init = match_prev_avail << 1,               /* internal use */
51    match_any = match_init << 1,                      /* don't care what we match */
52    match_not_null = match_any << 1,                  /* string can't be null */
53    match_continuous = match_not_null << 1,           /* each grep match must continue from */
54                                                      /* uninterrupted from the previous one */
55    match_partial = match_continuous << 1,            /* find partial matches */
56 
57    match_stop = match_partial << 1,                  /* stop after first match (grep) V3 only */
58    match_not_initial_null = match_stop,              /* don't match initial null, V4 only */
59    match_all = match_stop << 1,                      /* must find the whole of input even if match_any is set */
60    match_perl = match_all << 1,                      /* Use perl matching rules */
61    match_posix = match_perl << 1,                    /* Use POSIX matching rules */
62    match_nosubs = match_posix << 1,                  /* don't trap marked subs */
63    match_extra = match_nosubs << 1,                  /* include full capture information for repeated captures */
64    match_single_line = match_extra << 1,             /* treat text as single line and ignore any \n's when matching ^ and $. */
65    match_unused1 = match_single_line << 1,           /* unused */
66    match_unused2 = match_unused1 << 1,               /* unused */
67    match_unused3 = match_unused2 << 1,               /* unused */
68    match_max = match_unused3,
69 
70    format_perl = 0,                                  /* perl style replacement */
71    format_default = 0,                               /* ditto. */
72    format_sed = match_max << 1,                      /* sed style replacement. */
73    format_all = format_sed << 1,                     /* enable all extensions to syntax. */
74    format_no_copy = format_all << 1,                 /* don't copy non-matching segments. */
75    format_first_only = format_no_copy << 1,          /* Only replace first occurrence. */
76    format_is_if = format_first_only << 1,            /* internal use only. */
77    format_literal = format_is_if << 1,               /* treat string as a literal */
78 
79    match_not_any = match_not_bol | match_not_eol | match_not_bob
80       | match_not_eob | match_not_bow | match_not_eow | match_not_dot_newline
81       | match_not_dot_null | match_prev_avail | match_init | match_not_null
82       | match_continuous | match_partial | match_stop | match_not_initial_null
83       | match_stop | match_all | match_perl | match_posix | match_nosubs
84       | match_extra | match_single_line | match_unused1 | match_unused2
85       | match_unused3 | match_max | format_perl | format_default | format_sed
86       | format_all | format_no_copy | format_first_only | format_is_if
87       | format_literal
88 
89 
90 } match_flags;
91 
92 typedef match_flags match_flag_type;
93 
94 #ifdef __cplusplus
operator &(match_flags m1,match_flags m2)95 inline match_flags operator&(match_flags m1, match_flags m2)
96 { return static_cast<match_flags>(static_cast<std::int32_t>(m1) & static_cast<std::int32_t>(m2)); }
operator |(match_flags m1,match_flags m2)97 inline match_flags operator|(match_flags m1, match_flags m2)
98 { return static_cast<match_flags>(static_cast<std::int32_t>(m1) | static_cast<std::int32_t>(m2)); }
operator ^(match_flags m1,match_flags m2)99 inline match_flags operator^(match_flags m1, match_flags m2)
100 { return static_cast<match_flags>(static_cast<std::int32_t>(m1) ^ static_cast<std::int32_t>(m2)); }
operator ~(match_flags m1)101 inline match_flags operator~(match_flags m1)
102 { return static_cast<match_flags>(~static_cast<std::int32_t>(m1)); }
operator &=(match_flags & m1,match_flags m2)103 inline match_flags& operator&=(match_flags& m1, match_flags m2)
104 { m1 = m1&m2; return m1; }
operator |=(match_flags & m1,match_flags m2)105 inline match_flags& operator|=(match_flags& m1, match_flags m2)
106 { m1 = m1|m2; return m1; }
operator ^=(match_flags & m1,match_flags m2)107 inline match_flags& operator^=(match_flags& m1, match_flags m2)
108 { m1 = m1^m2; return m1; }
109 #endif
110 
111 #ifdef __cplusplus
112 } /* namespace regex_constants */
113 /*
114  * import names into boost for backwards compatibility:
115  */
116 using regex_constants::match_flag_type;
117 using regex_constants::match_default;
118 using regex_constants::match_not_bol;
119 using regex_constants::match_not_eol;
120 using regex_constants::match_not_bob;
121 using regex_constants::match_not_eob;
122 using regex_constants::match_not_bow;
123 using regex_constants::match_not_eow;
124 using regex_constants::match_not_dot_newline;
125 using regex_constants::match_not_dot_null;
126 using regex_constants::match_prev_avail;
127 /* using regex_constants::match_init; */
128 using regex_constants::match_any;
129 using regex_constants::match_not_null;
130 using regex_constants::match_continuous;
131 using regex_constants::match_partial;
132 /*using regex_constants::match_stop; */
133 using regex_constants::match_all;
134 using regex_constants::match_perl;
135 using regex_constants::match_posix;
136 using regex_constants::match_nosubs;
137 using regex_constants::match_extra;
138 using regex_constants::match_single_line;
139 /*using regex_constants::match_max; */
140 using regex_constants::format_all;
141 using regex_constants::format_sed;
142 using regex_constants::format_perl;
143 using regex_constants::format_default;
144 using regex_constants::format_no_copy;
145 using regex_constants::format_first_only;
146 /*using regex_constants::format_is_if;*/
147 
148 #ifdef BOOST_REGEX_MSVC
149 #pragma warning(pop)
150 #endif
151 
152 
153 } /* namespace boost */
154 #endif /* __cplusplus */
155 #endif /* include guard */
156 
157