49 namespace std _GLIBCXX_VISIBILITY(default)
 
   53 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   55   template<
typename _FwdIter>
 
   57     _Scanner(_FwdIter __begin, _FwdIter __end,
 
   59     : _M_state(_S_state_normal), _M_current(__begin), _M_end(__end),
 
   62       _M_at_bracket_start(false),
 
   65       {
'^', _S_token_line_begin},
 
   66       {
'$', _S_token_line_end},
 
   67       {
'.', _S_token_anychar},
 
   68       {
'*', _S_token_closure0},
 
   69       {
'+', _S_token_closure1},
 
  124       _M_extended_spec_char
 
  139       _M_escape_map(_M_is_ecma()
 
  141             : _M_awk_escape_map),
 
  142       _M_spec_char(_M_is_ecma()
 
  146            : _M_extended_spec_char),
 
  147       _M_eat_escape(_M_is_ecma()
 
  148             ? &_Scanner::_M_eat_escape_ecma
 
  149             : &_Scanner::_M_eat_escape_posix)
 
  152   template<
typename _FwdIter>
 
  157       if (_M_current == _M_end)
 
  159       _M_token = _S_token_eof;
 
  163       if (_M_state == _S_state_normal)
 
  165       else if (_M_state == _S_state_in_bracket)
 
  166     _M_scan_in_bracket();
 
  167       else if (_M_state == _S_state_in_brace)
 
  170     _GLIBCXX_DEBUG_ASSERT(
false);
 
  176   template<
typename _FwdIter>
 
  181       auto __c = *_M_current++;
 
  185       if (_M_current == _M_end)
 
  189           || (*_M_current != 
'(' 
  190           && *_M_current != 
')' 
  191           && *_M_current != 
'{'))
 
  193           (this->*_M_eat_escape)();
 
  200       if (_M_is_ecma() && *_M_current == 
'?')
 
  202           if (++_M_current == _M_end)
 
  205           if (*_M_current == 
':')
 
  208           _M_token = _S_token_subexpr_no_group_begin;
 
  210           else if (*_M_current == 
'=')
 
  213           _M_token = _S_token_subexpr_lookahead_begin;
 
  214           _M_value.assign(1, 
'p');
 
  216           else if (*_M_current == 
'!')
 
  219           _M_token = _S_token_subexpr_lookahead_begin;
 
  220           _M_value.assign(1, 
'n');
 
  226         _M_token = _S_token_subexpr_begin;
 
  229     _M_token = _S_token_subexpr_end;
 
  232       _M_state = _S_state_in_bracket;
 
  233       _M_at_bracket_start = 
