regex_automaton.h (__detail::_State): Split non-dependent parts into new _State_base.

* include/bits/regex_automaton.h (__detail::_State): Split
	non-dependent parts into new _State_base.
	(__detail::_NFA): Likewise for _NFA_base. Use std::move() to avoid
	copies when inserting _MatcherT and _StateT objects.
	* include/bits/regex_automaton.tcc: Move member definitions to base
	class. Qualify dependent names.
	* include/bits/regex_compiler.h (__detail::_Compiler::_M_get_nfa): Make
	non-const and use std::move to avoid copying.
	* include/bits/regex_compiler.tcc: Likewise.
	* include/bits/regex_executor.h (__detail::_Executor::_M_is_word): Use
	array, so past-the-end iterator is valid.

From-SVN: r204571
This commit is contained in:
Jonathan Wakely 2013-11-08 14:30:22 +00:00 committed by Jonathan Wakely
parent cb3d1e3e87
commit 7d9d218516
6 changed files with 231 additions and 195 deletions

View File

@ -1,3 +1,17 @@
2013-11-08 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/regex_automaton.h (__detail::_State): Split
non-dependent parts into new _State_base.
(__detail::_NFA): Likewise for _NFA_base. Use std::move() to avoid
copies when inserting _MatcherT and _StateT objects.
* include/bits/regex_automaton.tcc: Move member definitions to base
class. Qualify dependent names.
* include/bits/regex_compiler.h (__detail::_Compiler::_M_get_nfa): Make
non-const and use std::move to avoid copying.
* include/bits/regex_compiler.tcc: Likewise.
* include/bits/regex_executor.h (__detail::_Executor::_M_is_word): Use
array, so past-the-end iterator is valid.
2013-11-06 Jonathan Wakely <jwakely.gcc@gmail.com> 2013-11-06 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/regex_automaton.h (_S_opcode_word_boundry): Rename to * include/bits/regex_automaton.h (_S_opcode_word_boundry): Rename to

View File

@ -65,81 +65,114 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_opcode_accept, _S_opcode_accept,
}; };
template<typename _CharT, typename _TraitsT> struct _State_base
class _State {
_Opcode _M_opcode; // type of outgoing transition
_StateIdT _M_next; // outgoing transition
union // Since they are mutually exclusive.
{ {
public: size_t _M_subexpr; // for _S_opcode_subexpr_*
typedef _Matcher<_CharT> _MatcherT; size_t _M_backref_index; // for _S_opcode_backref
struct
_Opcode _M_opcode; // type of outgoing transition
_StateIdT _M_next; // outgoing transition
union // Since they are mutually exclusive.
{ {
size_t _M_subexpr; // for _S_opcode_subexpr_* // for _S_opcode_alternative.
size_t _M_backref_index; // for _S_opcode_backref _StateIdT _M_quant_index;
struct // for _S_opcode_alternative or _S_opcode_subexpr_lookahead
{ _StateIdT _M_alt;
// for _S_opcode_alternative. // for _S_opcode_word_boundary or _S_opcode_subexpr_lookahead or
_StateIdT _M_quant_index; // quantifiers (ungreedy if set true)
// for _S_opcode_alternative or _S_opcode_subexpr_lookahead bool _M_neg;
_StateIdT _M_alt;
// for _S_opcode_word_boundary or _S_opcode_subexpr_lookahead or
// quantifiers(ungreedy if set true)
bool _M_neg;
};
}; };
_MatcherT _M_matches; // for _S_opcode_match
explicit _State(_Opcode __opcode)
: _M_opcode(__opcode), _M_next(_S_invalid_state_id)
{ }
#ifdef _GLIBCXX_DEBUG
std::ostream&
_M_print(std::ostream& ostr) const;
// Prints graphviz dot commands for state.
std::ostream&
_M_dot(std::ostream& __ostr, _StateIdT __id) const;
#endif
}; };
explicit _State_base(_Opcode __opcode)
: _M_opcode(__opcode), _M_next(_S_invalid_state_id)
{ }
protected:
~_State_base() = default;
public:
#ifdef _GLIBCXX_DEBUG
std::ostream&
_M_print(std::ostream& ostr) const;
// Prints graphviz dot commands for state.
std::ostream&
_M_dot(std::ostream& __ostr, _StateIdT __id) const;
#endif
};
template<typename _CharT, typename _TraitsT> template<typename _CharT, typename _TraitsT>
class _NFA struct _State : _State_base
: public std::vector<_State<_CharT, _TraitsT>>
{ {
public: typedef _Matcher<_CharT> _MatcherT;
typedef _State<_CharT, _TraitsT> _StateT;
typedef const _Matcher<_CharT>& _MatcherT;
typedef size_t _SizeT;
typedef regex_constants::syntax_option_type _FlagT;
_NFA(_FlagT __f) _MatcherT _M_matches; // for _S_opcode_match
: _M_flags(__f), _M_start_state(0), _M_subexpr_count(0),
_M_quant_count(0), _M_has_backref(false)
{ }
_FlagT explicit _State(_Opcode __opcode) : _State_base(__opcode) { }
_M_options() const };
{ return _M_flags; }
_StateIdT struct _NFA_base
_M_start() const {
{ return _M_start_state; } typedef size_t _SizeT;
typedef regex_constants::syntax_option_type _FlagT;
const _StateSet& explicit
_M_final_states() const _NFA_base(_FlagT __f)
{ return _M_accepting_states; } : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0),
_M_quant_count(0), _M_has_backref(false)
{ }
_SizeT _NFA_base(_NFA_base&&) = default;
_M_sub_count() const
{ return _M_subexpr_count; } protected:
~_NFA_base() = default;
public:
_FlagT
_M_options() const
{ return _M_flags; }
_StateIdT
_M_start() const
{ return _M_start_state; }
const _StateSet&
_M_final_states() const
{ return _M_accepting_states; }
_SizeT
_M_sub_count() const
{ return _M_subexpr_count; }
std::vector<size_t> _M_paren_stack;
_StateSet _M_accepting_states;
_FlagT _M_flags;
_StateIdT _M_start_state;
_SizeT _M_subexpr_count;
_SizeT _M_quant_count;
bool _M_has_backref;
};
template<typename _CharT, typename _TraitsT>
struct _NFA
: _NFA_base, std::vector<_State<_CharT, _TraitsT>>
{
typedef _State<_CharT, _TraitsT> _StateT;
typedef _Matcher<_CharT> _MatcherT;
using _NFA_base::_NFA_base;
// for performance reasons _NFA objects should only be moved not copied
_NFA(const _NFA&) = delete;
_NFA(_NFA&&) = default;
_StateIdT _StateIdT
_M_insert_accept() _M_insert_accept()
{ {
auto __ret = _M_insert_state(_StateT(_S_opcode_accept)); auto __ret = _M_insert_state(_StateT(_S_opcode_accept));
_M_accepting_states.insert(__ret); this->_M_accepting_states.insert(__ret);
return __ret; return __ret;
} }
@ -149,38 +182,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StateT __tmp(_S_opcode_alternative); _StateT __tmp(_S_opcode_alternative);
// It labels every quantifier to make greedy comparison easier in BFS // It labels every quantifier to make greedy comparison easier in BFS
// approach. // approach.
__tmp._M_quant_index = _M_quant_count++; __tmp._M_quant_index = this->_M_quant_count++;
__tmp._M_next = __next; __tmp._M_next = __next;
__tmp._M_alt = __alt; __tmp._M_alt = __alt;
__tmp._M_neg = __neg; __tmp._M_neg = __neg;
return _M_insert_state(__tmp); return _M_insert_state(std::move(__tmp));
} }
_StateIdT _StateIdT
_M_insert_matcher(_MatcherT __m) _M_insert_matcher(_MatcherT __m)
{ {
_StateT __tmp(_S_opcode_match); _StateT __tmp(_S_opcode_match);
__tmp._M_matches = __m; __tmp._M_matches = std::move(__m);
return _M_insert_state(__tmp); return _M_insert_state(std::move(__tmp));
} }
_StateIdT _StateIdT
_M_insert_subexpr_begin() _M_insert_subexpr_begin()
{ {
auto __id = _M_subexpr_count++; auto __id = this->_M_subexpr_count++;
_M_paren_stack.push_back(__id); this->_M_paren_stack.push_back(__id);
_StateT __tmp(_S_opcode_subexpr_begin); _StateT __tmp(_S_opcode_subexpr_begin);
__tmp._M_subexpr = __id; __tmp._M_subexpr = __id;
return _M_insert_state(__tmp); return _M_insert_state(std::move(__tmp));
} }
_StateIdT _StateIdT
_M_insert_subexpr_end() _M_insert_subexpr_end()
{ {
_StateT __tmp(_S_opcode_subexpr_end); _StateT __tmp(_S_opcode_subexpr_end);
__tmp._M_subexpr = _M_paren_stack.back(); __tmp._M_subexpr = this->_M_paren_stack.back();
_M_paren_stack.pop_back(); this->_M_paren_stack.pop_back();
return _M_insert_state(__tmp); return _M_insert_state(std::move(__tmp));
} }
_StateIdT _StateIdT
@ -199,7 +232,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
_StateT __tmp(_S_opcode_word_boundary); _StateT __tmp(_S_opcode_word_boundary);
__tmp._M_neg = __neg; __tmp._M_neg = __neg;
return _M_insert_state(__tmp); return _M_insert_state(std::move(__tmp));
} }
_StateIdT _StateIdT
@ -208,7 +241,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StateT __tmp(_S_opcode_subexpr_lookahead); _StateT __tmp(_S_opcode_subexpr_lookahead);
__tmp._M_alt = __alt; __tmp._M_alt = __alt;
__tmp._M_neg = __neg; __tmp._M_neg = __neg;
return _M_insert_state(__tmp); return _M_insert_state(std::move(__tmp));
} }
_StateIdT _StateIdT
@ -218,7 +251,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StateIdT _StateIdT
_M_insert_state(_StateT __s) _M_insert_state(_StateT __s)
{ {
this->push_back(__s); this->push_back(std::move(__s));
return this->size()-1; return this->size()-1;
} }
@ -230,14 +263,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::ostream& std::ostream&
_M_dot(std::ostream& __ostr) const; _M_dot(std::ostream& __ostr) const;
#endif #endif
std::vector<size_t> _M_paren_stack;
_StateSet _M_accepting_states;
_FlagT _M_flags;
_StateIdT _M_start_state;
_SizeT _M_subexpr_count;
_SizeT _M_quant_count;
bool _M_has_backref;
}; };
/// Describes a sequence of one or more %_State, its current start /// Describes a sequence of one or more %_State, its current start
@ -251,7 +276,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public: public:
_StateSeq(_RegexT& __nfa, _StateIdT __s) _StateSeq(_RegexT& __nfa, _StateIdT __s)
: _StateSeq(__nfa, __s, __s) : _M_nfa(__nfa), _M_start(__s), _M_end(__s)
{ } { }
_StateSeq(_RegexT& __nfa, _StateIdT __s, _StateIdT __end) _StateSeq(_RegexT& __nfa, _StateIdT __s, _StateIdT __end)

