2007-03-04 22:59:49 +00:00
|
|
|
// <regex> -*- C++ -*-
|
|
|
|
|
2020-01-01 12:51:42 +01:00
|
|
|
// Copyright (C) 2007-2020 Free Software Foundation, Inc.
|
2007-03-04 22:59:49 +00:00
|
|
|
//
|
|
|
|
// 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
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 17:00:19 +02:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2007-03-04 22:59:49 +00:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
2007-03-04 22:59:49 +00:00
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2007-03-04 22:59:49 +00:00
|
|
|
|
|
|
|
/** @file include/regex
|
|
|
|
* This is a Standard C++ Library header.
|
|
|
|
*/
|
|
|
|
|
2008-04-10 19:02:57 +00:00
|
|
|
#ifndef _GLIBCXX_REGEX
|
|
|
|
#define _GLIBCXX_REGEX 1
|
2007-03-04 22:59:49 +00:00
|
|
|
|
|
|
|
#pragma GCC system_header
|
|
|
|
|
2012-11-10 12:27:22 -05:00
|
|
|
#if __cplusplus < 201103L
|
2010-02-10 19:14:33 +00:00
|
|
|
# include <bits/c++0x_warning.h>
|
2008-05-26 02:19:57 +00:00
|
|
|
#else
|
2007-03-04 22:59:49 +00:00
|
|
|
|
2007-05-31 23:37:56 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include <bitset>
|
2010-06-25 19:27:16 +00:00
|
|
|
#ifdef _GLIBCXX_DEBUG
|
|
|
|
# include <iosfwd>
|
|
|
|
#endif
|
2007-05-31 23:37:56 +00:00
|
|
|
#include <iterator>
|
|
|
|
#include <locale>
|
2010-06-25 19:27:16 +00:00
|
|
|
#include <memory>
|
|
|
|
#include <sstream>
|
|
|
|
#include <stack>
|
2007-05-31 23:37:56 +00:00
|
|
|
#include <stdexcept>
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
2010-06-25 19:27:16 +00:00
|
|
|
#include <vector>
|
2014-07-01 03:05:45 +00:00
|
|
|
#include <map>
|
regex_automaton.tcc (_StateSeq<>::_M_clone()): Do not use std::map.
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex_automaton.tcc (_StateSeq<>::_M_clone()): Do not
use std::map.
* include/bits/regex_automaton.h: Do not use std::set.
* include/bits/regex_compiler.h (_BracketMatcher<>::_M_add_char(),
_BracketMatcher<>::_M_add_collating_element(),
_BracketMatcher<>::_M_add_equivalence_class(),
_BracketMatcher<>::_M_make_range()): Likewise.
* include/bits/regex_compiler.tcc (_BracketMatcher<>::_M_apply()):
Likewise.
* include/bits/regex_executor.h: Do not use std::queue.
* include/bits/regex_executor.tcc (_Executor<>::_M_main(),
_Executor<>::_M_dfs()): Likewise.
* include/std/regex: Remove <map>, <set> and <queue>.
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex.h (__compile_nfa<>(), basic_regex<>::basic_regex(),
basic_regex<>::assign()): Change __compile_nfa to accept
const _CharT* only.
* include/bits/regex_compiler.h: Change _Compiler's template
argument from <_FwdIter, _TraitsT> to <_TraitsT>.
* include/bits/regex_compiler.tcc: Likewise.
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex_compiler.h: Change _ScannerT into char-type
templated.
* include/bits/regex_scanner.h (_Scanner<>::_Scanner()): Separate
_ScannerBase from _Scanner; Change _Scanner's template argument from
_FwdIter to _CharT. Avoid use of std::map and std::set by using arrays
instead.
* include/bits/regex_scanner.tcc (_Scanner<>::_Scanner(),
_Scanner<>::_M_scan_normal(), _Scanner<>::_M_eat_escape_ecma(),
_Scanner<>::_M_eat_escape_posix(), _Scanner<>::_M_eat_escape_awk()):
Likewise.
* include/std/regex: Add <cstring> for using strchr.
2014-01-17 Tim Shen <timshen91@gmail.com>
* bits/regex_automaton.tcc: Indentation fix.
* bits/regex_compiler.h (__compile_nfa<>(), _Compiler<>,
_RegexTranslator<> _AnyMatcher<>, _CharMatcher<>,
_BracketMatcher<>): Add bool option template parameters and
specializations to make matching more efficient and space saving.
* bits/regex_compiler.tcc: Likewise.
From-SVN: r206690
2014-01-16 23:35:21 +00:00
|
|
|
#include <cstring>
|
2007-05-31 23:37:56 +00:00
|
|
|
|
2015-07-30 10:35:45 +00:00
|
|
|
#include <ext/aligned_buffer.h>
|
2020-10-06 00:05:11 +01:00
|
|
|
#include <ext/numeric_traits.h>
|
Split <functional> into smaller pieces
* include/Makefile.am: Add <bits/refwrap.h> and <bits/std_function.h>.
Order alphabetically.
* include/Makefile.in: Regenerate.
* include/bits/refwrap.h: New header.
(_Maybe_get_result_type,_Weak_result_type_impl, _Weak_result_type)
(_Reference_wrapper_base_impl, _Reference_wrapper_base)
(reference_wrapper, ref, cref): Move here from <functional>.
* include/bits/shared_ptr_base.h: Include <bits/refwrap.h> and
<bits/stl_function.h> instead of <functional>.
* include/bits/std_function.h: New header.
(_Maybe_unary_or_binary_function, bad_function_call)
(__is_location_invariant, _Nocopy_types, _Any_data)
(_Simple_type_wrapper, _Function_base, _Function_handler, function):
Move here from <functional>.
* include/bits/unique_ptr.h: Include <bits/stl_function.h>.
* include/std/functional: Include new headers and move components to
them.
* include/std/future: Include <bits/std_function.h> instead of
<functional>.
* include/std/mutex: Likewise.
* include/std/regex: Likewise.
* src/c++11/compatibility-thread-c++0x.cc: Include <functional>.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error
lines.
* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
* testsuite/30_threads/packaged_task/49668.cc: Include <functional>.
From-SVN: r241410
2016-10-21 16:32:25 +01:00
|
|
|
#include <bits/std_function.h>
|
2010-06-25 19:27:16 +00:00
|
|
|
#include <bits/regex_constants.h>
|
|
|
|
#include <bits/regex_error.h>
|
2013-08-07 16:27:36 +00:00
|
|
|
#include <bits/regex_automaton.h>
|
regex_compiler.h (_AnyMatcher<>::_AnyMatcher(), [...]): Fix _AnyMatcher behavior of POSIX style and move _M_flags to template parameter...
2014-01-07 Tim Shen <timshen91@gmail.com>
* include/bits/regex_compiler.h (_AnyMatcher<>::_AnyMatcher(),
_AnyMatcher<>::operator(), _AnyMatcher<>::_M_apply(),
_CharMatcher<>::_CharMatcher(), _CharMatcher<>::_M_translate(),
_BracketMatcher<>::_BracketMatcher(), _BracketMatcher<>::operator(),
_BracketMatcher<>::_M_add_char(),
_BracketMatcher<>::_M_add_collating_element(),
_BracketMatcher<>::_M_add_equivalence_class(),
_BracketMatcher<>::_M_add_character_class(),
_BracketMatcher<>::_M_make_range(), _BracketMatcher<>::_M_ready(),
_BracketMatcher<>::_M_apply(), _BracketMatcher<>::_M_make_cache()):
Fix _AnyMatcher behavior of POSIX style and move _M_flags
to template parameter; Add cache for _BracketMatcher. Adjust
declarations from here...
* include/bits/regex.h (basic_regex<>::imbue()): ...to here. Also,
imbuing a regex will trigger a recompilation to rebuild the cache.
* include/bits/regex_compiler.tcc (_Compiler<>::_M_atom(),
_Compiler<>::_M_bracket_expression()): Adjust matchers' caller for
different template bool parameters.
* include/bits/regex_executor.h: Remove unnecessary declarations.
* include/std/regex: Adjust including orders.
* testsuite/28_regex/traits/char/user_defined.cc: New.
* testsuite/28_regex/traits/wchar_t/user_defined.cc: New.
From-SVN: r206400
2014-01-07 19:17:50 +00:00
|
|
|
#include <bits/regex_scanner.h>
|
2010-06-25 19:27:16 +00:00
|
|
|
#include <bits/regex_compiler.h>
|
2015-01-19 22:56:04 +00:00
|
|
|
#include <bits/regex.h>
|
2013-08-07 16:27:36 +00:00
|
|
|
#include <bits/regex_executor.h>
|
2007-03-04 22:59:49 +00:00
|
|
|
|
PR libstdc++/87061 remove pmr type aliases for COW strings
The pmr aliases for basic_string and match_results are incompatible with
the gcc4-compatible ABI because the Copy-On-Write basic_string class
doesn't support C++11 allocators.
PR libstdc++/87061
* include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::match_results, experimental::pmr::cmatch)
(experimental::pmr::smatch, experimental::pmr::wcmatch)
(experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
because COW strings don't support C++11 allocator model.
* include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
(experimental::pmr::basic_string, experimental::pmr::string)
(experimental::pmr::u16string, experimental::pmr::u32string)
(experimental::pmr::wstring): Likewise.
* include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results)
(pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise.
* include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string)
(pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise.
* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require
cxx11-abi.
* testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.
From-SVN: r263791
2018-08-22 23:54:33 +01:00
|
|
|
#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI
|
2018-08-10 00:25:53 +01:00
|
|
|
#include <memory_resource>
|
|
|
|
namespace std _GLIBCXX_VISIBILITY(default)
|
|
|
|
{
|
|
|
|
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|
|
|
namespace pmr {
|
|
|
|
template<typename _Tp> class polymorphic_allocator;
|
|
|
|
template<typename _BidirectionalIterator>
|
|
|
|
using match_results
|
|
|
|
= std::match_results<_BidirectionalIterator, polymorphic_allocator<
|
|
|
|
sub_match<_BidirectionalIterator>>>;
|
|
|
|
using cmatch = match_results<const char*>;
|
|
|
|
using smatch = match_results<string::const_iterator>;
|
|
|
|
#ifdef _GLIBCXX_USE_WCHAR_T
|
|
|
|
using wcmatch = match_results<const wchar_t*>;
|
|
|
|
using wsmatch = match_results<wstring::const_iterator>;
|
|
|
|
#endif
|
|
|
|
} // namespace pmr
|
|
|
|
_GLIBCXX_END_NAMESPACE_VERSION
|
|
|
|
} // namespace std
|
|
|
|
#endif // C++17
|
2012-11-10 12:27:22 -05:00
|
|
|
#endif // C++11
|
2008-05-26 02:19:57 +00:00
|
|
|
|
2008-04-10 19:02:57 +00:00
|
|
|
#endif // _GLIBCXX_REGEX
|