]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/bits/regex_scanner.tcc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / include / bits / regex_scanner.tcc
index fc8273878ce5d4f01d06870e63fc4bbca4ce7e15..34d78ec76477ad8b029694879ef33707b15c1b49 100644 (file)
@@ -1,6 +1,6 @@
 // class template regex -*- C++ -*-
 
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -56,8 +56,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     _Scanner<_FwdIter>::
     _Scanner(_FwdIter __begin, _FwdIter __end,
             _FlagT __flags, std::locale __loc)
-    : _M_current(__begin) , _M_end(__end) , _M_flags(__flags),
-      _M_ctype(std::use_facet<_CtypeT>(__loc)), _M_state(_S_state_normal),
+    : _M_state(_S_state_normal), _M_current(__begin), _M_end(__end),
+      _M_flags(__flags),
+      _M_ctype(std::use_facet<_CtypeT>(__loc)),
       _M_at_bracket_start(false),
       _M_token_map
        {
@@ -94,9 +95,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          {'t', '\t'},
          {'v', '\v'},
        },
-      _M_escape_map(_M_is_ecma()
-                   ? _M_ecma_escape_map
-                   : _M_awk_escape_map),
       _M_ecma_spec_char
        {
          '^',
@@ -138,14 +136,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          '^',
          '$',
        },
-      _M_eat_escape(_M_is_ecma()
-                   ? &_Scanner::_M_eat_escape_ecma
-                   : &_Scanner::_M_eat_escape_posix),
+      _M_escape_map(_M_is_ecma()
+                   ? _M_ecma_escape_map
+                   : _M_awk_escape_map),
       _M_spec_char(_M_is_ecma()
                   ? _M_ecma_spec_char
                   : _M_is_basic()
                   ? _M_basic_spec_char
-                  : _M_extended_spec_char)
+                  : _M_extended_spec_char),
+      _M_eat_escape(_M_is_ecma()
+                   ? &_Scanner::_M_eat_escape_ecma
+                   : &_Scanner::_M_eat_escape_posix)
     { _M_advance(); }
 
   template<typename _FwdIter>
@@ -243,9 +244,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          _M_state = _S_state_in_brace;
          _M_token = _S_token_interval_begin;
        }
-      else if (_M_spec_char.count(__c)
-              && __c != ']'
-              && __c != '}'
+      else if ((_M_spec_char.count(_M_ctype.narrow(__c, '\0'))
+               && __c != ']'
+               && __c != '}')
               || (_M_is_grep() && __c == '\n'))
        _M_token = _M_token_map.at(__c);
       else
@@ -366,7 +367,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       auto __c = *_M_current++;
 
-      if (_M_escape_map.count(__c)
+      if (_M_escape_map.count(_M_ctype.narrow(__c, '\0'))
          && (__c != 'b' || _M_state == _S_state_in_bracket))
        {
          _M_token = _S_token_ord_char;
@@ -440,7 +441,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       auto __c = *_M_current;
 
-      if (_M_spec_char.count(__c))
+      if (_M_spec_char.count(_M_ctype.narrow(__c, '\0')))
        {
          _M_token = _S_token_ord_char;
          _M_value.assign(1, __c);
@@ -475,7 +476,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     {
       auto __c = *_M_current++;
 
-      if (_M_escape_map.count(__c))
+      if (_M_escape_map.count(_M_ctype.narrow(__c, '\0')))
        {
          _M_token = _S_token_ord_char;
          _M_value.assign(1, _M_escape_map.at(__c));
@@ -515,10 +516,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          || *_M_current++ != __ch
          || _M_current == _M_end // skip __ch
          || *_M_current++ != ']') // skip ']'
-       if (__ch == ':')
-         __throw_regex_error(regex_constants::error_ctype);
-       else
-         __throw_regex_error(regex_constants::error_collate);
+       {
+         if (__ch == ':')
+           __throw_regex_error(regex_constants::error_ctype);
+         else
+           __throw_regex_error(regex_constants::error_collate);
+       }
     }
 
 #ifdef _GLIBCXX_DEBUG