1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/xpressive/regex_constants.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,282 @@
1.4 +///////////////////////////////////////////////////////////////////////////////
1.5 +/// \file regex_constants.hpp
1.6 +/// Contains definitions for the syntax_option_type, match_flag_type and
1.7 +/// error_type enumerations.
1.8 +//
1.9 +// Copyright 2004 Eric Niebler. Distributed under the Boost
1.10 +// Software License, Version 1.0. (See accompanying file
1.11 +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1.12 +
1.13 +#ifndef BOOST_XPRESSIVE_REGEX_CONSTANTS_HPP_EAN_10_04_2005
1.14 +#define BOOST_XPRESSIVE_REGEX_CONSTANTS_HPP_EAN_10_04_2005
1.15 +
1.16 +// MS compatible compilers support #pragma once
1.17 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
1.18 +# pragma once
1.19 +#endif
1.20 +
1.21 +#include <boost/mpl/identity.hpp>
1.22 +
1.23 +#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
1.24 +# define icase icase_
1.25 +#endif
1.26 +
1.27 +namespace boost { namespace xpressive { namespace regex_constants
1.28 +{
1.29 +
1.30 +/// Flags used to customize the regex syntax
1.31 +///
1.32 +enum syntax_option_type
1.33 +{
1.34 + // these flags are required:
1.35 +
1.36 + ECMAScript = 0, ///< Specifies that the grammar recognized by the regular expression
1.37 + ///< engine uses its normal semantics: that is the same as that given
1.38 + ///< in the ECMA-262, ECMAScript Language Specification, Chapter 15
1.39 + ///< part 10, RegExp (Regular Expression) Objects (FWD.1).
1.40 + ///<
1.41 + icase = 1 << 1, ///< Specifies that matching of regular expressions against a character
1.42 + ///< container sequence shall be performed without regard to case.
1.43 + ///<
1.44 + nosubs = 1 << 2, ///< Specifies that when a regular expression is matched against a
1.45 + ///< character container sequence, then no sub-expression matches are to
1.46 + ///< be stored in the supplied match_results structure.
1.47 + ///<
1.48 + optimize = 1 << 3, ///< Specifies that the regular expression engine should pay more
1.49 + ///< attention to the speed with which regular expressions are matched,
1.50 + ///< and less to the speed with which regular expression objects are
1.51 + ///< constructed. Otherwise it has no detectable effect on the program
1.52 + ///< output.
1.53 + ///<
1.54 + collate = 1 << 4, ///< Specifies that character ranges of the form "[a-b]" should be
1.55 + ///< locale sensitive.
1.56 + ///<
1.57 +
1.58 + // These flags are optional. If the functionality is supported
1.59 + // then the flags shall take these names.
1.60 +
1.61 + //basic = 1 << 5, ///< Specifies that the grammar recognized by the regular expression
1.62 + // ///< engine is the same as that used by POSIX basic regular expressions
1.63 + // ///< in IEEE Std 1003.1-2001, Portable Operating System Interface
1.64 + // ///< (POSIX), Base Definitions and Headers, Section 9, Regular
1.65 + // ///< Expressions (FWD.1).
1.66 + // ///<
1.67 + //extended = 1 << 6, ///< Specifies that the grammar recognized by the regular expression
1.68 + // ///< engine is the same as that used by POSIX extended regular
1.69 + // ///< expressions in IEEE Std 1003.1-2001, Portable Operating System
1.70 + // ///< Interface (POSIX), Base Definitions and Headers, Section 9,
1.71 + // ///< Regular Expressions (FWD.1).
1.72 + // ///<
1.73 + //awk = 1 << 7, ///< Specifies that the grammar recognized by the regular expression
1.74 + // ///< engine is the same as that used by POSIX utility awk in IEEE Std
1.75 + // ///< 1003.1-2001, Portable Operating System Interface (POSIX), Shells
1.76 + // ///< and Utilities, Section 4, awk (FWD.1).
1.77 + // ///<
1.78 + //grep = 1 << 8, ///< Specifies that the grammar recognized by the regular expression
1.79 + // ///< engine is the same as that used by POSIX utility grep in IEEE Std
1.80 + // ///< 1003.1-2001, Portable Operating System Interface (POSIX),
1.81 + // ///< Shells and Utilities, Section 4, Utilities, grep (FWD.1).
1.82 + // ///<
1.83 + //egrep = 1 << 9, ///< Specifies that the grammar recognized by the regular expression
1.84 + // ///< engine is the same as that used by POSIX utility grep when given
1.85 + // ///< the -E option in IEEE Std 1003.1-2001, Portable Operating System
1.86 + // ///< Interface (POSIX), Shells and Utilities, Section 4, Utilities,
1.87 + // ///< grep (FWD.1).
1.88 + // ///<
1.89 +
1.90 + // these flags are specific to xpressive, and they help with perl compliance.
1.91 +
1.92 + single_line = 1 << 10, ///< Specifies that the ^ and \$ metacharacters DO NOT match at
1.93 + ///< internal line breaks. Note that this is the opposite of the
1.94 + ///< perl default. It is the inverse of perl's /m (multi-line)
1.95 + ///< modifier.
1.96 + ///<
1.97 + not_dot_null = 1 << 11, ///< Specifies that the . metacharacter does not match the null
1.98 + ///< character \\0.
1.99 + ///<
1.100 + not_dot_newline = 1 << 12, ///< Specifies that the . metacharacter does not match the
1.101 + ///< newline character \\n.
1.102 + ///<
1.103 + ignore_white_space = 1 << 13 ///< Specifies that non-escaped white-space is not significant.
1.104 + ///<
1.105 +};
1.106 +
1.107 +/// Flags used to customize the behavior of the regex algorithms
1.108 +///
1.109 +enum match_flag_type
1.110 +{
1.111 + match_default = 0, ///< Specifies that matching of regular expressions proceeds
1.112 + ///< without any modification of the normal rules used in
1.113 + ///< ECMA-262, ECMAScript Language Specification, Chapter 15
1.114 + ///< part 10, RegExp (Regular Expression) Objects (FWD.1)
1.115 + ///<
1.116 + match_not_bol = 1 << 1, ///< Specifies that the expression "^" should not be matched
1.117 + ///< against the sub-sequence [first,first).
1.118 + ///<
1.119 + match_not_eol = 1 << 2, ///< Specifies that the expression "\$" should not be
1.120 + ///< matched against the sub-sequence [last,last).
1.121 + ///<
1.122 + match_not_bow = 1 << 3, ///< Specifies that the expression "\\b" should not be
1.123 + ///< matched against the sub-sequence [first,first).
1.124 + ///<
1.125 + match_not_eow = 1 << 4, ///< Specifies that the expression "\\b" should not be
1.126 + ///< matched against the sub-sequence [last,last).
1.127 + ///<
1.128 + match_any = 1 << 7, ///< Specifies that if more than one match is possible then
1.129 + ///< any match is an acceptable result.
1.130 + ///<
1.131 + match_not_null = 1 << 8, ///< Specifies that the expression can not be matched
1.132 + ///< against an empty sequence.
1.133 + ///<
1.134 + match_continuous = 1 << 10, ///< Specifies that the expression must match a sub-sequence
1.135 + ///< that begins at first.
1.136 + ///<
1.137 + match_partial = 1 << 11, ///< Specifies that if no match can be found, then it is
1.138 + ///< acceptable to return a match [from, last) where
1.139 + ///< from!=last, if there exists some sequence of characters
1.140 + ///< [from,to) of which [from,last) is a prefix, and which
1.141 + ///< would result in a full match.
1.142 + ///<
1.143 + match_prev_avail = 1 << 12, ///< Specifies that --first is a valid iterator position,
1.144 + ///< when this flag is set then the flags match_not_bol
1.145 + ///< and match_not_bow are ignored by the regular expression
1.146 + ///< algorithms (RE.7) and iterators (RE.8).
1.147 + ///<
1.148 + format_default = 0, ///< Specifies that when a regular expression match is to be
1.149 + ///< replaced by a new string, that the new string is
1.150 + ///< constructed using the rules used by the ECMAScript
1.151 + ///< replace function in ECMA-262, ECMAScript Language
1.152 + ///< Specification, Chapter 15 part 5.4.11
1.153 + ///< String.prototype.replace. (FWD.1). In addition during
1.154 + ///< search and replace operations then all non-overlapping
1.155 + ///< occurrences of the regular expression are located and
1.156 + ///< replaced, and sections of the input that did not match
1.157 + ///< the expression, are copied unchanged to the output
1.158 + ///< string.
1.159 + ///<
1.160 + //format_sed = 1 << 13, ///< Specifies that when a regular expression match is to be
1.161 + // ///< replaced by a new string, that the new string is
1.162 + // ///< constructed using the rules used by the Unix sed
1.163 + // ///< utility in IEEE Std 1003.1-2001, Portable Operating
1.164 + // ///< SystemInterface (POSIX), Shells and Utilities.
1.165 + // ///<
1.166 + //format_perl = 1 << 14, ///< Specifies that when a regular expression match is to be
1.167 + // ///< replaced by a new string, that the new string is
1.168 + // ///< constructed using an implementation defined superset
1.169 + // ///< of the rules used by the ECMAScript replace function in
1.170 + // ///< ECMA-262, ECMAScript Language Specification, Chapter 15
1.171 + // ///< part 5.4.11 String.prototype.replace (FWD.1).
1.172 + // ///<
1.173 + format_no_copy = 1 << 15, ///< When specified during a search and replace operation,
1.174 + ///< then sections of the character container sequence being
1.175 + ///< searched that do match the regular expression, are not
1.176 + ///< copied to the output string.
1.177 + ///<
1.178 + format_first_only = 1 << 16, ///< When specified during a search and replace operation,
1.179 + ///< then only the first occurrence of the regular
1.180 + ///< expression is replaced.
1.181 + ///<
1.182 + format_literal = 1 << 17 ///< Treat the format string as a literal.
1.183 + ///<
1.184 +};
1.185 +
1.186 +/// Error codes used by the regex_error type
1.187 +///
1.188 +enum error_type
1.189 +{
1.190 + error_collate, ///< The expression contained an invalid collating element name.
1.191 + ///<
1.192 + error_ctype, ///< The expression contained an invalid character class name.
1.193 + ///<
1.194 + error_escape, ///< The expression contained an invalid escaped character,
1.195 + ///< or a trailing escape.
1.196 + ///<
1.197 + error_subreg, ///< The expression contained an invalid back-reference.
1.198 + ///<
1.199 + error_brack, ///< The expression contained mismatched [ and ].
1.200 + ///<
1.201 + error_paren, ///< The expression contained mismatched (and).
1.202 + ///<
1.203 + error_brace, ///< The expression contained mismatched { and }
1.204 + ///<
1.205 + error_badbrace, ///< The expression contained an invalid range in a {} expression.
1.206 + ///<
1.207 + error_range, ///< The expression contained an invalid character range, for
1.208 + ///< example [b-a].
1.209 + ///<
1.210 + error_space, ///< There was insufficient memory to convert the expression into a
1.211 + ///< finite state machine.
1.212 + ///<
1.213 + error_badrepeat, ///< One of *?+{ was not preceded by a valid regular expression.
1.214 + ///<
1.215 + error_complexity, ///< The complexity of an attempted match against a regular
1.216 + ///< expression exceeded a pre-set level.
1.217 + ///<
1.218 + error_stack, ///< There was insufficient memory to determine whether the regular
1.219 + ///< expression could match the specified character sequence.
1.220 + ///<
1.221 + error_badref, ///< An nested regex is uninitialized.
1.222 + ///<
1.223 + error_badlookbehind, ///< An attempt to create a variable-width look-behind assertion
1.224 + ///< was detected.
1.225 + ///<
1.226 + error_internal ///< An internal error has occured.
1.227 + ///<
1.228 +};
1.229 +
1.230 +/// INTERNAL ONLY
1.231 +inline syntax_option_type operator &(syntax_option_type b1, syntax_option_type b2)
1.232 +{
1.233 + return static_cast<syntax_option_type>(
1.234 + static_cast<int>(b1) & static_cast<int>(b2));
1.235 +}
1.236 +
1.237 +/// INTERNAL ONLY
1.238 +inline syntax_option_type operator |(syntax_option_type b1, syntax_option_type b2)
1.239 +{
1.240 + return static_cast<syntax_option_type>(static_cast<int>(b1) | static_cast<int>(b2));
1.241 +}
1.242 +
1.243 +/// INTERNAL ONLY
1.244 +inline syntax_option_type operator ^(syntax_option_type b1, syntax_option_type b2)
1.245 +{
1.246 + return static_cast<syntax_option_type>(static_cast<int>(b1) ^ static_cast<int>(b2));
1.247 +}
1.248 +
1.249 +/// INTERNAL ONLY
1.250 +inline syntax_option_type operator ~(syntax_option_type b)
1.251 +{
1.252 + return static_cast<syntax_option_type>(~static_cast<int>(b));
1.253 +}
1.254 +
1.255 +/// INTERNAL ONLY
1.256 +inline match_flag_type operator &(match_flag_type b1, match_flag_type b2)
1.257 +{
1.258 + return static_cast<match_flag_type>(static_cast<int>(b1) & static_cast<int>(b2));
1.259 +}
1.260 +
1.261 +/// INTERNAL ONLY
1.262 +inline match_flag_type operator |(match_flag_type b1, match_flag_type b2)
1.263 +{
1.264 + return static_cast<match_flag_type>(static_cast<int>(b1) | static_cast<int>(b2));
1.265 +}
1.266 +
1.267 +/// INTERNAL ONLY
1.268 +inline match_flag_type operator ^(match_flag_type b1, match_flag_type b2)
1.269 +{
1.270 + return static_cast<match_flag_type>(static_cast<int>(b1) ^ static_cast<int>(b2));
1.271 +}
1.272 +
1.273 +/// INTERNAL ONLY
1.274 +inline match_flag_type operator ~(match_flag_type b)
1.275 +{
1.276 + return static_cast<match_flag_type>(~static_cast<int>(b));
1.277 +}
1.278 +
1.279 +}}} // namespace boost::xpressive::regex_constants
1.280 +
1.281 +#ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
1.282 +# undef icase
1.283 +#endif
1.284 +
1.285 +#endif