// class template regex -*- C++ -*-
-// Copyright (C) 2013-2014 Free Software Foundation, Inc.
+// Copyright (C) 2013-2020 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
namespace std _GLIBCXX_VISIBILITY(default)
{
-namespace __detail
-{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+namespace __detail
+{
/**
* @addtogroup regex-detail
* @{
{
public:
/// Token types returned from the scanner.
- enum _TokenT
+ enum _TokenT : unsigned
{
_S_token_anychar,
_S_token_ord_char,
_S_token_or,
_S_token_closure0,
_S_token_closure1,
- _S_token_ungreedy,
_S_token_line_begin,
_S_token_line_end,
_S_token_word_bound, // neg if _M_value[0] == 'n'
_S_token_comma,
_S_token_dup_count,
_S_token_eof,
- _S_token_unknown
+ _S_token_bracket_dash,
+ _S_token_unknown = -1u
};
protected:
: _M_awk_escape_tbl),
_M_spec_char(_M_is_ecma()
? _M_ecma_spec_char
- : _M_is_basic()
+ : _M_flags & regex_constants::basic
? _M_basic_spec_char
- : _M_extended_spec_char),
+ : _M_flags & regex_constants::extended
+ ? _M_extended_spec_char
+ : _M_flags & regex_constants::grep
+ ? ".[\\*^$\n"
+ : _M_flags & regex_constants::egrep
+ ? ".[\\()*+?{|^$\n"
+ : _M_flags & regex_constants::awk
+ ? _M_extended_spec_char
+ : nullptr),
_M_at_bracket_start(false)
- { }
+ { __glibcxx_assert(_M_spec_char); }
protected:
const char*
{ return _M_flags & regex_constants::awk; }
protected:
+ // TODO: Make them static in the next abi change.
const std::pair<char, _TokenT> _M_token_tbl[9] =
{
{'^', _S_token_line_begin},
};
/**
- * @brief struct _Scanner. Scans an input range for regex tokens.
+ * @brief Scans an input range for regex tokens.
*
* The %_Scanner class interprets the regular expression pattern in
* the input range passed to its constructor as a sequence of parse
};
//@} regex-detail
-_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#include <bits/regex_scanner.tcc>