1 // class template regex -*- C++ -*-
3 // Copyright (C) 2013 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
26 * @file bits/regex_scanner.h
27 * This is an internal header file, included by other library headers.
28 * Do not attempt to use it directly. @headername{regex}
31 namespace std
_GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_VERSION
38 * @addtogroup regex-detail
43 * @brief struct _Scanner. Scans an input range for regex tokens.
45 * The %_Scanner class interprets the regular expression pattern in
46 * the input range passed to its constructor as a sequence of parse
47 * tokens passed to the regular expression compiler. The sequence
48 * of tokens provided depends on the flag settings passed to the
49 * constructor: different regular expression grammars will interpret
50 * the same input pattern in syntactically different ways.
52 template<typename _FwdIter
>
56 typedef typename
std::iterator_traits
<_FwdIter
>::value_type _CharT
;
57 typedef std::basic_string
<_CharT
> _StringT
;
58 typedef regex_constants::syntax_option_type _FlagT
;
59 typedef const std::ctype
<_CharT
> _CtypeT
;
61 /// Token types returned from the scanner.
69 _S_token_subexpr_begin
,
70 _S_token_subexpr_no_group_begin
,
71 _S_token_subexpr_lookahead_begin
,
72 _S_token_subexpr_neg_lookahead_begin
,
74 _S_token_bracket_begin
,
75 _S_token_bracket_neg_begin
,
77 _S_token_interval_begin
,
78 _S_token_interval_end
,
79 _S_token_quoted_class
,
80 _S_token_char_class_name
,
82 _S_token_equiv_class_name
,
95 _Scanner(_FwdIter __begin
, _FwdIter __end
,
96 _FlagT __flags
, std::locale __loc
);
109 #ifdef _GLIBCXX_DEBUG
111 _M_print(std::ostream
&);
126 _M_scan_in_bracket();
132 _M_eat_escape_ecma();
135 _M_eat_escape_posix();
145 { return _M_flags
& regex_constants::ECMAScript
; }
149 { return _M_flags
& (regex_constants::basic
| regex_constants::grep
); }
154 return _M_flags
& (regex_constants::extended
155 | regex_constants::egrep
156 | regex_constants::awk
);
161 { return _M_flags
& (regex_constants::grep
| regex_constants::egrep
); }
165 { return _M_flags
& regex_constants::awk
; }
174 bool _M_at_bracket_start
;
176 // TODO: make them static when this file is stable.
177 const std::map
<char, _TokenT
> _M_token_map
;
178 const std::map
<char, char> _M_ecma_escape_map
;
179 const std::map
<char, char> _M_awk_escape_map
;
180 const std::set
<char> _M_ecma_spec_char
;
181 const std::set
<char> _M_basic_spec_char
;
182 const std::set
<char> _M_extended_spec_char
;
184 const std::map
<char, char>& _M_escape_map
;
185 const std::set
<char>& _M_spec_char
;
186 void (_Scanner::* _M_eat_escape
)();
190 _GLIBCXX_END_NAMESPACE_VERSION
191 } // namespace __detail
194 #include <bits/regex_scanner.tcc>