aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2013-08-09 07:53:28 +0000
committerTim Shen <timshen@gcc.gnu.org>2013-08-09 07:53:28 +0000
commit6646d624d0901f1bd5a494b67205d00b63ff554b (patch)
treef06f5fad3bdf3e5b9f6f01db07dc41f6e2102705
parent03b0ee0aba82efa8e6cfc873286abef4b5ef92d8 (diff)
downloadgcc-6646d624d0901f1bd5a494b67205d00b63ff554b.zip
gcc-6646d624d0901f1bd5a494b67205d00b63ff554b.tar.gz
gcc-6646d624d0901f1bd5a494b67205d00b63ff554b.tar.bz2
regex_constants.h: Change syntax_option_type to enum type.
2013-08-09 Tim Shen <timshen91@gmail.com> * include/bits/regex_constants.h: Change syntax_option_type to enum type. From-SVN: r201621
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/bits/regex_constants.h198
2 files changed, 123 insertions, 80 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7a14117..17267c8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-09 Tim Shen <timshen91@gmail.com>
+
+ * include/bits/regex_constants.h: Change syntax_option_type to enum
+ type.
+
2013-08-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* include/bits/regex.h: Replace _A, _B, _C, _R by _Ap, _Bp,
diff --git a/libstdc++-v3/include/bits/regex_constants.h b/libstdc++-v3/include/bits/regex_constants.h
index 8c163cc0..6ac65d7 100644
--- a/libstdc++-v3/include/bits/regex_constants.h
+++ b/libstdc++-v3/include/bits/regex_constants.h
@@ -77,87 +77,125 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
* %set.
*/
- typedef unsigned int syntax_option_type;
-
- /**
- * Specifies that the matching of regular expressions against a character
- * sequence shall be performed without regard to case.
- */
- constexpr syntax_option_type icase = 1 << _S_icase;
-
- /**
- * Specifies that when a regular expression is matched against a character
- * container sequence, no sub-expression matches are to be stored in the
- * supplied match_results structure.
- */
- constexpr syntax_option_type nosubs = 1 << _S_nosubs;
-
- /**
- * Specifies that the regular expression engine should pay more attention to
- * the speed with which regular expressions are matched, and less to the
- * speed with which regular expression objects are constructed. Otherwise
- * it has no detectable effect on the program output.
- */
- constexpr syntax_option_type optimize = 1 << _S_optimize;
-
- /**
- * Specifies that character ranges of the form [a-b] should be locale
- * sensitive.
- */
- constexpr syntax_option_type collate = 1 << _S_collate;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
- * Language Specification, Standard Ecma-262, third edition, 1999], as
- * modified in section [28.13]. This grammar is similar to that defined
- * in the PERL scripting language but extended with elements found in the
- * POSIX regular expression grammar.
- */
- constexpr syntax_option_type ECMAScript = 1 << _S_ECMAScript;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
- * Portable Operating System Interface (POSIX), Base Definitions and
- * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
- * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
- */
- constexpr syntax_option_type basic = 1 << _S_basic;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
- * Portable Operating System Interface (POSIX), Base Definitions and Headers,
- * Section 9, Regular Expressions.
- */
- constexpr syntax_option_type extended = 1 << _S_extended;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
- * identical to syntax_option_type extended, except that C-style escape
- * sequences are supported. These sequences are:
- * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos;, &apos;,
- * and \\ddd (where ddd is one, two, or three octal digits).
- */
- constexpr syntax_option_type awk = 1 << _S_awk;
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
- * identical to syntax_option_type basic, except that newlines are treated
- * as whitespace.
- */
- constexpr syntax_option_type grep = 1 << _S_grep;
+ enum syntax_option_type
+ {
+ /**
+ * Specifies that the matching of regular expressions against a character
+ * sequence shall be performed without regard to case.
+ */
+ icase = 1 << _S_icase,
+
+ /**
+ * Specifies that when a regular expression is matched against a character
+ * container sequence, no sub-expression matches are to be stored in the
+ * supplied match_results structure.
+ */
+ nosubs = 1 << _S_nosubs,
+
+ /**
+ * Specifies that the regular expression engine should pay more attention to
+ * the speed with which regular expressions are matched, and less to the
+ * speed with which regular expression objects are constructed. Otherwise
+ * it has no detectable effect on the program output.
+ */
+ optimize = 1 << _S_optimize,
+
+ /**
+ * Specifies that character ranges of the form [a-b] should be locale
+ * sensitive.
+ */
+ collate = 1 << _S_collate,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
+ * Language Specification, Standard Ecma-262, third edition, 1999], as
+ * modified in section [28.13]. This grammar is similar to that defined
+ * in the PERL scripting language but extended with elements found in the
+ * POSIX regular expression grammar.
+ */
+ ECMAScript = 1 << _S_ECMAScript,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and
+ * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
+ * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ basic = 1 << _S_basic,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and Headers,
+ * Section 9, Regular Expressions.
+ */
+ extended = 1 << _S_extended,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type extended, except that C-style escape
+ * sequences are supported. These sequences are:
+ * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos,, &apos,,
+ * and \\ddd (where ddd is one, two, or three octal digits).
+ */
+ awk = 1 << _S_awk,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type basic, except that newlines are treated
+ * as whitespace.
+ */
+ grep = 1 << _S_grep,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep when given the -E option in
+ * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
+ * extended, except that newlines are treated as whitespace.
+ */
+ egrep = 1 << _S_egrep,
+ };
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility grep when given the -E option in
- * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
- * extended, except that newlines are treated as whitespace.
- */
- constexpr syntax_option_type egrep = 1 << _S_egrep;
+ constexpr inline syntax_option_type
+ operator&(syntax_option_type __a, syntax_option_type __b)
+ {
+ return (syntax_option_type)(static_cast<unsigned int>(__a)
+ & static_cast<unsigned int>(__b));
+ }
+
+ constexpr inline syntax_option_type
+ operator|(syntax_option_type __a, syntax_option_type __b)
+ {
+ return (syntax_option_type)(static_cast<unsigned int>(__a)
+ | static_cast<unsigned int>(__b));
+ }
+
+ constexpr inline syntax_option_type
+ operator^(syntax_option_type __a, syntax_option_type __b)
+ {
+ return (syntax_option_type)(static_cast<unsigned int>(__a)
+ ^ static_cast<unsigned int>(__b));
+ }
+
+ constexpr inline syntax_option_type
+ operator~(syntax_option_type __a)
+ { return (syntax_option_type)(~static_cast<unsigned int>(__a)); }
+
+ inline syntax_option_type&
+ operator&=(syntax_option_type& __a, syntax_option_type __b)
+ { return __a = __a & __b; }
+
+ inline syntax_option_type&
+ operator|=(syntax_option_type& __a, syntax_option_type __b)
+ { return __a = __a | __b; }
+
+ inline syntax_option_type&
+ operator^=(syntax_option_type& __a, syntax_option_type __b)
+ { return __a = __a ^ __b; }
//@}