true;
 
  234       if (_M_current != _M_end && *_M_current == 
'^')
 
  236           _M_token = _S_token_bracket_neg_begin;
 
  240         _M_token = _S_token_bracket_begin;
 
  244       _M_state = _S_state_in_brace;
 
  245       _M_token = _S_token_interval_begin;
 
  247       else if ((_M_spec_char.count(_M_ctype.narrow(__c, 
'\0'))
 
  250            || (_M_is_grep() && __c == 
'\n'))
 
  251     _M_token = _M_token_map.at(__c);
 
  254       _M_token = _S_token_ord_char;
 
  255       _M_value.assign(1, __c);
 
  262   template<
typename _FwdIter>
 
  267       if (_M_current == _M_end)
 
  270       auto __c = *_M_current++;
 
  274       if (_M_current == _M_end)
 
  277       if (*_M_current == 
'.')
 
  279           _M_token = _S_token_collsymbol;
 
  280           _M_eat_class(*_M_current++);
 
  282       else if (*_M_current == 
':')
 
  284           _M_token = _S_token_char_class_name;
 
  285           _M_eat_class(*_M_current++);
 
  287       else if (*_M_current == 
'=')
 
  289           _M_token = _S_token_equiv_class_name;
 
  290           _M_eat_class(*_M_current++);
 
  294           _M_token = _S_token_ord_char;
 
  295           _M_value.assign(1, __c);
 
  301       else if (__c == 
']' && (_M_is_ecma() || !_M_at_bracket_start))
 
  303       _M_token = _S_token_bracket_end;
 
  304       _M_state = _S_state_normal;
 
  307       else if (__c == 
'\\' && (_M_is_ecma() || _M_is_awk()))
 
  308     (this->*_M_eat_escape)();
 
  311       _M_token = _S_token_ord_char;
 
  312       _M_value.assign(1, __c);
 
  314       _M_at_bracket_start = 
false;
 
  319   template<
typename _FwdIter>
 
  324       if (_M_current == _M_end)
 
  327       auto __c = *_M_current++;
 
  329       if (_M_ctype.is(_CtypeT::digit, __c))
 
  331       _M_token = _S_token_dup_count;
 
  332       _M_value.assign(1, __c);
 
  333       while (_M_current != _M_end
 
  334          && _M_ctype.is(_CtypeT::digit, *_M_current))
 
  335         _M_value += *_M_current++;
 
  338     _M_token = _S_token_comma;
 
  340       else if (_M_is_basic())
 
  342       if (__c == 
'\\' && _M_current != _M_end && *_M_current == 
'}')
 
  344           _M_state = _S_state_normal;
 
  345           _M_token = _S_token_interval_end;
 
  353       _M_state = _S_state_normal;
 
  354       _M_token = _S_token_interval_end;
 
  360   template<
typename _FwdIter>
 
  365       if (_M_current == _M_end)
 
  368       auto __c = *_M_current++;
 
  370       if (_M_escape_map.count(_M_ctype.narrow(__c, 
'\0'))
 
  371       && (__c != 
'b' || _M_state == _S_state_in_bracket))
 
  373       _M_token = _S_token_ord_char;
 
  374       _M_value.assign(1, _M_escape_map.at(__c));
 
  378       _M_token = _S_token_word_bound;
 
  379       _M_value.assign(1, 
'p');
 
  383       _M_token = _S_token_word_bound;
 
  384       _M_value.assign(1, 
'n');
 
  394       _M_token = _S_token_quoted_class;
 
  395       _M_value.assign(1, __c);
 
  399       if (_M_current == _M_end)
 
  401       _M_token = _S_token_ord_char;
 
  402       _M_value.assign(1, *_M_current++);
 
  404       else if (__c == 
'x' || __c == 
'u')
 
  407       for (
int i = 0; i < (__c == 
'x' ? 2 : 4); i++)
 
  409           if (_M_current == _M_end
 
  410           || !_M_ctype.is(_CtypeT::xdigit, *_M_current))
 
  412           _M_value += *_M_current++;
 
  414       _M_token = _S_token_hex_num;
 
  417       else if (_M_ctype.is(_CtypeT::digit, __c))
 
  419       _M_value.assign(1, __c);
 
  420       while (_M_current != _M_end
 
  421          && _M_ctype.is(_CtypeT::digit, *_M_current))
 
  422         _M_value += *_M_current++;
 
  423       _M_token = _S_token_backref;
 
  427       _M_token = _S_token_ord_char;
 
  428       _M_value.assign(1, __c);
 
  434   template<
typename _FwdIter>
 
  437     _M_eat_escape_posix()
 
  439       if (_M_current == _M_end)
 
  442       auto __c = *_M_current;
 
  444       if (_M_spec_char.count(_M_ctype.narrow(__c, 
'\0')))
 
  446       _M_token = _S_token_ord_char;
 
  447       _M_value.assign(1, __c);
 
  450       else if (_M_is_awk())
 
  455       else if (_M_is_basic() && _M_ctype.is(_CtypeT::digit, __c) && __c != 
'0')
 
  457       _M_token = _S_token_backref;
 
  458       _M_value.assign(1, __c);
 
  462 #ifdef __STRICT_ANSI__ 
  465       _M_token = _S_token_ord_char;
 
  466       _M_value.assign(1, __c);
 
  472   template<
typename _FwdIter>
 
  477       auto __c = *_M_current++;
 
  479       if (_M_escape_map.count(_M_ctype.narrow(__c, 
'\0')))
 
  481       _M_token = _S_token_ord_char;
 
  482       _M_value.assign(1, _M_escape_map.at(__c));
 
  485       else if (_M_ctype.is(_CtypeT::digit, __c)
 
  489       _M_value.assign(1,  __c);
 
  492            && _M_current != _M_end
 
  493            && _M_ctype.is(_CtypeT::digit, *_M_current)
 
  494            && *_M_current != 
'8' 
  495            && *_M_current != 
'9';
 
  497         _M_value += *_M_current++;
 
  498       _M_token = _S_token_oct_num;
 
  508   template<
typename _FwdIter>
 
  511     _M_eat_class(
char __ch)
 
  513       for (_M_value.clear(); _M_current != _M_end && *_M_current != __ch;)
 
  514     _M_value += *_M_current++;
 
  515       if (_M_current == _M_end
 
  516       || *_M_current++ != __ch
 
  517       || _M_current == _M_end 
 
  518       || *_M_current++ != 
']') 
 
  527 #ifdef _GLIBCXX_DEBUG 
  528   template<
typename _FwdIter>
 
  535       case _S_token_anychar:
 
  536     ostr << 
"any-character\n";
 
  538       case _S_token_backref:
 
  541       case _S_token_bracket_begin:
 
  542     ostr << 
"bracket-begin\n";
 
  544       case _S_token_bracket_neg_begin:
 
  545     ostr << 
"bracket-neg-begin\n";
 
  547       case _S_token_bracket_end:
 
  548     ostr << 
"bracket-end\n";
 
  550       case _S_token_char_class_name:
 
  551     ostr << 
"char-class-name \"" << _M_value << 
"\"\n";
 
  553       case _S_token_closure0:
 
  554     ostr << 
"closure0\n";
 
  556       case _S_token_closure1:
 
  557     ostr << 
"closure1\n";
 
  559       case _S_token_collsymbol:
 
  560     ostr << 
"collsymbol \"" << _M_value << 
"\"\n";
 
  565       case _S_token_dup_count:
 
  566     ostr << 
"dup count: " << _M_value << 
"\n";
 
  571       case _S_token_equiv_class_name:
 
  572     ostr << 
"equiv-class-name \"" << _M_value << 
"\"\n";
 
  574       case _S_token_interval_begin:
 
  575     ostr << 
"interval begin\n";
 
  577       case _S_token_interval_end:
 
  578     ostr << 
"interval end\n";
 
  580       case _S_token_line_begin:
 
  581     ostr << 
"line begin\n";
 
  583       case _S_token_line_end:
 
  584     ostr << 
"line end\n";
 
  592       case _S_token_ord_char:
 
  593     ostr << 
"ordinary character: \"" << _M_value << 
"\"\n";
 
  595       case _S_token_subexpr_begin:
 
  596     ostr << 
"subexpr begin\n";
 
  598       case _S_token_subexpr_no_group_begin:
 
  599     ostr << 
"no grouping subexpr begin\n";
 
  601       case _S_token_subexpr_lookahead_begin:
 
  602     ostr << 
"lookahead subexpr begin\n";
 
  604       case _S_token_subexpr_end:
 
  605     ostr << 
"subexpr end\n";
 
  607       case _S_token_unknown:
 
  608     ostr << 
"-- unknown token --\n";
 
  610       case _S_token_oct_num:
 
  611     ostr << 
"oct number " << _M_value << 
"\n";
 
  613       case _S_token_hex_num:
 
  614     ostr << 
"hex number " << _M_value << 
"\n";
 
  616       case _S_token_quoted_class:
 
  617     ostr << 
"quoted class " << 
"\\" << _M_value << 
"\n";
 
  620     _GLIBCXX_DEBUG_ASSERT(
false);
 
  626 _GLIBCXX_END_NAMESPACE_VERSION
 
constexpr error_type error_ctype(_S_error_ctype)
 
const _Facet & use_facet(const locale &__loc)
Return a facet.use_facet looks for and returns a reference to a facet of type Facet where Facet is th...
 
Container class for localization functionality.The locale class is first a class wrapper for C librar...
 
constexpr error_type error_brack(_S_error_brack)
 
constexpr error_type error_badbrace(_S_error_badbrace)
 
constexpr error_type error_collate(_S_error_collate)
 
constexpr error_type error_paren(_S_error_paren)
 
constexpr error_type error_escape(_S_error_escape)
 
constexpr error_type error_brace(_S_error_brace)