Commit 75eec5b6 by Jonathan Wakely Committed by Jonathan Wakely

regex_compiler.h: Remove unnecessary bind() calls.

2011-02-14  Jonathan Wakely  <jwakely.gcc@gmail.com>

	* include/bits/regex_compiler.h: Remove unnecessary bind() calls.
	* include/bits/regex_nfa.h: Remove unnecessary base classes.

From-SVN: r170124
parent 1e263792
2011-02-14 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/regex_compiler.h: Remove unnecessary bind() calls.
* include/bits/regex_nfa.h: Remove unnecessary base classes.
2011-02-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 2011-02-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure: Regenerate. * configure: Regenerate.
......
// class template regex -*- C++ -*- // class template regex -*- C++ -*-
// Copyright (C) 2010 Free Software Foundation, Inc. // Copyright (C) 2010, 2011 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -714,23 +714,18 @@ namespace __regex ...@@ -714,23 +714,18 @@ namespace __regex
: _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_state_store(__flags)
{ {
using std::bind;
using std::placeholders::_1;
using std::placeholders::_2;
typedef _StartTagger<_InIter, _TraitsT> _Start; typedef _StartTagger<_InIter, _TraitsT> _Start;
typedef _EndTagger<_InIter, _TraitsT> _End; typedef _EndTagger<_InIter, _TraitsT> _End;
_StateSeq __r(_M_state_store, _StateSeq __r(_M_state_store,
_M_state_store._M_insert_subexpr_begin( _M_state_store._M_insert_subexpr_begin(_Start(0)));
bind(_Start(0), _1, _2)));
_M_disjunction(); _M_disjunction();
if (!_M_stack.empty()) if (!_M_stack.empty())
{ {
__r._M_append(_M_stack.top()); __r._M_append(_M_stack.top());
_M_stack.pop(); _M_stack.pop();
} }
__r._M_append(_M_state_store. __r._M_append(_M_state_store._M_insert_subexpr_end(0, _End(0)));
_M_insert_subexpr_end(0, bind(_End(0), _1, _2)));
__r._M_append(_M_state_store._M_insert_accept()); __r._M_append(_M_state_store._M_insert_accept());
} }
...@@ -905,9 +900,6 @@ namespace __regex ...@@ -905,9 +900,6 @@ namespace __regex
_Compiler<_InIter, _TraitsT>:: _Compiler<_InIter, _TraitsT>::
_M_atom() _M_atom()
{ {
using std::bind;
using std::placeholders::_1;
using std::placeholders::_2;
typedef _CharMatcher<_InIter, _TraitsT> _CMatcher; typedef _CharMatcher<_InIter, _TraitsT> _CMatcher;
typedef _StartTagger<_InIter, _TraitsT> _Start; typedef _StartTagger<_InIter, _TraitsT> _Start;
typedef _EndTagger<_InIter, _TraitsT> _End; typedef _EndTagger<_InIter, _TraitsT> _End;
...@@ -915,26 +907,23 @@ namespace __regex ...@@ -915,26 +907,23 @@ namespace __regex
if (_M_match_token(_ScannerT::_S_token_anychar)) if (_M_match_token(_ScannerT::_S_token_anychar))
{ {
_M_stack.push(_StateSeq(_M_state_store, _M_stack.push(_StateSeq(_M_state_store,
_M_state_store. _M_state_store._M_insert_matcher
_M_insert_matcher(bind(_AnyMatcher, _1)))); (_AnyMatcher)));
return true; return true;
} }
if (_M_match_token(_ScannerT::_S_token_ord_char)) if (_M_match_token(_ScannerT::_S_token_ord_char))
{ {
_M_stack.push(_StateSeq _M_stack.push(_StateSeq(_M_state_store,
(_M_state_store, _M_state_store. _M_state_store._M_insert_matcher
_M_insert_matcher (_CMatcher(_M_cur_value[0], _M_traits))));
(bind(_CMatcher(_M_cur_value[0], _M_traits), _1))));
return true; return true;
} }
if (_M_match_token(_ScannerT::_S_token_quoted_char)) if (_M_match_token(_ScannerT::_S_token_quoted_char))
{ {
// note that in the ECMA grammar, this case covers backrefs. // note that in the ECMA grammar, this case covers backrefs.
_M_stack.push(_StateSeq(_M_state_store, _M_stack.push(_StateSeq(_M_state_store,
_M_state_store. _M_state_store._M_insert_matcher
_M_insert_matcher (_CMatcher(_M_cur_value[0], _M_traits))));
(bind(_CMatcher(_M_cur_value[0], _M_traits),
_1))));
return true; return true;
} }
if (_M_match_token(_ScannerT::_S_token_backref)) if (_M_match_token(_ScannerT::_S_token_backref))
...@@ -947,7 +936,7 @@ namespace __regex ...@@ -947,7 +936,7 @@ namespace __regex
int __mark = _M_state_store._M_sub_count(); int __mark = _M_state_store._M_sub_count();
_StateSeq __r(_M_state_store, _StateSeq __r(_M_state_store,
_M_state_store. _M_state_store.
_M_insert_subexpr_begin(bind(_Start(__mark), _1, _2))); _M_insert_subexpr_begin(_Start(__mark)));
this->_M_disjunction(); this->_M_disjunction();
if (!_M_match_token(_ScannerT::_S_token_subexpr_end)) if (!_M_match_token(_ScannerT::_S_token_subexpr_end))
__throw_regex_error(regex_constants::error_paren); __throw_regex_error(regex_constants::error_paren);
...@@ -957,7 +946,7 @@ namespace __regex ...@@ -957,7 +946,7 @@ namespace __regex
_M_stack.pop(); _M_stack.pop();
} }
__r._M_append(_M_state_store._M_insert_subexpr_end __r._M_append(_M_state_store._M_insert_subexpr_end
(__mark, bind(_End(__mark), _1, _2))); (__mark, _End(__mark)));
_M_stack.push(__r); _M_stack.push(__r);
return true; return true;
} }
...@@ -969,8 +958,6 @@ namespace __regex ...@@ -969,8 +958,6 @@ namespace __regex
_Compiler<_InIter, _TraitsT>:: _Compiler<_InIter, _TraitsT>::
_M_bracket_expression() _M_bracket_expression()
{ {
using std::bind;
using std::placeholders::_1;
if (_M_match_token(_ScannerT::_S_token_bracket_begin)) if (_M_match_token(_ScannerT::_S_token_bracket_begin))
{ {
_RMatcherT __matcher(_M_match_token(_ScannerT::_S_token_line_begin), _RMatcherT __matcher(_M_match_token(_ScannerT::_S_token_line_begin),
...@@ -979,8 +966,7 @@ namespace __regex ...@@ -979,8 +966,7 @@ namespace __regex
|| !_M_match_token(_ScannerT::_S_token_bracket_end)) || !_M_match_token(_ScannerT::_S_token_bracket_end))
__throw_regex_error(regex_constants::error_brack); __throw_regex_error(regex_constants::error_brack);
_M_stack.push(_StateSeq(_M_state_store, _M_stack.push(_StateSeq(_M_state_store,
_M_state_store._M_insert_matcher _M_state_store._M_insert_matcher(__matcher)));
(bind(__matcher, _1))));
return true; return true;
} }
return false; return false;
......
// class template regex -*- C++ -*- // class template regex -*- C++ -*-
// Copyright (C) 2010 Free Software Foundation, Inc. // Copyright (C) 2010, 2011 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // 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 // software; you can redistribute it and/or modify it under the
...@@ -82,7 +82,6 @@ namespace __regex ...@@ -82,7 +82,6 @@ namespace __regex
template<typename _FwdIterT, typename _TraitsT> template<typename _FwdIterT, typename _TraitsT>
struct _StartTagger struct _StartTagger
: public _Tagger
{ {
explicit explicit
_StartTagger(int __i) _StartTagger(int __i)
...@@ -98,7 +97,6 @@ namespace __regex ...@@ -98,7 +97,6 @@ namespace __regex
template<typename _FwdIterT, typename _TraitsT> template<typename _FwdIterT, typename _TraitsT>
struct _EndTagger struct _EndTagger
: public _Tagger
{ {
explicit explicit
_EndTagger(int __i) _EndTagger(int __i)
...@@ -123,7 +121,6 @@ namespace __regex ...@@ -123,7 +121,6 @@ namespace __regex
// Matches a single character // Matches a single character
template<typename _InIterT, typename _TraitsT> template<typename _InIterT, typename _TraitsT>
struct _CharMatcher struct _CharMatcher
: public _Matcher
{ {
typedef typename _TraitsT::char_type char_type; typedef typename _TraitsT::char_type char_type;
...@@ -147,7 +144,6 @@ namespace __regex ...@@ -147,7 +144,6 @@ namespace __regex
// Matches a character range (bracket expression) // Matches a character range (bracket expression)
template<typename _InIterT, typename _TraitsT> template<typename _InIterT, typename _TraitsT>
struct _RangeMatcher struct _RangeMatcher
: public _Matcher
{ {
typedef typename _TraitsT::char_type _CharT; typedef typename _TraitsT::char_type _CharT;
typedef std::basic_string<_CharT> _StringT; typedef std::basic_string<_CharT> _StringT;
...@@ -208,7 +204,7 @@ namespace __regex ...@@ -208,7 +204,7 @@ namespace __regex
typedef int _OpcodeT; typedef int _OpcodeT;
_OpcodeT _M_opcode; // type of outgoing transition _OpcodeT _M_opcode; // type of outgoing transition
_StateIdT _M_next; // outgoing tranition _StateIdT _M_next; // outgoing transition
_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_*
_Tagger _M_tagger; // for _S_opcode_subexpr_* _Tagger _M_tagger; // for _S_opcode_subexpr_*
......
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