View File

@ -35,118 +35,116 @@ namespace __detail
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef _GLIBCXX_DEBUG #ifdef _GLIBCXX_DEBUG
template<typename _CharT, typename _TraitsT> std::ostream&
std::ostream& _State<_CharT, _TraitsT>:: _State_base::_M_print(std::ostream& ostr) const
_M_print(std::ostream& ostr) const {
switch (_M_opcode)
{ {
switch (_M_opcode) case _S_opcode_alternative:
{ ostr << "alt next=" << _M_next << " alt=" << _M_alt;
case _S_opcode_alternative: break;
ostr << "alt next=" << _M_next << " alt=" << _M_alt; case _S_opcode_subexpr_begin:
break; ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr;
case _S_opcode_subexpr_begin: break;
ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr; case _S_opcode_subexpr_end:
break; ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr;
case _S_opcode_subexpr_end: break;
ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr; case _S_opcode_backref:
break; ostr << "backref next=" << _M_next << " index=" << _M_backref_index;
case _S_opcode_backref: break;
ostr << "backref next=" << _M_next << " index=" << _M_backref_index; case _S_opcode_match:
break; ostr << "match next=" << _M_next;
case _S_opcode_match: break;
ostr << "match next=" << _M_next; case _S_opcode_accept:
break; ostr << "accept next=" << _M_next;
case _S_opcode_accept: break;
ostr << "accept next=" << _M_next; default:
break; ostr << "unknown next=" << _M_next;
default: break;
ostr << "unknown next=" << _M_next;
break;
}
return ostr;
} }
return ostr;
}
// Prints graphviz dot commands for state. // Prints graphviz dot commands for state.
template<typename _CharT, typename _TraitsT> std::ostream&
std::ostream& _State<_CharT, _TraitsT>:: _State_base::_M_dot(std::ostream& __ostr, _StateIdT __id) const
_M_dot(std::ostream& __ostr, _StateIdT __id) const {
switch (_M_opcode)
{ {
switch (_M_opcode) case _S_opcode_alternative:
{ __ostr << __id << " [label=\"" << __id << "\\nALT\"];\n"
case _S_opcode_alternative: << __id << " -> " << _M_next
__ostr << __id << " [label=\"" << __id << "\\nALT\"];\n" << " [label=\"epsilon\", tailport=\"s\"];\n"
<< __id << " -> " << _M_next << __id << " -> " << _M_alt
<< " [label=\"epsilon\", tailport=\"s\"];\n" << " [label=\"epsilon\", tailport=\"n\"];\n";
<< __id << " -> " << _M_alt break;
<< " [label=\"epsilon\", tailport=\"n\"];\n"; case _S_opcode_backref:
break; __ostr << __id << " [label=\"" << __id << "\\nBACKREF "
case _S_opcode_backref: << _M_subexpr << "\"];\n"
__ostr << __id << " [label=\"" << __id << "\\nBACKREF " << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
<< _M_subexpr << "\"];\n" break;
<< __id << " -> " << _M_next << " [label=\"<match>\"];\n"; case _S_opcode_line_begin_assertion:
break; __ostr << __id << " [label=\"" << __id << "\\nLINE_BEGIN \"];\n"
case _S_opcode_line_begin_assertion: << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
__ostr << __id << " [label=\"" << __id << "\\nLINE_BEGIN \"];\n" break;
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; case _S_opcode_line_end_assertion:
break; __ostr << __id << " [label=\"" << __id << "\\nLINE_END \"];\n"
case _S_opcode_line_end_assertion: << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
__ostr << __id << " [label=\"" << __id << "\\nLINE_END \"];\n" break;
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; case _S_opcode_word_boundary:
break; __ostr << __id << " [label=\"" << __id << "\\nWORD_BOUNDRY "
case _S_opcode_word_boundary: << _M_neg << "\"];\n"
__ostr << __id << " [label=\"" << __id << "\\nWORD_BOUNDRY " << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
<< _M_neg << "\"];\n" break;
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; case _S_opcode_subexpr_lookahead:
break; __ostr << __id << " [label=\"" << __id << "\\nLOOK_AHEAD\"];\n"
case _S_opcode_subexpr_lookahead: << __id << " -> " << _M_next
__ostr << __id << " [label=\"" << __id << "\\nLOOK_AHEAD\"];\n" << " [label=\"epsilon\", tailport=\"s\"];\n"
<< __id << " -> " << _M_next << __id << " -> " << _M_alt
<< " [label=\"epsilon\", tailport=\"s\"];\n" << " [label=\"<assert>\", tailport=\"n\"];\n";
<< __id << " -> " << _M_alt break;
<< " [label=\"<assert>\", tailport=\"n\"];\n"; case _S_opcode_subexpr_begin:
break; __ostr << __id << " [label=\"" << __id << "\\nSBEGIN "
case _S_opcode_subexpr_begin: << _M_subexpr << "\"];\n"
__ostr << __id << " [label=\"" << __id << "\\nSBEGIN " << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
<< _M_subexpr << "\"];\n" break;
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; case _S_opcode_subexpr_end:
break; __ostr << __id << " [label=\"" << __id << "\\nSEND "
case _S_opcode_subexpr_end: << _M_subexpr << "\"];\n"
__ostr << __id << " [label=\"" << __id << "\\nSEND " << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
<< _M_subexpr << "\"];\n" break;
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; case _S_opcode_dummy:
break; break;
case _S_opcode_dummy: case _S_opcode_match:
break; __ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n"
case _S_opcode_match: << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
__ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n" break;
<< __id << " -> " << _M_next << " [label=\"<match>\"];\n"; case _S_opcode_accept:
break; __ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ;
case _S_opcode_accept: break;
__ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ; default:
break; _GLIBCXX_DEBUG_ASSERT(false);
default: break;
_GLIBCXX_DEBUG_ASSERT(false);
break;
}
return __ostr;
} }
return __ostr;
}
template<typename _CharT, typename _TraitsT> template<typename _CharT, typename _TraitsT>
std::ostream& _NFA<_CharT, _TraitsT>:: std::ostream&
_M_dot(std::ostream& __ostr) const _NFA<_CharT, _TraitsT>::_M_dot(std::ostream& __ostr) const
{ {
__ostr << "digraph _Nfa {\n" __ostr << "digraph _Nfa {\n"
<< " rankdir=LR;\n"; " rankdir=LR;\n";
for (size_t __i = 0; __i < this->size(); ++__i) for (size_t __i = 0; __i < this->size(); ++__i)
{ this->at(__i)._M_dot(__ostr, __i); } (*this)[__i]._M_dot(__ostr, __i);
__ostr << "}\n"; __ostr << "}\n";
return __ostr; return __ostr;
} }
#endif #endif
template<typename _CharT, typename _TraitsT> template<typename _CharT, typename _TraitsT>
_StateIdT _NFA<_CharT, _TraitsT>:: _StateIdT
_M_insert_backref(size_t __index) _NFA<_CharT, _TraitsT>::_M_insert_backref(size_t __index)
{ {
// To figure out whether a backref is valid, a stack is used to store // To figure out whether a backref is valid, a stack is used to store
// unfinished sub-expressions. For example, when parsing // unfinished sub-expressions. For example, when parsing
@ -157,18 +155,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// time, "\\2" is valid, but "\\1" and "\\3" are not. // time, "\\2" is valid, but "\\1" and "\\3" are not.
if (__index >= _M_subexpr_count) if (__index >= _M_subexpr_count)
__throw_regex_error(regex_constants::error_backref); __throw_regex_error(regex_constants::error_backref);
for (auto __it : _M_paren_stack) for (auto __it : this->_M_paren_stack)
if (__index == __it) if (__index == __it)
__throw_regex_error(regex_constants::error_backref); __throw_regex_error(regex_constants::error_backref);
_M_has_backref = true; this->_M_has_backref = true;
_StateT __tmp(_S_opcode_backref); _StateT __tmp(_S_opcode_backref);
__tmp._M_backref_index = __index; __tmp._M_backref_index = __index;
return _M_insert_state(__tmp); return _M_insert_state(std::move(__tmp));
} }
template<typename _CharT, typename _TraitsT> template<typename _CharT, typename _TraitsT>
void _NFA<_CharT, _TraitsT>:: void
_M_eliminate_dummy() _NFA<_CharT, _TraitsT>::_M_eliminate_dummy()
{ {
for (auto& __it : *this) for (auto& __it : *this)
{ {
@ -185,8 +183,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Just apply DFS on the sequence and re-link their links. // Just apply DFS on the sequence and re-link their links.
template<typename _CharT, typename _TraitsT> template<typename _CharT, typename _TraitsT>
_StateSeq<_CharT, _TraitsT> _StateSeq<_CharT, _TraitsT>:: _StateSeq<_CharT, _TraitsT>
_M_clone() _StateSeq<_CharT, _TraitsT>::_M_clone()
{ {
std::map<_StateIdT, _StateIdT> __m; std::map<_StateIdT, _StateIdT> __m;
std::stack<_StateIdT> __stack; std::stack<_StateIdT> __stack;

View File

@ -55,8 +55,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const _TraitsT& __traits, _FlagT __flags); const _TraitsT& __traits, _FlagT __flags);
std::shared_ptr<_RegexT> std::shared_ptr<_RegexT>
_M_get_nfa() const _M_get_nfa()
{ return make_shared<_RegexT>(_M_nfa); } { return make_shared<_RegexT>(std::move(_M_nfa)); }
private: private:
typedef _Scanner<_FwdIter> _ScannerT; typedef _Scanner<_FwdIter> _ScannerT;

View File

@ -147,11 +147,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_assertion() _M_assertion()
{ {
if (_M_match_token(_ScannerT::_S_token_line_begin)) if (_M_match_token(_ScannerT::_S_token_line_begin))
_M_stack.push(_StateSeqT(_M_nfa, _M_nfa. _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_line_begin()));
_M_insert_line_begin()));
else if (_M_match_token(_ScannerT::_S_token_line_end)) else if (_M_match_token(_ScannerT::_S_token_line_end))
_M_stack.push(_StateSeqT(_M_nfa, _M_nfa. _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_line_end()));
_M_insert_line_end()));
else if (_M_match_token(_ScannerT::_S_token_word_bound)) else if (_M_match_token(_ScannerT::_S_token_word_bound))
// _M_value[0] == 'n' means it's negtive, say "not word boundary". // _M_value[0] == 'n' means it's negtive, say "not word boundary".
_M_stack.push(_StateSeqT(_M_nfa, _M_nfa. _M_stack.push(_StateSeqT(_M_nfa, _M_nfa.
@ -305,7 +303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_traits, _M_flags); _M_traits, _M_flags);
__matcher._M_add_character_class(_M_value); __matcher._M_add_character_class(_M_value);
_M_stack.push(_StateSeqT(_M_nfa, _M_stack.push(_StateSeqT(_M_nfa,
_M_nfa._M_insert_matcher(__matcher))); _M_nfa._M_insert_matcher(std::move(__matcher))));
} }
else if (_M_match_token(_ScannerT::_S_token_subexpr_no_group_begin)) else if (_M_match_token(_ScannerT::_S_token_subexpr_no_group_begin))
{ {
@ -343,7 +341,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_BMatcherT __matcher(__neg, _M_traits, _M_flags); _BMatcherT __matcher(__neg, _M_traits, _M_flags);
while (!_M_match_token(_ScannerT::_S_token_bracket_end)) while (!_M_match_token(_ScannerT::_S_token_bracket_end))
_M_expression_term(__matcher); _M_expression_term(__matcher);
_M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_matcher(__matcher))); _M_stack.push(_StateSeqT(_M_nfa,
_M_nfa._M_insert_matcher(std::move(__matcher))));
return true; return true;
} }
@ -432,8 +431,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _CharT, typename _TraitsT> template<typename _CharT, typename _TraitsT>
bool _BracketMatcher<_CharT, _TraitsT>:: bool
operator()(_CharT __ch) const _BracketMatcher<_CharT, _TraitsT>::operator()(_CharT __ch) const
{ {
bool __ret = false; bool __ret = false;
if (_M_traits.isctype(__ch, _M_class_set) if (_M_traits.isctype(__ch, _M_class_set)

View File

@ -53,7 +53,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
template<typename _BiIter, typename _Alloc, typename _TraitsT, template<typename _BiIter, typename _Alloc, typename _TraitsT,
bool __dfs_mode> bool __dfs_mode>
class _Executor class _Executor
{ {
public: public:
@ -117,9 +117,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool bool
_M_is_word(_CharT __ch) const _M_is_word(_CharT __ch) const
{ {
static const _CharT __s = 'w'; static const _CharT __s[2] = { 'w' };
return _M_re._M_traits.isctype return _M_re._M_traits.isctype
(__ch, _M_re._M_traits.lookup_classname(&__s, &__s+1)); (__ch, _M_re._M_traits.lookup_classname(__s, __s+1));
} }
bool bool