Commit e280b6ff by Tim Shen Committed by Tim Shen

regex.h: Replace 8 spaces in indentation with a tab.

2013-08-22  Tim Shen  <timshen91@gmail.com>

	* include/bits/regex.h: Replace 8 spaces in indentation with a tab.
	* include/bits/regex_automaton.h: Same.
	* include/bits/regex_automaton.tcc: Same.
	* include/bits/regex_compiler.h: Same.
	* include/bits/regex_compiler.tcc: Same.
	* include/bits/regex_constants.h: Same.
	* include/bits/regex_executor.h: Same.
	* include/bits/regex_executor.tcc: Same.

From-SVN: r201916
parent 3f97cb0b
2013-08-22 Tim Shen <timshen91@gmail.com> 2013-08-22 Tim Shen <timshen91@gmail.com>
* include/bits/regex.h: Replace 8 spaces in indentation with a tab.
* include/bits/regex_automaton.h: Same.
* include/bits/regex_automaton.tcc: Same.
* include/bits/regex_compiler.h: Same.
* include/bits/regex_compiler.tcc: Same.
* include/bits/regex_constants.h: Same.
* include/bits/regex_executor.h: Same.
* include/bits/regex_executor.tcc: Same.
2013-08-22 Tim Shen <timshen91@gmail.com>
* include/bits/regex.h: Executor caller. * include/bits/regex.h: Executor caller.
* include/bits/regex_executor.h: Fix empty grouping problem. * include/bits/regex_executor.h: Fix empty grouping problem.
* include/bits/regex_executor.tcc: Same. * include/bits/regex_executor.tcc: Same.
......
...@@ -71,9 +71,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -71,9 +71,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StateIdT _M_next; // outgoing transition _StateIdT _M_next; // outgoing transition
union // Since they are mutual exclusive. union // Since they are mutual exclusive.
{ {
_StateIdT _M_alt; // for _S_opcode_alternative _StateIdT _M_alt; // for _S_opcode_alternative
unsigned int _M_subexpr; // for _S_opcode_subexpr_* unsigned int _M_subexpr; // for _S_opcode_subexpr_*
unsigned int _M_backref_index; // for _S_opcode_backref unsigned int _M_backref_index; // for _S_opcode_backref
}; };
_MatcherT _M_matches; // for _S_opcode_match _MatcherT _M_matches; // for _S_opcode_match
...@@ -83,17 +83,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -83,17 +83,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_State(const _MatcherT& __m) _State(const _MatcherT& __m)
: _M_opcode(_S_opcode_match), _M_next(_S_invalid_state_id), : _M_opcode(_S_opcode_match), _M_next(_S_invalid_state_id),
_M_matches(__m) _M_matches(__m)
{ } { }
_State(_OpcodeT __opcode, unsigned __index) _State(_OpcodeT __opcode, unsigned __index)
: _M_opcode(__opcode), _M_next(_S_invalid_state_id) : _M_opcode(__opcode), _M_next(_S_invalid_state_id)
{ {
if (__opcode == _S_opcode_subexpr_begin if (__opcode == _S_opcode_subexpr_begin
|| __opcode == _S_opcode_subexpr_end) || __opcode == _S_opcode_subexpr_end)
_M_subexpr = __index; _M_subexpr = __index;
else if (__opcode == _S_opcode_backref) else if (__opcode == _S_opcode_backref)
_M_backref_index = __index; _M_backref_index = __index;
} }
_State(_StateIdT __next, _StateIdT __alt) _State(_StateIdT __next, _StateIdT __alt)
...@@ -162,40 +162,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -162,40 +162,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StateIdT _StateIdT
_M_insert_accept() _M_insert_accept()
{ {
this->push_back(_StateT(_S_opcode_accept)); this->push_back(_StateT(_S_opcode_accept));
_M_accepting_states.insert(this->size()-1); _M_accepting_states.insert(this->size()-1);
return this->size()-1; return this->size()-1;
} }
_StateIdT _StateIdT
_M_insert_alt(_StateIdT __next, _StateIdT __alt) _M_insert_alt(_StateIdT __next, _StateIdT __alt)
{ {
this->push_back(_StateT(__next, __alt)); this->push_back(_StateT(__next, __alt));
return this->size()-1; return this->size()-1;
} }
_StateIdT _StateIdT
_M_insert_matcher(_MatcherT __m) _M_insert_matcher(_MatcherT __m)
{ {
this->push_back(_StateT(__m)); this->push_back(_StateT(__m));
return this->size()-1; return this->size()-1;
} }
_StateIdT _StateIdT
_M_insert_subexpr_begin() _M_insert_subexpr_begin()
{ {
auto __id = _M_subexpr_count++; auto __id = _M_subexpr_count++;
_M_paren_stack.push_back(__id); _M_paren_stack.push_back(__id);
this->push_back(_StateT(_S_opcode_subexpr_begin, __id)); this->push_back(_StateT(_S_opcode_subexpr_begin, __id));
return this->size()-1; return this->size()-1;
} }
_StateIdT _StateIdT
_M_insert_subexpr_end() _M_insert_subexpr_end()
{ {
this->push_back(_StateT(_S_opcode_subexpr_end, _M_paren_stack.back())); this->push_back(_StateT(_S_opcode_subexpr_end, _M_paren_stack.back()));
_M_paren_stack.pop_back(); _M_paren_stack.pop_back();
return this->size()-1; return this->size()-1;
} }
_StateIdT _StateIdT
...@@ -225,27 +225,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -225,27 +225,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public: public:
// Constructs a single-node sequence // Constructs a single-node sequence
_StateSeq(_RegexT& __ss, _StateIdT __s, _StateSeq(_RegexT& __ss, _StateIdT __s,
_StateIdT __e = _S_invalid_state_id) _StateIdT __e = _S_invalid_state_id)
: _M_nfa(__ss), _M_start(__s), _M_end1(__s), _M_end2(__e) : _M_nfa(__ss), _M_start(__s), _M_end1(__s), _M_end2(__e)
{ } { }
// Constructs a split sequence from two other sequencces // Constructs a split sequence from two other sequencces
_StateSeq(const _StateSeq& __e1, const _StateSeq& __e2) _StateSeq(const _StateSeq& __e1, const _StateSeq& __e2)
: _M_nfa(__e1._M_nfa), : _M_nfa(__e1._M_nfa),
_M_start(_M_nfa._M_insert_alt(__e1._M_start, __e2._M_start)), _M_start(_M_nfa._M_insert_alt(__e1._M_start, __e2._M_start)),
_M_end1(__e1._M_end1), _M_end2(__e2._M_end1) _M_end1(__e1._M_end1), _M_end2(__e2._M_end1)
{ } { }
// Constructs a split sequence from a single sequence // Constructs a split sequence from a single sequence
_StateSeq(const _StateSeq& __e, _StateIdT __id) _StateSeq(const _StateSeq& __e, _StateIdT __id)
: _M_nfa(__e._M_nfa), : _M_nfa(__e._M_nfa),
_M_start(_M_nfa._M_insert_alt(__id, __e._M_start)), _M_start(_M_nfa._M_insert_alt(__id, __e._M_start)),
_M_end1(__id), _M_end2(__e._M_end1) _M_end1(__id), _M_end2(__e._M_end1)
{ } { }
// Constructs a copy of a %_StateSeq // Constructs a copy of a %_StateSeq
_StateSeq(const _StateSeq& __rhs) _StateSeq(const _StateSeq& __rhs)
: _M_nfa(__rhs._M_nfa), _M_start(__rhs._M_start), : _M_nfa(__rhs._M_nfa), _M_start(__rhs._M_start),
_M_end1(__rhs._M_end1), _M_end2(__rhs._M_end2) _M_end1(__rhs._M_end1), _M_end2(__rhs._M_end2)
{ } { }
_StateSeq& operator=(const _StateSeq& __rhs); _StateSeq& operator=(const _StateSeq& __rhs);
......
...@@ -41,27 +41,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -41,27 +41,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
switch (_M_opcode) switch (_M_opcode)
{ {
case _S_opcode_alternative: case _S_opcode_alternative:
ostr << "alt next=" << _M_next << " alt=" << _M_alt; ostr << "alt next=" << _M_next << " alt=" << _M_alt;
break; break;
case _S_opcode_subexpr_begin: case _S_opcode_subexpr_begin:
ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr; ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr;
break; break;
case _S_opcode_subexpr_end: case _S_opcode_subexpr_end:
ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr; ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr;
break; break;
case _S_opcode_backref: case _S_opcode_backref:
ostr << "backref next=" << _M_next << " index=" << _M_backref_index; ostr << "backref next=" << _M_next << " index=" << _M_backref_index;
break; break;
case _S_opcode_match: case _S_opcode_match:
ostr << "match next=" << _M_next; ostr << "match next=" << _M_next;
break; break;
case _S_opcode_accept: case _S_opcode_accept:
ostr << "accept next=" << _M_next; ostr << "accept next=" << _M_next;
break; break;
default: default:
ostr << "unknown next=" << _M_next; ostr << "unknown next=" << _M_next;
break; break;
} }
return ostr; return ostr;
} }
...@@ -73,39 +73,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -73,39 +73,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
switch (_M_opcode) switch (_M_opcode)
{ {
case _S_opcode_alternative: case _S_opcode_alternative:
__ostr << __id << " [label=\"" << __id << "\\nALT\"];\n" __ostr << __id << " [label=\"" << __id << "\\nALT\"];\n"
<< __id << " -> " << _M_next << __id << " -> " << _M_next
<< " [label=\"epsilon\", tailport=\"s\"];\n" << " [label=\"epsilon\", tailport=\"s\"];\n"
<< __id << " -> " << _M_alt << __id << " -> " << _M_alt
<< " [label=\"epsilon\", tailport=\"n\"];\n"; << " [label=\"epsilon\", tailport=\"n\"];\n";
break; break;
case _S_opcode_subexpr_begin: case _S_opcode_subexpr_begin:
__ostr << __id << " [label=\"" << __id << "\\nSBEGIN " __ostr << __id << " [label=\"" << __id << "\\nSBEGIN "
<< _M_subexpr << "\"];\n" << _M_subexpr << "\"];\n"
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
break; break;
case _S_opcode_subexpr_end: case _S_opcode_subexpr_end:
__ostr << __id << " [label=\"" << __id << "\\nSEND " __ostr << __id << " [label=\"" << __id << "\\nSEND "
<< _M_subexpr << "\"];\n" << _M_subexpr << "\"];\n"
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n"; << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
break; break;
case _S_opcode_backref: case _S_opcode_backref:
__ostr << __id << " [label=\"" << __id << "\\nBACKREF " __ostr << __id << " [label=\"" << __id << "\\nBACKREF "
<< _M_subexpr << "\"];\n" << _M_subexpr << "\"];\n"
<< __id << " -> " << _M_next << " [label=\"<match>\"];\n"; << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
break; break;
case _S_opcode_match: case _S_opcode_match:
__ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n" __ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n"
<< __id << " -> " << _M_next << " [label=\"<match>\"];\n"; << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
break; break;
case _S_opcode_accept: case _S_opcode_accept:
__ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ; __ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ;
break; break;
default: default:
__ostr << __id << " [label=\"" << __id << "\\nUNK\"];\n" __ostr << __id << " [label=\"" << __id << "\\nUNK\"];\n"
<< __id << " -> " << _M_next << " [label=\"?\"];\n"; << __id << " -> " << _M_next << " [label=\"?\"];\n";
break; break;
} }
return __ostr; return __ostr;
} }
...@@ -135,10 +135,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -135,10 +135,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// _M_paren_stack is {1, 3}, for incomplete "(a.." and "(c..". At this // _M_paren_stack is {1, 3}, for incomplete "(a.." and "(c..". At this
// 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 : _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; _M_has_backref = true;
this->push_back(_StateT(_S_opcode_backref, __index)); this->push_back(_StateT(_S_opcode_backref, __index));
return this->size()-1; return this->size()-1;
...@@ -159,7 +159,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -159,7 +159,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_push_back(_StateIdT __id) _M_push_back(_StateIdT __id)
{ {
if (_M_end1 != _S_invalid_state_id) if (_M_end1 != _S_invalid_state_id)
_M_nfa[_M_end1]._M_next = __id; _M_nfa[_M_end1]._M_next = __id;
_M_end1 = __id; _M_end1 = __id;
} }
...@@ -169,14 +169,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -169,14 +169,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
if (_M_end2 != _S_invalid_state_id) if (_M_end2 != _S_invalid_state_id)
{ {
if (_M_end2 == _M_end1) if (_M_end2 == _M_end1)
_M_nfa[_M_end2]._M_alt = __id; _M_nfa[_M_end2]._M_alt = __id;
else else
_M_nfa[_M_end2]._M_next = __id; _M_nfa[_M_end2]._M_next = __id;
_M_end2 = _S_invalid_state_id; _M_end2 = _S_invalid_state_id;
} }
if (_M_end1 != _S_invalid_state_id) if (_M_end1 != _S_invalid_state_id)
_M_nfa[_M_end1]._M_next = __id; _M_nfa[_M_end1]._M_next = __id;
_M_end1 = __id; _M_end1 = __id;
} }
...@@ -186,16 +186,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -186,16 +186,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
if (_M_end2 != _S_invalid_state_id) if (_M_end2 != _S_invalid_state_id)
{ {
if (_M_end2 == _M_end1) if (_M_end2 == _M_end1)
_M_nfa[_M_end2]._M_alt = __rhs._M_start; _M_nfa[_M_end2]._M_alt = __rhs._M_start;
else else
_M_nfa[_M_end2]._M_next = __rhs._M_start; _M_nfa[_M_end2]._M_next = __rhs._M_start;
_M_end2 = _S_invalid_state_id; _M_end2 = _S_invalid_state_id;
} }
if (__rhs._M_end2 != _S_invalid_state_id) if (__rhs._M_end2 != _S_invalid_state_id)
_M_end2 = __rhs._M_end2; _M_end2 = __rhs._M_end2;
if (_M_end1 != _S_invalid_state_id) if (_M_end1 != _S_invalid_state_id)
_M_nfa[_M_end1]._M_next = __rhs._M_start; _M_nfa[_M_end1]._M_next = __rhs._M_start;
_M_end1 = __rhs._M_end1; _M_end1 = __rhs._M_end1;
} }
......
...@@ -49,10 +49,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -49,10 +49,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
explicit explicit
_BracketMatcher(bool __is_non_matching, _BracketMatcher(bool __is_non_matching,
const _TraitsT& __t, const _TraitsT& __t,
_FlagT __flags) _FlagT __flags)
: _M_is_non_matching(__is_non_matching), _M_traits(__t), : _M_is_non_matching(__is_non_matching), _M_traits(__t),
_M_flags(__flags), _M_class_set(0) _M_flags(__flags), _M_class_set(0)
{ } { }
bool bool
...@@ -61,40 +61,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -61,40 +61,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void void
_M_add_char(_CharT __c) _M_add_char(_CharT __c)
{ {
if (_M_flags & regex_constants::collate) if (_M_flags & regex_constants::collate)
if (_M_is_icase()) if (_M_is_icase())
_M_char_set.push_back(_M_traits.translate_nocase(__c)); _M_char_set.push_back(_M_traits.translate_nocase(__c));
else else
_M_char_set.push_back(_M_traits.translate(__c)); _M_char_set.push_back(_M_traits.translate(__c));
else else
_M_char_set.push_back(__c); _M_char_set.push_back(__c);
} }
void void
_M_add_collating_element(const _StringT& __s) _M_add_collating_element(const _StringT& __s)
{ {
auto __st = _M_traits.lookup_collatename(&*__s.begin(), &*__s.end()); auto __st = _M_traits.lookup_collatename(&*__s.begin(), &*__s.end());
if (__st.empty()) if (__st.empty())
__throw_regex_error(regex_constants::error_collate); __throw_regex_error(regex_constants::error_collate);
// TODO: digraph // TODO: digraph
_M_char_set.push_back(__st[0]); _M_char_set.push_back(__st[0]);
} }
void void
_M_add_equivalence_class(const _StringT& __s) _M_add_equivalence_class(const _StringT& __s)
{ {
_M_add_character_class( _M_add_character_class(
_M_traits.transform_primary(&*__s.begin(), &*__s.end())); _M_traits.transform_primary(&*__s.begin(), &*__s.end()));
} }
void void
_M_add_character_class(const _StringT& __s) _M_add_character_class(const _StringT& __s)
{ {
auto __st = _M_traits. auto __st = _M_traits.
lookup_classname(&*__s.begin(), &*__s.end(), _M_is_icase()); lookup_classname(&*__s.begin(), &*__s.end(), _M_is_icase());
if (__st == 0) if (__st == 0)
__throw_regex_error(regex_constants::error_ctype); __throw_regex_error(regex_constants::error_ctype);
_M_class_set |= __st; _M_class_set |= __st;
} }
void void
...@@ -108,11 +108,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -108,11 +108,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StringT _StringT
_M_get_str(_CharT __c) const _M_get_str(_CharT __c) const
{ {
auto __s = _StringT(1, auto __s = _StringT(1,
_M_is_icase() _M_is_icase()
? _M_traits.translate_nocase(__c) ? _M_traits.translate_nocase(__c)
: _M_traits.translate(__c)); : _M_traits.translate(__c));
return _M_traits.transform(__s.begin(), __s.end()); return _M_traits.transform(__s.begin(), __s.end());
} }
_TraitsT _M_traits; _TraitsT _M_traits;
...@@ -177,9 +177,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -177,9 +177,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}; };
_Scanner(_InputIter __begin, _InputIter __end, _Scanner(_InputIter __begin, _InputIter __end,
_FlagT __flags, std::locale __loc) _FlagT __flags, std::locale __loc)
: _M_current(__begin) , _M_end(__end) , _M_flags(__flags), : _M_current(__begin) , _M_end(__end) , _M_flags(__flags),
_M_ctype(std::use_facet<_CtypeT>(__loc)), _M_state(0) _M_ctype(std::use_facet<_CtypeT>(__loc)), _M_state(0)
{ _M_advance(); } { _M_advance(); }
void void
...@@ -238,7 +238,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -238,7 +238,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef regex_constants::syntax_option_type _FlagT; typedef regex_constants::syntax_option_type _FlagT;
_Compiler(_InputIter __b, _InputIter __e, _Compiler(_InputIter __b, _InputIter __e,
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() const
......
...@@ -98,13 +98,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -98,13 +98,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
else if (__c == _M_ctype.widen('[')) else if (__c == _M_ctype.widen('['))
{ {
if (*++_M_current == _M_ctype.widen('^')) if (*++_M_current == _M_ctype.widen('^'))
{ {
_M_curToken = _S_token_bracket_inverse_begin; _M_curToken = _S_token_bracket_inverse_begin;
++_M_current; ++_M_current;
} }
else else
_M_curToken = _S_token_bracket_begin; _M_curToken = _S_token_bracket_begin;
_M_state |= _S_state_in_bracket; _M_state |= _S_state_in_bracket;
return; return;
} }
...@@ -223,16 +223,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -223,16 +223,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
else if (*_M_current == _M_ctype.widen(']')) else if (*_M_current == _M_ctype.widen(']'))
{ {
_M_curToken = _S_token_bracket_end; _M_curToken = _S_token_bracket_end;
_M_state &= ~_S_state_in_bracket; _M_state &= ~_S_state_in_bracket;
++_M_current; ++_M_current;
return; return;
} }
else if (*_M_current == _M_ctype.widen('\\')) else if (*_M_current == _M_ctype.widen('\\'))
{ {
_M_eat_escape(); _M_eat_escape();
return; return;
} }
_M_curToken = _S_token_collelem_single; _M_curToken = _S_token_collelem_single;
_M_curValue.assign(1, *_M_current); _M_curValue.assign(1, *_M_current);
++_M_current; ++_M_current;
...@@ -341,23 +341,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -341,23 +341,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_curValue.assign(1, __c); _M_curValue.assign(1, __c);
} }
else if (_M_state & _S_state_in_bracket) else if (_M_state & _S_state_in_bracket)
{ {
if (__c == _M_ctype.widen('-') if (__c == _M_ctype.widen('-')
|| __c == _M_ctype.widen('[') || __c == _M_ctype.widen('[')
|| __c == _M_ctype.widen(']')) || __c == _M_ctype.widen(']'))
{ {
_M_curToken = _S_token_ord_char; _M_curToken = _S_token_ord_char;
_M_curValue.assign(1, __c); _M_curValue.assign(1, __c);
} }
else if ((_M_flags & regex_constants::ECMAScript) else if ((_M_flags & regex_constants::ECMAScript)
&& __c == _M_ctype.widen('b')) && __c == _M_ctype.widen('b'))
{ {
_M_curToken = _S_token_ord_char; _M_curToken = _S_token_ord_char;
_M_curValue.assign(1, _M_ctype.widen(' ')); _M_curValue.assign(1, _M_ctype.widen(' '));
} }
else else
__throw_regex_error(regex_constants::error_escape); __throw_regex_error(regex_constants::error_escape);
} }
else else
__throw_regex_error(regex_constants::error_escape); __throw_regex_error(regex_constants::error_escape);
} }
...@@ -444,8 +444,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -444,8 +444,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
ostr << "bracket-begin\n"; ostr << "bracket-begin\n";
break; break;
case _S_token_bracket_inverse_begin: case _S_token_bracket_inverse_begin:
ostr << "bracket-inverse-begin\n"; ostr << "bracket-inverse-begin\n";
break; break;
case _S_token_bracket_end: case _S_token_bracket_end:
ostr << "bracket-end\n"; ostr << "bracket-end\n";
break; break;
...@@ -518,8 +518,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -518,8 +518,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
case _S_token_unknown: case _S_token_unknown:
ostr << "-- unknown token --\n"; ostr << "-- unknown token --\n";
break; break;
default: default:
_GLIBCXX_DEBUG_ASSERT(false); _GLIBCXX_DEBUG_ASSERT(false);
} }
return ostr; return ostr;
} }
...@@ -528,7 +528,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -528,7 +528,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _InputIter, typename _CharT, typename _TraitsT> template<typename _InputIter, typename _CharT, typename _TraitsT>
_Compiler<_InputIter, _CharT, _TraitsT>:: _Compiler<_InputIter, _CharT, _TraitsT>::
_Compiler(_InputIter __b, _InputIter __e, _Compiler(_InputIter __b, _InputIter __e,
const _TraitsT& __traits, _FlagT __flags) const _TraitsT& __traits, _FlagT __flags)
: _M_traits(__traits), _M_scanner(__b, __e, __flags, _M_traits.getloc()), : _M_traits(__traits), _M_scanner(__b, __e, __flags, _M_traits.getloc()),
_M_state_store(__flags), _M_flags(__flags) _M_state_store(__flags), _M_flags(__flags)
{ {
...@@ -551,8 +551,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -551,8 +551,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
if (token == _M_scanner._M_token()) if (token == _M_scanner._M_token())
{ {
_M_cur_value = _M_scanner._M_value(); _M_cur_value = _M_scanner._M_value();
_M_scanner._M_advance(); _M_scanner._M_advance();
return true; return true;
} }
return false; return false;
...@@ -714,39 +714,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -714,39 +714,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
if (_M_match_token(_ScannerT::_S_token_anychar)) if (_M_match_token(_ScannerT::_S_token_anychar))
{ {
const static auto& const static auto&
__any_matcher = [](_CharT) -> bool __any_matcher = [](_CharT) -> bool
{ return true; }; { return true; };
_M_stack.push(_StateSeqT(_M_state_store, _M_stack.push(_StateSeqT(_M_state_store,
_M_state_store._M_insert_matcher _M_state_store._M_insert_matcher
(__any_matcher))); (__any_matcher)));
return true; return true;
} }
if (_M_match_token(_ScannerT::_S_token_ord_char)) if (_M_match_token(_ScannerT::_S_token_ord_char))
{ {
auto __c = _M_cur_value[0]; auto __c = _M_cur_value[0];
__detail::_Matcher<_CharT> f; __detail::_Matcher<_CharT> f;
if (_M_flags & regex_constants::icase) if (_M_flags & regex_constants::icase)
{ {
auto __traits = this->_M_traits; auto __traits = this->_M_traits;
__c = __traits.translate_nocase(__c); __c = __traits.translate_nocase(__c);
f = [__traits, __c](_CharT __ch) -> bool f = [__traits, __c](_CharT __ch) -> bool
{ return __traits.translate_nocase(__ch) == __c; }; { return __traits.translate_nocase(__ch) == __c; };
} }
else else
f = [__c](_CharT __ch) -> bool f = [__c](_CharT __ch) -> bool
{ return __ch == __c; }; { return __ch == __c; };
_M_stack.push(_StateSeqT(_M_state_store, _M_stack.push(_StateSeqT(_M_state_store,
_M_state_store._M_insert_matcher(f))); _M_state_store._M_insert_matcher(f)));
return true; return true;
} }
if (_M_match_token(_ScannerT::_S_token_backref)) if (_M_match_token(_ScannerT::_S_token_backref))
{ {
// __m.push(_Matcher::_S_opcode_ordchar, _M_cur_value); // __m.push(_Matcher::_S_opcode_ordchar, _M_cur_value);
_M_stack.push(_StateSeqT(_M_state_store, _M_state_store. _M_stack.push(_StateSeqT(_M_state_store, _M_state_store.
_M_insert_backref(_M_cur_int_value(10)))); _M_insert_backref(_M_cur_int_value(10))));
return true; return true;
} }
if (_M_match_token(_ScannerT::_S_token_subexpr_begin)) if (_M_match_token(_ScannerT::_S_token_subexpr_begin))
...@@ -776,17 +776,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -776,17 +776,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_bracket_expression() _M_bracket_expression()
{ {
bool __inverse = bool __inverse =
_M_match_token(_ScannerT::_S_token_bracket_inverse_begin); _M_match_token(_ScannerT::_S_token_bracket_inverse_begin);
if (!(__inverse || _M_match_token(_ScannerT::_S_token_bracket_begin))) if (!(__inverse || _M_match_token(_ScannerT::_S_token_bracket_begin)))
return false; return false;
_BMatcherT __matcher( __inverse, _M_traits, _M_flags); _BMatcherT __matcher( __inverse, _M_traits, _M_flags);
// special case: only if _not_ chr first after // special case: only if _not_ chr first after
// '[' or '[^' or if ECMAscript // '[' or '[^' or if ECMAscript
if (!_M_bracket_list(__matcher) // list is empty if (!_M_bracket_list(__matcher) // list is empty
&& !(_M_flags & regex_constants::ECMAScript)) && !(_M_flags & regex_constants::ECMAScript))
__throw_regex_error(regex_constants::error_brack); __throw_regex_error(regex_constants::error_brack);
_M_stack.push(_StateSeqT(_M_state_store, _M_stack.push(_StateSeqT(_M_state_store,
_M_state_store._M_insert_matcher(__matcher))); _M_state_store._M_insert_matcher(__matcher)));
return true; return true;
} }
...@@ -796,7 +796,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -796,7 +796,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_bracket_list(_BMatcherT& __matcher) _M_bracket_list(_BMatcherT& __matcher)
{ {
if (_M_match_token(_ScannerT::_S_token_bracket_end)) if (_M_match_token(_ScannerT::_S_token_bracket_end))
return false; return false;
_M_expression_term(__matcher); _M_expression_term(__matcher);
_M_bracket_list(__matcher); _M_bracket_list(__matcher);
return true; return true;
...@@ -823,25 +823,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -823,25 +823,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return; return;
} }
if (_M_match_token(_ScannerT::_S_token_collelem_single)) // [a if (_M_match_token(_ScannerT::_S_token_collelem_single)) // [a
{ {
auto __ch = _M_cur_value[0]; auto __ch = _M_cur_value[0];
if (_M_match_token(_ScannerT::_S_token_dash)) // [a- if (_M_match_token(_ScannerT::_S_token_dash)) // [a-
{ {
// If the dash is the last character in the bracket expression, // If the dash is the last character in the bracket expression,
// it is not special. // it is not special.
if (_M_scanner._M_token() == _ScannerT::_S_token_bracket_end) if (_M_scanner._M_token() == _ScannerT::_S_token_bracket_end)
__matcher._M_add_char(_M_cur_value[0]); // [a-] <=> [a\-] __matcher._M_add_char(_M_cur_value[0]); // [a-] <=> [a\-]
else // [a-z] else // [a-z]
{ {
if (!_M_match_token(_ScannerT::_S_token_collelem_single)) if (!_M_match_token(_ScannerT::_S_token_collelem_single))
__throw_regex_error(regex_constants::error_range); __throw_regex_error(regex_constants::error_range);
__matcher._M_make_range(__ch, _M_cur_value[0]); __matcher._M_make_range(__ch, _M_cur_value[0]);
} }
} }
else // [a] else // [a]
__matcher._M_add_char(__ch); __matcher._M_add_char(__ch);
return; return;
} }
__throw_regex_error(regex_constants::error_brack); __throw_regex_error(regex_constants::error_brack);
} }
...@@ -863,32 +863,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -863,32 +863,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
auto __oldch = __ch; auto __oldch = __ch;
if (_M_flags & regex_constants::collate) if (_M_flags & regex_constants::collate)
if (_M_is_icase()) if (_M_is_icase())
__ch = _M_traits.translate_nocase(__ch); __ch = _M_traits.translate_nocase(__ch);
else else
__ch = _M_traits.translate(__ch); __ch = _M_traits.translate(__ch);
bool __ret = false; bool __ret = false;
for (auto __c : _M_char_set) for (auto __c : _M_char_set)
if (__c == __ch) if (__c == __ch)
{ {
__ret = true; __ret = true;
break; break;
} }
if (!__ret && _M_traits.isctype(__oldch, _M_class_set)) if (!__ret && _M_traits.isctype(__oldch, _M_class_set))
__ret = true; __ret = true;
else else
{ {
_StringT __s = _M_get_str(__ch); _StringT __s = _M_get_str(__ch);
for (auto& __it : _M_range_set) for (auto& __it : _M_range_set)
if (__it.first <= __s && __s <= __it.second) if (__it.first <= __s && __s <= __it.second)
{ {
__ret = true; __ret = true;
break; break;
} }
} }
if (_M_is_non_matching) if (_M_is_non_matching)
__ret = !__ret; __ret = !__ret;
return __ret; return __ret;
} }
......
...@@ -164,21 +164,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -164,21 +164,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator&(syntax_option_type __a, syntax_option_type __b) operator&(syntax_option_type __a, syntax_option_type __b)
{ {
return (syntax_option_type)(static_cast<unsigned int>(__a) return (syntax_option_type)(static_cast<unsigned int>(__a)
& static_cast<unsigned int>(__b)); & static_cast<unsigned int>(__b));
} }
constexpr inline syntax_option_type constexpr inline syntax_option_type
operator|(syntax_option_type __a, syntax_option_type __b) operator|(syntax_option_type __a, syntax_option_type __b)
{ {
return (syntax_option_type)(static_cast<unsigned int>(__a) return (syntax_option_type)(static_cast<unsigned int>(__a)
| static_cast<unsigned int>(__b)); | static_cast<unsigned int>(__b));
} }
constexpr inline syntax_option_type constexpr inline syntax_option_type
operator^(syntax_option_type __a, syntax_option_type __b) operator^(syntax_option_type __a, syntax_option_type __b)
{ {
return (syntax_option_type)(static_cast<unsigned int>(__a) return (syntax_option_type)(static_cast<unsigned int>(__a)
^ static_cast<unsigned int>(__b)); ^ static_cast<unsigned int>(__b));
} }
constexpr inline syntax_option_type constexpr inline syntax_option_type
......
...@@ -76,17 +76,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -76,17 +76,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
protected: protected:
typedef typename _NFA<_CharT, _TraitsT>::_SizeT _SizeT; typedef typename _NFA<_CharT, _TraitsT>::_SizeT _SizeT;
_Executor(_BiIter __begin, _Executor(_BiIter __begin,
_BiIter __end, _BiIter __end,
_ResultsT& __results, _ResultsT& __results,
_FlagT __flags, _FlagT __flags,
_SizeT __size) _SizeT __size)
: _M_current(__begin), _M_end(__end), _M_results(__results), : _M_current(__begin), _M_end(__end), _M_results(__results),
_M_flags(__flags) _M_flags(__flags)
{ {
__size += 2; __size += 2;
_M_results.resize(__size); _M_results.resize(__size);
for (auto __i = 0; __i < __size; __i++) for (auto __i = 0; __i < __size; __i++)
_M_results[__i].matched = false; _M_results[__i].matched = false;
} }
_BiIter _M_current; _BiIter _M_current;
...@@ -121,12 +121,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -121,12 +121,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef regex_constants::match_flag_type _FlagT; typedef regex_constants::match_flag_type _FlagT;
_DFSExecutor(_BiIter __begin, _DFSExecutor(_BiIter __begin,
_BiIter __end, _BiIter __end,
_ResultsT& __results, _ResultsT& __results,
const _RegexT& __nfa, const _RegexT& __nfa,
_FlagT __flags) _FlagT __flags)
: _BaseT(__begin, __end, __results, __flags, __nfa._M_sub_count()), : _BaseT(__begin, __end, __results, __flags, __nfa._M_sub_count()),
_M_traits(_TraitsT()), _M_nfa(__nfa), _M_results_ret(this->_M_results) _M_traits(_TraitsT()), _M_nfa(__nfa), _M_results_ret(this->_M_results)
{ } { }
void void
...@@ -139,8 +139,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -139,8 +139,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private: private:
template<bool __match_mode> template<bool __match_mode>
bool bool
_M_dfs(_StateIdT __i); _M_dfs(_StateIdT __i);
_ResultsVec _M_results_ret; _ResultsVec _M_results_ret;
_TraitsT _M_traits; _TraitsT _M_traits;
...@@ -174,17 +174,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -174,17 +174,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef regex_constants::match_flag_type _FlagT; typedef regex_constants::match_flag_type _FlagT;
_BFSExecutor(_BiIter __begin, _BFSExecutor(_BiIter __begin,
_BiIter __end, _BiIter __end,
_ResultsT& __results, _ResultsT& __results,
const _RegexT& __nfa, const _RegexT& __nfa,
_FlagT __flags) _FlagT __flags)
: _BaseT(__begin, __end, __results, __flags, __nfa._M_sub_count()), : _BaseT(__begin, __end, __results, __flags, __nfa._M_sub_count()),
_M_nfa(__nfa) _M_nfa(__nfa)
{ {
if (_M_nfa._M_start() != _S_invalid_state_id) if (_M_nfa._M_start() != _S_invalid_state_id)
_M_covered[_M_nfa._M_start()] = _M_covered[_M_nfa._M_start()] =
_ResultsPtr(new _ResultsVec(this->_M_results)); _ResultsPtr(new _ResultsVec(this->_M_results));
_M_e_closure(); _M_e_closure();
} }
void void
...@@ -197,8 +197,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -197,8 +197,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private: private:
template<bool __match_mode> template<bool __match_mode>
void void
_M_main_loop(); _M_main_loop();
void void
_M_e_closure(); _M_e_closure();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment